forked from CopilotKit/CopilotKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbutton.tsx
More file actions
124 lines (119 loc) · 4.89 KB
/
Copy pathbutton.tsx
File metadata and controls
124 lines (119 loc) · 4.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
import * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "../../lib/utils";
const buttonVariants = cva(
"cpk:inline-flex cpk:items-center cpk:justify-center cpk:gap-2 cpk:whitespace-nowrap cpk:rounded-md cpk:text-sm cpk:font-medium cpk:transition-all cpk:disabled:pointer-events-none cpk:disabled:opacity-50 cpk:[&_svg]:pointer-events-none cpk:[&_svg:not([class*='size-'])]:size-4 cpk:shrink-0 cpk:[&_svg]:shrink-0 cpk:outline-none cpk:focus-visible:border-ring cpk:focus-visible:ring-ring/50 cpk:focus-visible:ring-[3px] cpk:aria-invalid:ring-destructive/20 cpk:dark:aria-invalid:ring-destructive/40 cpk:aria-invalid:border-destructive",
{
variants: {
variant: {
default:
"cpk:bg-primary cpk:text-primary-foreground cpk:shadow-xs cpk:hover:bg-primary/90",
destructive:
"cpk:bg-destructive cpk:text-white cpk:shadow-xs cpk:hover:bg-destructive/90 cpk:focus-visible:ring-destructive/20 cpk:dark:focus-visible:ring-destructive/40 cpk:dark:bg-destructive/60",
outline:
"cpk:border cpk:bg-background cpk:shadow-xs cpk:hover:bg-accent cpk:hover:text-accent-foreground cpk:dark:bg-input/30 cpk:dark:border-input cpk:dark:hover:bg-input/50",
secondary:
"cpk:bg-secondary cpk:text-secondary-foreground cpk:shadow-xs cpk:hover:bg-secondary/80",
ghost:
"cpk:hover:bg-accent cpk:hover:text-accent-foreground cpk:dark:hover:bg-accent/50 cpk:cursor-pointer",
link: "cpk:text-primary cpk:underline-offset-4 cpk:hover:underline",
assistantMessageToolbarButton: [
"cpk:cursor-pointer",
// Background and text
"cpk:p-0 cpk:text-[rgb(93,93,93)] cpk:hover:bg-[#E8E8E8]",
// Dark mode - lighter gray for better contrast
"cpk:dark:text-[rgb(243,243,243)] cpk:dark:hover:bg-[#303030]",
// Shape and sizing
"cpk:h-8 cpk:w-8",
// Interactions
"cpk:transition-colors",
// Hover states
"cpk:hover:text-[rgb(93,93,93)]",
"cpk:dark:hover:text-[rgb(243,243,243)]",
],
chatInputToolbarPrimary: [
"cpk:cursor-pointer",
// Background and text
"cpk:bg-black cpk:text-white",
// Dark mode
"cpk:dark:bg-white cpk:dark:text-black cpk:dark:focus-visible:outline-white",
// Shape and sizing
"cpk:rounded-full",
// Interactions
"cpk:transition-colors",
// Focus states
"cpk:focus:outline-none",
// Hover states
"cpk:hover:opacity-70 cpk:disabled:hover:opacity-100",
// Disabled states
"cpk:disabled:cursor-not-allowed cpk:disabled:bg-[#00000014] cpk:disabled:text-[rgb(13,13,13)]",
"cpk:dark:disabled:bg-[#454545] cpk:dark:disabled:text-white ",
],
chatInputToolbarSecondary: [
"cpk:cursor-pointer",
// Background and text
"cpk:bg-transparent cpk:text-[#444444]",
// Dark mode
"cpk:dark:text-white cpk:dark:border-[#404040]",
// Shape and sizing
"cpk:rounded-full",
// Interactions
"cpk:transition-colors",
// Focus states
"cpk:focus:outline-none",
// Hover states
"cpk:hover:bg-[#f8f8f8] cpk:hover:text-[#333333]",
"cpk:dark:hover:bg-[#404040] cpk:dark:hover:text-[#FFFFFF]",
// Disabled states
"cpk:disabled:cursor-not-allowed cpk:disabled:opacity-50",
"cpk:disabled:hover:bg-transparent cpk:disabled:hover:text-[#444444]",
"cpk:dark:disabled:hover:bg-transparent cpk:dark:disabled:hover:text-[#CCCCCC]",
],
},
size: {
default: "cpk:h-9 cpk:px-4 cpk:py-2 cpk:has-[>svg]:px-3",
sm: "cpk:h-8 cpk:rounded-md cpk:gap-1.5 cpk:px-3 cpk:has-[>svg]:px-2.5",
lg: "cpk:h-10 cpk:rounded-md cpk:px-6 cpk:has-[>svg]:px-4",
icon: "cpk:size-9",
chatInputToolbarIcon: [
// Shape and sizing
"cpk:h-9 cpk:w-9 cpk:rounded-full",
],
chatInputToolbarIconLabel: [
// Shape and sizing
"cpk:h-9 cpk:px-3 cpk:rounded-full",
// Layout
"cpk:gap-2",
// Typography
"cpk:font-normal",
],
},
},
defaultVariants: {
variant: "default",
size: "default",
},
},
);
const Button = React.forwardRef<
HTMLButtonElement,
React.ComponentProps<"button"> &
VariantProps<typeof buttonVariants> & {
asChild?: boolean;
}
>(function Button(
{ className, variant, size, asChild = false, ...props },
ref,
) {
const Comp = asChild ? Slot : "button";
return (
<Comp
ref={ref}
data-slot="button"
className={cn(buttonVariants({ variant, size, className }))}
{...props}
/>
);
});
export { Button, buttonVariants };