@rohan_p31/ai-chat-sdk 1.0.0
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/README.md +75 -0
- package/lib/components/AIChat.d.ts +4 -0
- package/lib/components/AIChat.d.ts.map +1 -0
- package/lib/components/AIChat.js +117 -0
- package/lib/components/AIChat.js.map +1 -0
- package/lib/components/ChatInput.d.ts +11 -0
- package/lib/components/ChatInput.d.ts.map +1 -0
- package/lib/components/ChatInput.js +109 -0
- package/lib/components/ChatInput.js.map +1 -0
- package/lib/components/MessageBubble.d.ts +13 -0
- package/lib/components/MessageBubble.d.ts.map +1 -0
- package/lib/components/MessageBubble.js +107 -0
- package/lib/components/MessageBubble.js.map +1 -0
- package/lib/hooks/useChat.d.ts +11 -0
- package/lib/hooks/useChat.d.ts.map +1 -0
- package/lib/hooks/useChat.js +66 -0
- package/lib/hooks/useChat.js.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +19 -0
- package/lib/index.js.map +1 -0
- package/lib/services/MockChatService.d.ts +7 -0
- package/lib/services/MockChatService.d.ts.map +1 -0
- package/lib/services/MockChatService.js +23 -0
- package/lib/services/MockChatService.js.map +1 -0
- package/lib/theme/colors.d.ts +20 -0
- package/lib/theme/colors.d.ts.map +1 -0
- package/lib/theme/colors.js +42 -0
- package/lib/theme/colors.js.map +1 -0
- package/lib/types/Message.d.ts +20 -0
- package/lib/types/Message.d.ts.map +1 -0
- package/lib/types/Message.js +3 -0
- package/lib/types/Message.js.map +1 -0
- package/package.json +37 -0
- package/src/components/AIChat.tsx +139 -0
- package/src/components/ChatInput.tsx +116 -0
- package/src/components/MessageBubble.tsx +151 -0
- package/src/hooks/useChat.ts +77 -0
- package/src/index.ts +8 -0
- package/src/services/MockChatService.ts +31 -0
- package/src/theme/colors.ts +63 -0
- package/src/types/Message.ts +17 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ChatTheme } from '../types/Message';
|
|
2
|
+
|
|
3
|
+
export interface ThemeColors {
|
|
4
|
+
background: string;
|
|
5
|
+
surface: string;
|
|
6
|
+
headerBackground: string;
|
|
7
|
+
headerText: string;
|
|
8
|
+
userBubble: string;
|
|
9
|
+
userText: string;
|
|
10
|
+
assistantBubble: string;
|
|
11
|
+
assistantText: string;
|
|
12
|
+
inputBackground: string;
|
|
13
|
+
inputText: string;
|
|
14
|
+
inputBorder: string;
|
|
15
|
+
placeholder: string;
|
|
16
|
+
typingText: string;
|
|
17
|
+
primary: string;
|
|
18
|
+
separator: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const lightBase: Omit<ThemeColors, 'primary' | 'userBubble'> = {
|
|
22
|
+
background: '#F5F5F5',
|
|
23
|
+
surface: '#FFFFFF',
|
|
24
|
+
headerBackground: '#FFFFFF',
|
|
25
|
+
headerText: '#1A1A1A',
|
|
26
|
+
userText: '#FFFFFF',
|
|
27
|
+
assistantBubble: '#E8E8E8',
|
|
28
|
+
assistantText: '#1A1A1A',
|
|
29
|
+
inputBackground: '#FFFFFF',
|
|
30
|
+
inputText: '#1A1A1A',
|
|
31
|
+
inputBorder: '#D0D0D0',
|
|
32
|
+
placeholder: '#8A8A8A',
|
|
33
|
+
typingText: '#6B6B6B',
|
|
34
|
+
separator: '#E0E0E0',
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const darkBase: Omit<ThemeColors, 'primary' | 'userBubble'> = {
|
|
38
|
+
background: '#121212',
|
|
39
|
+
surface: '#1E1E1E',
|
|
40
|
+
headerBackground: '#1E1E1E',
|
|
41
|
+
headerText: '#F5F5F5',
|
|
42
|
+
userText: '#FFFFFF',
|
|
43
|
+
assistantBubble: '#2C2C2C',
|
|
44
|
+
assistantText: '#F0F0F0',
|
|
45
|
+
inputBackground: '#2A2A2A',
|
|
46
|
+
inputText: '#F5F5F5',
|
|
47
|
+
inputBorder: '#3A3A3A',
|
|
48
|
+
placeholder: '#9A9A9A',
|
|
49
|
+
typingText: '#A0A0A0',
|
|
50
|
+
separator: '#2A2A2A',
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export function getThemeColors(
|
|
54
|
+
theme: ChatTheme = 'light',
|
|
55
|
+
primaryColor = '#6200EE',
|
|
56
|
+
): ThemeColors {
|
|
57
|
+
const base = theme === 'dark' ? darkBase : lightBase;
|
|
58
|
+
return {
|
|
59
|
+
...base,
|
|
60
|
+
primary: primaryColor,
|
|
61
|
+
userBubble: primaryColor,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface Message {
|
|
2
|
+
id: string;
|
|
3
|
+
text: string;
|
|
4
|
+
isUser: boolean;
|
|
5
|
+
timestamp: number;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type ChatTheme = 'light' | 'dark';
|
|
9
|
+
|
|
10
|
+
export interface AIChatProps {
|
|
11
|
+
assistantName?: string;
|
|
12
|
+
welcomeMessage?: string;
|
|
13
|
+
theme?: ChatTheme;
|
|
14
|
+
primaryColor?: string;
|
|
15
|
+
assistantAvatar?: number | { uri: string };
|
|
16
|
+
userAvatar?: number | { uri: string };
|
|
17
|
+
}
|