@greatapps/greatchat-ui 0.1.2 → 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.
@@ -0,0 +1,51 @@
1
+ import * as React from "react";
2
+ import { Avatar as AvatarPrimitive } from "radix-ui";
3
+
4
+ import { cn } from "../../lib/utils";
5
+
6
+ function Avatar({
7
+ className,
8
+ ...props
9
+ }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
10
+ return (
11
+ <AvatarPrimitive.Root
12
+ data-slot="avatar"
13
+ className={cn(
14
+ "relative flex size-8 shrink-0 overflow-hidden rounded-full",
15
+ className,
16
+ )}
17
+ {...props}
18
+ />
19
+ );
20
+ }
21
+
22
+ function AvatarImage({
23
+ className,
24
+ ...props
25
+ }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
26
+ return (
27
+ <AvatarPrimitive.Image
28
+ data-slot="avatar-image"
29
+ className={cn("aspect-square size-full", className)}
30
+ {...props}
31
+ />
32
+ );
33
+ }
34
+
35
+ function AvatarFallback({
36
+ className,
37
+ ...props
38
+ }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
39
+ return (
40
+ <AvatarPrimitive.Fallback
41
+ data-slot="avatar-fallback"
42
+ className={cn(
43
+ "flex size-full items-center justify-center rounded-full bg-muted",
44
+ className,
45
+ )}
46
+ {...props}
47
+ />
48
+ );
49
+ }
50
+
51
+ export { Avatar, AvatarImage, AvatarFallback };
@@ -0,0 +1,106 @@
1
+ import * as React from "react";
2
+ import { Command as CommandPrimitive } from "cmdk";
3
+ import { Search } from "lucide-react";
4
+
5
+ import { cn } from "../../lib/utils";
6
+
7
+ function Command({
8
+ className,
9
+ ...props
10
+ }: React.ComponentProps<typeof CommandPrimitive>) {
11
+ return (
12
+ <CommandPrimitive
13
+ data-slot="command"
14
+ className={cn(
15
+ "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
16
+ className,
17
+ )}
18
+ {...props}
19
+ />
20
+ );
21
+ }
22
+
23
+ function CommandInput({
24
+ className,
25
+ ...props
26
+ }: React.ComponentProps<typeof CommandPrimitive.Input>) {
27
+ return (
28
+ <div className="flex h-9 items-center gap-2 border-b px-3" data-slot="command-input-wrapper">
29
+ <Search className="size-4 shrink-0 opacity-50" />
30
+ <CommandPrimitive.Input
31
+ data-slot="command-input"
32
+ className={cn(
33
+ "flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
34
+ className,
35
+ )}
36
+ {...props}
37
+ />
38
+ </div>
39
+ );
40
+ }
41
+
42
+ function CommandList({
43
+ className,
44
+ ...props
45
+ }: React.ComponentProps<typeof CommandPrimitive.List>) {
46
+ return (
47
+ <CommandPrimitive.List
48
+ data-slot="command-list"
49
+ className={cn("max-h-[300px] overflow-y-auto overflow-x-hidden", className)}
50
+ {...props}
51
+ />
52
+ );
53
+ }
54
+
55
+ function CommandEmpty({
56
+ ...props
57
+ }: React.ComponentProps<typeof CommandPrimitive.Empty>) {
58
+ return (
59
+ <CommandPrimitive.Empty
60
+ data-slot="command-empty"
61
+ className="py-6 text-center text-sm"
62
+ {...props}
63
+ />
64
+ );
65
+ }
66
+
67
+ function CommandGroup({
68
+ className,
69
+ ...props
70
+ }: React.ComponentProps<typeof CommandPrimitive.Group>) {
71
+ return (
72
+ <CommandPrimitive.Group
73
+ data-slot="command-group"
74
+ className={cn(
75
+ "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
76
+ className,
77
+ )}
78
+ {...props}
79
+ />
80
+ );
81
+ }
82
+
83
+ function CommandItem({
84
+ className,
85
+ ...props
86
+ }: React.ComponentProps<typeof CommandPrimitive.Item>) {
87
+ return (
88
+ <CommandPrimitive.Item
89
+ data-slot="command-item"
90
+ className={cn(
91
+ "relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none select-none data-[disabled=true]:pointer-events-none data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
92
+ className,
93
+ )}
94
+ {...props}
95
+ />
96
+ );
97
+ }
98
+
99
+ export {
100
+ Command,
101
+ CommandInput,
102
+ CommandList,
103
+ CommandEmpty,
104
+ CommandGroup,
105
+ CommandItem,
106
+ };
@@ -0,0 +1,133 @@
1
+ import * as React from "react";
2
+ import { Dialog as DialogPrimitive } from "radix-ui";
3
+ import { X } from "lucide-react";
4
+
5
+ import { cn } from "../../lib/utils";
6
+
7
+ function Dialog({
8
+ ...props
9
+ }: React.ComponentProps<typeof DialogPrimitive.Root>) {
10
+ return <DialogPrimitive.Root data-slot="dialog" {...props} />;
11
+ }
12
+
13
+ function DialogTrigger({
14
+ ...props
15
+ }: React.ComponentProps<typeof DialogPrimitive.Trigger>) {
16
+ return <DialogPrimitive.Trigger data-slot="dialog-trigger" {...props} />;
17
+ }
18
+
19
+ function DialogPortal({
20
+ ...props
21
+ }: React.ComponentProps<typeof DialogPrimitive.Portal>) {
22
+ return <DialogPrimitive.Portal data-slot="dialog-portal" {...props} />;
23
+ }
24
+
25
+ function DialogClose({
26
+ ...props
27
+ }: React.ComponentProps<typeof DialogPrimitive.Close>) {
28
+ return <DialogPrimitive.Close data-slot="dialog-close" {...props} />;
29
+ }
30
+
31
+ function DialogOverlay({
32
+ className,
33
+ ...props
34
+ }: React.ComponentProps<typeof DialogPrimitive.Overlay>) {
35
+ return (
36
+ <DialogPrimitive.Overlay
37
+ data-slot="dialog-overlay"
38
+ className={cn(
39
+ "fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
40
+ className,
41
+ )}
42
+ {...props}
43
+ />
44
+ );
45
+ }
46
+
47
+ function DialogContent({
48
+ className,
49
+ children,
50
+ ...props
51
+ }: React.ComponentProps<typeof DialogPrimitive.Content>) {
52
+ return (
53
+ <DialogPortal>
54
+ <DialogOverlay />
55
+ <DialogPrimitive.Content
56
+ data-slot="dialog-content"
57
+ className={cn(
58
+ "fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
59
+ className,
60
+ )}
61
+ {...props}
62
+ >
63
+ {children}
64
+ <DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
65
+ <X className="h-4 w-4" />
66
+ <span className="sr-only">Close</span>
67
+ </DialogPrimitive.Close>
68
+ </DialogPrimitive.Content>
69
+ </DialogPortal>
70
+ );
71
+ }
72
+
73
+ function DialogHeader({ className, ...props }: React.ComponentProps<"div">) {
74
+ return (
75
+ <div
76
+ data-slot="dialog-header"
77
+ className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
78
+ {...props}
79
+ />
80
+ );
81
+ }
82
+
83
+ function DialogFooter({ className, ...props }: React.ComponentProps<"div">) {
84
+ return (
85
+ <div
86
+ data-slot="dialog-footer"
87
+ className={cn(
88
+ "flex flex-col-reverse sm:flex-row sm:justify-end sm:gap-2",
89
+ className,
90
+ )}
91
+ {...props}
92
+ />
93
+ );
94
+ }
95
+
96
+ function DialogTitle({
97
+ className,
98
+ ...props
99
+ }: React.ComponentProps<typeof DialogPrimitive.Title>) {
100
+ return (
101
+ <DialogPrimitive.Title
102
+ data-slot="dialog-title"
103
+ className={cn("text-lg font-semibold leading-none tracking-tight", className)}
104
+ {...props}
105
+ />
106
+ );
107
+ }
108
+
109
+ function DialogDescription({
110
+ className,
111
+ ...props
112
+ }: React.ComponentProps<typeof DialogPrimitive.Description>) {
113
+ return (
114
+ <DialogPrimitive.Description
115
+ data-slot="dialog-description"
116
+ className={cn("text-sm text-muted-foreground", className)}
117
+ {...props}
118
+ />
119
+ );
120
+ }
121
+
122
+ export {
123
+ Dialog,
124
+ DialogPortal,
125
+ DialogOverlay,
126
+ DialogClose,
127
+ DialogTrigger,
128
+ DialogContent,
129
+ DialogHeader,
130
+ DialogFooter,
131
+ DialogTitle,
132
+ DialogDescription,
133
+ };
@@ -0,0 +1,19 @@
1
+ import * as React from "react";
2
+
3
+ import { cn } from "../../lib/utils";
4
+
5
+ function Input({ className, type, ...props }: React.ComponentProps<"input">) {
6
+ return (
7
+ <input
8
+ type={type}
9
+ data-slot="input"
10
+ className={cn(
11
+ "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-xs transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",
12
+ className,
13
+ )}
14
+ {...props}
15
+ />
16
+ );
17
+ }
18
+
19
+ export { Input };
@@ -0,0 +1,50 @@
1
+ import * as React from "react";
2
+ import { ScrollArea as ScrollAreaPrimitive } from "radix-ui";
3
+
4
+ import { cn } from "../../lib/utils";
5
+
6
+ function ScrollArea({
7
+ className,
8
+ children,
9
+ ...props
10
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.Root>) {
11
+ return (
12
+ <ScrollAreaPrimitive.Root
13
+ data-slot="scroll-area"
14
+ className={cn("relative", className)}
15
+ {...props}
16
+ >
17
+ <ScrollAreaPrimitive.Viewport className="h-full w-full rounded-[inherit] [&>div]:!block">
18
+ {children}
19
+ </ScrollAreaPrimitive.Viewport>
20
+ <ScrollBar />
21
+ <ScrollAreaPrimitive.Corner />
22
+ </ScrollAreaPrimitive.Root>
23
+ );
24
+ }
25
+
26
+ function ScrollBar({
27
+ className,
28
+ orientation = "vertical",
29
+ ...props
30
+ }: React.ComponentProps<typeof ScrollAreaPrimitive.Scrollbar>) {
31
+ return (
32
+ <ScrollAreaPrimitive.Scrollbar
33
+ data-slot="scroll-bar"
34
+ orientation={orientation}
35
+ className={cn(
36
+ "flex touch-none p-px transition-colors select-none",
37
+ orientation === "vertical" &&
38
+ "h-full w-2.5 border-l border-l-transparent",
39
+ orientation === "horizontal" &&
40
+ "h-2.5 flex-col border-t border-t-transparent",
41
+ className,
42
+ )}
43
+ {...props}
44
+ >
45
+ <ScrollAreaPrimitive.Thumb className="relative flex-1 rounded-full bg-border" />
46
+ </ScrollAreaPrimitive.Scrollbar>
47
+ );
48
+ }
49
+
50
+ export { ScrollArea, ScrollBar };
@@ -0,0 +1,26 @@
1
+ import * as React from "react";
2
+ import { Separator as SeparatorPrimitive } from "radix-ui";
3
+
4
+ import { cn } from "../../lib/utils";
5
+
6
+ function Separator({
7
+ className,
8
+ orientation = "horizontal",
9
+ decorative = true,
10
+ ...props
11
+ }: React.ComponentProps<typeof SeparatorPrimitive.Root>) {
12
+ return (
13
+ <SeparatorPrimitive.Root
14
+ data-slot="separator"
15
+ decorative={decorative}
16
+ orientation={orientation}
17
+ className={cn(
18
+ "shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:h-full data-[orientation=vertical]:w-px",
19
+ className,
20
+ )}
21
+ {...props}
22
+ />
23
+ );
24
+ }
25
+
26
+ export { Separator };
@@ -0,0 +1,64 @@
1
+ import * as React from "react";
2
+ import { Tabs as TabsPrimitive } from "radix-ui";
3
+
4
+ import { cn } from "../../lib/utils";
5
+
6
+ function Tabs({
7
+ className,
8
+ ...props
9
+ }: React.ComponentProps<typeof TabsPrimitive.Root>) {
10
+ return (
11
+ <TabsPrimitive.Root
12
+ data-slot="tabs"
13
+ className={cn("flex flex-col gap-2", className)}
14
+ {...props}
15
+ />
16
+ );
17
+ }
18
+
19
+ function TabsList({
20
+ className,
21
+ ...props
22
+ }: React.ComponentProps<typeof TabsPrimitive.List>) {
23
+ return (
24
+ <TabsPrimitive.List
25
+ data-slot="tabs-list"
26
+ className={cn(
27
+ "inline-flex h-9 w-fit items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",
28
+ className,
29
+ )}
30
+ {...props}
31
+ />
32
+ );
33
+ }
34
+
35
+ function TabsTrigger({
36
+ className,
37
+ ...props
38
+ }: React.ComponentProps<typeof TabsPrimitive.Trigger>) {
39
+ return (
40
+ <TabsPrimitive.Trigger
41
+ data-slot="tabs-trigger"
42
+ className={cn(
43
+ "inline-flex items-center justify-center gap-1.5 rounded-md px-2.5 py-1 text-sm font-medium whitespace-nowrap transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg]:size-4",
44
+ className,
45
+ )}
46
+ {...props}
47
+ />
48
+ );
49
+ }
50
+
51
+ function TabsContent({
52
+ className,
53
+ ...props
54
+ }: React.ComponentProps<typeof TabsPrimitive.Content>) {
55
+ return (
56
+ <TabsPrimitive.Content
57
+ data-slot="tabs-content"
58
+ className={cn("flex-1 outline-none", className)}
59
+ {...props}
60
+ />
61
+ );
62
+ }
63
+
64
+ export { Tabs, TabsList, TabsTrigger, TabsContent };
@@ -0,0 +1,58 @@
1
+ import * as React from "react";
2
+ import { Tooltip as TooltipPrimitive } from "radix-ui";
3
+
4
+ import { cn } from "../../lib/utils";
5
+
6
+ function TooltipProvider({
7
+ delayDuration = 0,
8
+ ...props
9
+ }: React.ComponentProps<typeof TooltipPrimitive.Provider>) {
10
+ return (
11
+ <TooltipPrimitive.Provider
12
+ data-slot="tooltip-provider"
13
+ delayDuration={delayDuration}
14
+ {...props}
15
+ />
16
+ );
17
+ }
18
+
19
+ function Tooltip({
20
+ ...props
21
+ }: React.ComponentProps<typeof TooltipPrimitive.Root>) {
22
+ return (
23
+ <TooltipProvider>
24
+ <TooltipPrimitive.Root data-slot="tooltip" {...props} />
25
+ </TooltipProvider>
26
+ );
27
+ }
28
+
29
+ function TooltipTrigger({
30
+ ...props
31
+ }: React.ComponentProps<typeof TooltipPrimitive.Trigger>) {
32
+ return <TooltipPrimitive.Trigger data-slot="tooltip-trigger" {...props} />;
33
+ }
34
+
35
+ function TooltipContent({
36
+ className,
37
+ sideOffset = 4,
38
+ children,
39
+ ...props
40
+ }: React.ComponentProps<typeof TooltipPrimitive.Content>) {
41
+ return (
42
+ <TooltipPrimitive.Portal>
43
+ <TooltipPrimitive.Content
44
+ data-slot="tooltip-content"
45
+ sideOffset={sideOffset}
46
+ className={cn(
47
+ "z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
48
+ className,
49
+ )}
50
+ {...props}
51
+ >
52
+ {children}
53
+ </TooltipPrimitive.Content>
54
+ </TooltipPrimitive.Portal>
55
+ );
56
+ }
57
+
58
+ export { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };
package/src/index.ts CHANGED
@@ -22,5 +22,23 @@ export { groupMessagesByDate, formatDateGroup, formatMessageTime } from "./utils
22
22
  export * from "./hooks";
23
23
 
24
24
  // Components
25
- export { ChatView, ChatInput, MessageBubble } from "./components";
26
- export type { ChatViewProps, ChatInputProps, MessageBubbleProps } from "./components";
25
+ export {
26
+ ChatView,
27
+ ChatInput,
28
+ MessageBubble,
29
+ ContactAvatar,
30
+ InboxItem,
31
+ InboxSidebar,
32
+ ContactInfoPanel,
33
+ NewConversationDialog,
34
+ } from "./components";
35
+ export type {
36
+ ChatViewProps,
37
+ ChatInputProps,
38
+ MessageBubbleProps,
39
+ ContactAvatarProps,
40
+ InboxItemProps,
41
+ InboxSidebarProps,
42
+ ContactInfoPanelProps,
43
+ NewConversationDialogProps,
44
+ } from "./components";