@vvedantb/ui 0.1.2 → 0.1.4
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.
- package/package.json +8 -9
- package/src/ai-elements/message.tsx +2 -2
- package/src/ai-elements/speech-input.tsx +2 -2
- package/src/ui/accordion.verve.tsx +2 -2
- package/src/ui/badge.tsx +1 -1
- package/src/ui/checkbox.tsx +1 -1
- package/src/ui/clear-input.tsx +1 -1
- package/src/ui/command.tsx +2 -2
- package/src/ui/input-group.verve.tsx +1 -1
- package/src/ui/kbd.tsx +1 -1
- package/src/ui/select.tsx +1 -1
- package/src/ui/sheet.tsx +36 -23
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/ui",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React 19 UI primitives for vmem, vibot and Verve.",
|
|
6
6
|
"type": "module",
|
|
@@ -30,11 +30,6 @@
|
|
|
30
30
|
"sideEffects": [
|
|
31
31
|
"./src/ui/sonner.css"
|
|
32
32
|
],
|
|
33
|
-
"scripts": {
|
|
34
|
-
"build": "tsc -p tsconfig.json",
|
|
35
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
36
|
-
"prepack": "tsc -p tsconfig.json"
|
|
37
|
-
},
|
|
38
33
|
"peerDependencies": {
|
|
39
34
|
"@radix-ui/react-accordion": "^1.2.12",
|
|
40
35
|
"@radix-ui/react-checkbox": "^1.3.3",
|
|
@@ -105,7 +100,6 @@
|
|
|
105
100
|
"@tabler/icons-react": "^3.35.0",
|
|
106
101
|
"@types/react": "^19.1.0",
|
|
107
102
|
"@types/react-dom": "^19.1.0",
|
|
108
|
-
"@vvedantb/tokens": "workspace:*",
|
|
109
103
|
"ai": "^5.0.0",
|
|
110
104
|
"class-variance-authority": "^0.7.1",
|
|
111
105
|
"clsx": "^2.1.1",
|
|
@@ -122,6 +116,11 @@
|
|
|
122
116
|
"tailwind-merge": "^2.6.0",
|
|
123
117
|
"typescript": "^5.9.0",
|
|
124
118
|
"use-stick-to-bottom": "^1.1.0",
|
|
125
|
-
"vaul": "^1.1.0"
|
|
119
|
+
"vaul": "^1.1.0",
|
|
120
|
+
"@vvedantb/tokens": "0.1.0"
|
|
121
|
+
},
|
|
122
|
+
"scripts": {
|
|
123
|
+
"build": "tsc -p tsconfig.json",
|
|
124
|
+
"typecheck": "tsc -p tsconfig.json"
|
|
126
125
|
}
|
|
127
|
-
}
|
|
126
|
+
}
|
|
@@ -33,8 +33,8 @@ export const MessageContent = ({
|
|
|
33
33
|
}: MessageContentProps) => (
|
|
34
34
|
<div
|
|
35
35
|
className={cn(
|
|
36
|
-
"
|
|
37
|
-
"group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-
|
|
36
|
+
"flex w-fit min-w-0 max-w-full flex-col gap-2 overflow-hidden text-sm",
|
|
37
|
+
"group-[.is-user]:ml-auto group-[.is-user]:rounded-2xl group-[.is-user]:rounded-br-md group-[.is-user]:bg-accent group-[.is-user]:px-4 group-[.is-user]:py-3 group-[.is-user]:text-accent-foreground",
|
|
38
38
|
"group-[.is-assistant]:px-0 group-[.is-assistant]:text-foreground",
|
|
39
39
|
className,
|
|
40
40
|
)}
|
|
@@ -250,8 +250,8 @@ export const SpeechInput = ({
|
|
|
250
250
|
className={cn(
|
|
251
251
|
"relative z-10 rounded-full transition-[background-color,transform] duration-200 ease-smooth active:duration-100 active:ease-out",
|
|
252
252
|
isListening
|
|
253
|
-
? "bg-
|
|
254
|
-
: "bg-
|
|
253
|
+
? "bg-danger text-danger-foreground hover:bg-danger/80 hover:text-danger-foreground"
|
|
254
|
+
: "bg-accent text-accent-foreground hover:bg-accent/80 hover:text-accent-foreground",
|
|
255
255
|
className,
|
|
256
256
|
)}
|
|
257
257
|
disabled={isDisabled}
|
|
@@ -31,7 +31,7 @@ const AccordionTrigger = React.forwardRef<
|
|
|
31
31
|
{...props}
|
|
32
32
|
>
|
|
33
33
|
{children}
|
|
34
|
-
<IconChevronDown className="h-4 w-4 shrink-0 text-muted
|
|
34
|
+
<IconChevronDown className="h-4 w-4 shrink-0 text-muted transition-transform duration-200" />
|
|
35
35
|
</AccordionPrimitive.Trigger>
|
|
36
36
|
</AccordionPrimitive.Header>
|
|
37
37
|
));
|
|
@@ -46,7 +46,7 @@ const AccordionContent = React.forwardRef<
|
|
|
46
46
|
className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
|
|
47
47
|
{...props}
|
|
48
48
|
>
|
|
49
|
-
<div className={cn("pb-4 pt-0 text-muted
|
|
49
|
+
<div className={cn("pb-4 pt-0 text-muted", className)}>
|
|
50
50
|
{children}
|
|
51
51
|
</div>
|
|
52
52
|
</AccordionPrimitive.Content>
|
package/src/ui/badge.tsx
CHANGED
|
@@ -2,7 +2,7 @@ import { cva, type VariantProps } from "class-variance-authority";
|
|
|
2
2
|
import { cn } from "../utils/cn";
|
|
3
3
|
|
|
4
4
|
const badgeVariants = cva(
|
|
5
|
-
"inline-flex items-center gap-1 rounded-full border border-transparent px-2.5 py-1 text-xs font-medium tracking-normal transition-colors focus:outline-none focus:ring-2 focus:ring-focus-ring focus:ring-offset-2",
|
|
5
|
+
"inline-flex items-center gap-1 rounded-full border border-transparent px-2.5 py-1 text-xs font-medium tracking-normal transition-colors focus:outline-none focus:ring-2 focus:ring-focus-ring focus:ring-offset-2 focus:ring-offset-background",
|
|
6
6
|
{
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
package/src/ui/checkbox.tsx
CHANGED
|
@@ -10,7 +10,7 @@ const Checkbox = React.forwardRef<
|
|
|
10
10
|
<CheckboxPrimitive.Root
|
|
11
11
|
ref={ref}
|
|
12
12
|
className={cn(
|
|
13
|
-
"peer relative h-4 w-4 shrink-0 rounded-
|
|
13
|
+
"peer relative h-4 w-4 shrink-0 rounded-[4px] 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
14
|
className,
|
|
15
15
|
)}
|
|
16
16
|
{...props}
|
package/src/ui/clear-input.tsx
CHANGED
|
@@ -152,7 +152,7 @@ const ClearInput = React.forwardRef<HTMLInputElement, ClearInputProps>(
|
|
|
152
152
|
{value.length > 0 && !clearing ? (
|
|
153
153
|
<button
|
|
154
154
|
type="button"
|
|
155
|
-
className="t-clear-btn absolute right-2 top-1/2 z-4 inline-flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-md text-muted
|
|
155
|
+
className="t-clear-btn absolute right-2 top-1/2 z-4 inline-flex h-6 w-6 -translate-y-1/2 items-center justify-center rounded-md text-muted transition-[background-color,color,transform] duration-100 ease-out active:scale-[0.92] hover:bg-surface-tertiary/50 hover:text-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-focus-ring"
|
|
156
156
|
aria-label={clearLabel}
|
|
157
157
|
onPointerDown={preventFocusSteal}
|
|
158
158
|
onMouseDown={preventFocusSteal}
|
package/src/ui/command.tsx
CHANGED
|
@@ -72,10 +72,10 @@ CommandList.displayName = CommandPrimitive.List.displayName;
|
|
|
72
72
|
const CommandEmpty = React.forwardRef<
|
|
73
73
|
React.ComponentRef<typeof CommandPrimitive.Empty>,
|
|
74
74
|
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>
|
|
75
|
-
>((props, ref) => (
|
|
75
|
+
>(({ className, ...props }, ref) => (
|
|
76
76
|
<CommandPrimitive.Empty
|
|
77
77
|
ref={ref}
|
|
78
|
-
className="py-8 text-center text-sm text-muted"
|
|
78
|
+
className={cn("py-8 text-center text-sm text-muted", className)}
|
|
79
79
|
{...props}
|
|
80
80
|
/>
|
|
81
81
|
));
|
package/src/ui/kbd.tsx
CHANGED
|
@@ -6,7 +6,7 @@ const Kbd = React.forwardRef<HTMLElement, React.HTMLAttributes<HTMLElement>>(
|
|
|
6
6
|
<kbd
|
|
7
7
|
ref={ref}
|
|
8
8
|
className={cn(
|
|
9
|
-
"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded-md bg-surface-secondary px-1.5 font-mono text-[10px] font-medium text-muted
|
|
9
|
+
"pointer-events-none inline-flex h-5 select-none items-center gap-1 rounded-md bg-surface-secondary px-1.5 font-mono text-[10px] font-medium text-muted",
|
|
10
10
|
className,
|
|
11
11
|
)}
|
|
12
12
|
{...props}
|
package/src/ui/select.tsx
CHANGED
|
@@ -74,7 +74,7 @@ const SelectContent = React.forwardRef<
|
|
|
74
74
|
<SelectPrimitive.Content
|
|
75
75
|
ref={ref}
|
|
76
76
|
className={cn(
|
|
77
|
-
"relative z-50 max-h-96 w-
|
|
77
|
+
"relative z-50 max-h-96 min-w-32 overflow-hidden outline-none",
|
|
78
78
|
floatingSurfaceClass,
|
|
79
79
|
floatingSurfaceAnimateClass,
|
|
80
80
|
position === "popper" &&
|
package/src/ui/sheet.tsx
CHANGED
|
@@ -6,15 +6,23 @@ import { cn } from "../utils/cn";
|
|
|
6
6
|
|
|
7
7
|
type SheetSide = "top" | "bottom" | "left" | "right";
|
|
8
8
|
|
|
9
|
+
// vaul animates and drags from the Root's `direction`; SheetContent reads it
|
|
10
|
+
// so `<Sheet direction="right">` places the panel on the right by default.
|
|
11
|
+
const SheetDirectionContext = React.createContext<SheetSide>("bottom");
|
|
12
|
+
|
|
9
13
|
function Sheet({
|
|
10
14
|
shouldScaleBackground = false,
|
|
15
|
+
direction = "bottom",
|
|
11
16
|
...props
|
|
12
17
|
}: React.ComponentProps<typeof DrawerPrimitive.Root>) {
|
|
13
18
|
return (
|
|
14
|
-
<
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
19
|
+
<SheetDirectionContext.Provider value={direction}>
|
|
20
|
+
<DrawerPrimitive.Root
|
|
21
|
+
shouldScaleBackground={shouldScaleBackground}
|
|
22
|
+
direction={direction}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
</SheetDirectionContext.Provider>
|
|
18
26
|
);
|
|
19
27
|
}
|
|
20
28
|
|
|
@@ -51,27 +59,32 @@ const sheetSideClass: Record<SheetSide, string> = {
|
|
|
51
59
|
const SheetContent = React.forwardRef<
|
|
52
60
|
React.ComponentRef<typeof DrawerPrimitive.Content>,
|
|
53
61
|
React.ComponentPropsWithoutRef<typeof DrawerPrimitive.Content> & {
|
|
62
|
+
/** Defaults to the parent Sheet's `direction`. */
|
|
54
63
|
side?: SheetSide;
|
|
55
64
|
}
|
|
56
|
-
>(({ className, children, side
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
className
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
65
|
+
>(({ className, children, side: sideProp, ...props }, ref) => {
|
|
66
|
+
const direction = React.useContext(SheetDirectionContext);
|
|
67
|
+
const side = sideProp ?? direction;
|
|
68
|
+
return (
|
|
69
|
+
<SheetPortal>
|
|
70
|
+
<SheetOverlay />
|
|
71
|
+
<DrawerPrimitive.Content
|
|
72
|
+
ref={ref}
|
|
73
|
+
className={cn(
|
|
74
|
+
"fixed z-50 bg-overlay/95 text-overlay-foreground smooth-shadow-ring-xl outline-hidden backdrop-blur-xl",
|
|
75
|
+
sheetSideClass[side],
|
|
76
|
+
className,
|
|
77
|
+
)}
|
|
78
|
+
{...props}
|
|
79
|
+
>
|
|
80
|
+
{side === "bottom" || side === "top" ? (
|
|
81
|
+
<SheetHandle className="mx-auto mt-3 mb-1 h-1 w-12 shrink-0 rounded-full bg-surface-tertiary" />
|
|
82
|
+
) : null}
|
|
83
|
+
{children}
|
|
84
|
+
</DrawerPrimitive.Content>
|
|
85
|
+
</SheetPortal>
|
|
86
|
+
);
|
|
87
|
+
});
|
|
75
88
|
SheetContent.displayName = "SheetContent";
|
|
76
89
|
|
|
77
90
|
export {
|