@katechat/ui 1.0.0 → 1.0.2
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 +234 -0
- package/package.json +14 -1
package/README.md
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
# @katechat/ui
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@katechat/ui)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
KateChat - AI Chat Interface UI Components Library
|
|
7
|
+
|
|
8
|
+
A comprehensive collection of React components, hooks, and utilities for building AI chat interfaces. This package is extracted from the [KateChat](https://github.com/artiz/kate-chat) project to provide reusable UI modules for AI-powered chat applications.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @katechat/ui
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
or
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
yarn add @katechat/ui
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
or
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pnpm add @katechat/ui
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Peer Dependencies
|
|
29
|
+
|
|
30
|
+
This package requires the following peer dependencies:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"@mantine/carousel": "8.3.3",
|
|
35
|
+
"@mantine/core": "8.3.3",
|
|
36
|
+
"@mantine/dates": "8.3.3",
|
|
37
|
+
"@mantine/form": "8.3.3",
|
|
38
|
+
"@mantine/hooks": "8.3.3",
|
|
39
|
+
"@mantine/modals": "8.3.3",
|
|
40
|
+
"@mantine/notifications": "8.3.3",
|
|
41
|
+
"@tabler/icons-react": "^3.1.0",
|
|
42
|
+
"react": "19.1.0",
|
|
43
|
+
"react-dom": "19.1.0",
|
|
44
|
+
"react-redux": "^9.2.0",
|
|
45
|
+
"react-router-dom": "^6.23.1"
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Features
|
|
50
|
+
|
|
51
|
+
- 🎨 **Built with Mantine UI** - Modern, accessible components
|
|
52
|
+
- 💬 **Chat Components** - Ready-to-use chat message containers and lists
|
|
53
|
+
- 🔌 **Modular Architecture** - Import only what you need
|
|
54
|
+
- 🎯 **TypeScript** - Full type safety
|
|
55
|
+
- 🪝 **Custom Hooks** - Reusable React hooks
|
|
56
|
+
- 🎨 **Theme Support** - Customizable theming system
|
|
57
|
+
- 📝 **Markdown Support** - Rich text rendering with code highlighting
|
|
58
|
+
|
|
59
|
+
## Package Structure
|
|
60
|
+
|
|
61
|
+
### Components
|
|
62
|
+
|
|
63
|
+
#### Chat Components (`./components/chat`)
|
|
64
|
+
- **ChatMessagesContainer** - Container component for chat messages with scrolling behavior
|
|
65
|
+
- **ChatMessagesList** - List component for rendering chat messages
|
|
66
|
+
- **Chat Input** - Input components for user messages
|
|
67
|
+
- **Chat Message** - Individual message display components
|
|
68
|
+
|
|
69
|
+
#### Modal Components (`./components/modal`)
|
|
70
|
+
- **ImagePopup** - Modal for displaying images in fullscreen
|
|
71
|
+
|
|
72
|
+
#### Icon Components (`./components/icons`)
|
|
73
|
+
- **ProviderIcon** - Icons for different AI providers (OpenAI, Anthropic, etc.)
|
|
74
|
+
|
|
75
|
+
### Controls
|
|
76
|
+
|
|
77
|
+
#### File Controls (`./controls`)
|
|
78
|
+
- **FileDropzone** - Drag-and-drop file upload component
|
|
79
|
+
|
|
80
|
+
### Core Types & Utilities (`./core`)
|
|
81
|
+
|
|
82
|
+
Type definitions and utilities for:
|
|
83
|
+
- **Message Types** - Chat message structures and interfaces
|
|
84
|
+
- **Model Types** - AI model configurations and metadata
|
|
85
|
+
- **User Types** - User profile and authentication types
|
|
86
|
+
- **AI Types** - AI provider and configuration types
|
|
87
|
+
|
|
88
|
+
### Hooks (`./hooks`)
|
|
89
|
+
|
|
90
|
+
Custom React hooks:
|
|
91
|
+
- **useIntersectionObserver** - Detect element visibility for lazy loading and infinite scroll
|
|
92
|
+
- **useTheme** - Access and manage application theme
|
|
93
|
+
|
|
94
|
+
### Libraries (`./lib`)
|
|
95
|
+
|
|
96
|
+
- **Markdown Parser** - Parse and render markdown with syntax highlighting
|
|
97
|
+
- Supports code blocks with language detection
|
|
98
|
+
- KaTeX math rendering
|
|
99
|
+
- Syntax highlighting with highlight.js
|
|
100
|
+
|
|
101
|
+
## Usage
|
|
102
|
+
|
|
103
|
+
### Basic Import
|
|
104
|
+
|
|
105
|
+
```typescript
|
|
106
|
+
import {
|
|
107
|
+
ChatMessagesContainer,
|
|
108
|
+
ChatMessagesList,
|
|
109
|
+
FileDropzone,
|
|
110
|
+
useTheme,
|
|
111
|
+
useIntersectionObserver
|
|
112
|
+
} from '@katechat/ui';
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Using Chat Components
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
import { ChatMessagesContainer, ChatMessagesList } from '@katechat/ui';
|
|
119
|
+
|
|
120
|
+
function ChatView({ messages }) {
|
|
121
|
+
return (
|
|
122
|
+
<ChatMessagesContainer>
|
|
123
|
+
<ChatMessagesList messages={messages} />
|
|
124
|
+
</ChatMessagesContainer>
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### Using File Upload
|
|
130
|
+
|
|
131
|
+
```tsx
|
|
132
|
+
import { FileDropzone } from '@katechat/ui';
|
|
133
|
+
|
|
134
|
+
function UploadArea() {
|
|
135
|
+
const handleFileDrop = (files: File[]) => {
|
|
136
|
+
console.log('Files uploaded:', files);
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
return <FileDropzone onDrop={handleFileDrop} />;
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Using Custom Hooks
|
|
144
|
+
|
|
145
|
+
```tsx
|
|
146
|
+
import { useTheme, useIntersectionObserver } from '@katechat/ui';
|
|
147
|
+
|
|
148
|
+
function MyComponent() {
|
|
149
|
+
const { theme, setTheme } = useTheme();
|
|
150
|
+
|
|
151
|
+
const { ref, isIntersecting } = useIntersectionObserver({
|
|
152
|
+
threshold: 0.5
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
return (
|
|
156
|
+
<div ref={ref}>
|
|
157
|
+
{isIntersecting && <div>Element is visible!</div>}
|
|
158
|
+
</div>
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Using Markdown Parser
|
|
164
|
+
|
|
165
|
+
```tsx
|
|
166
|
+
import { parseMarkdown } from '@katechat/ui';
|
|
167
|
+
|
|
168
|
+
function MessageRenderer({ content }) {
|
|
169
|
+
const html = parseMarkdown(content);
|
|
170
|
+
|
|
171
|
+
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
This package is part of the [KateChat](https://github.com/artiz/kate-chat) monorepo.
|
|
178
|
+
|
|
179
|
+
### Building
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npm run build
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Type Checking
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
npm run typecheck
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Testing
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
npm test
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Formatting
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
npm run format
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Dependencies
|
|
204
|
+
|
|
205
|
+
The package includes the following built-in dependencies:
|
|
206
|
+
|
|
207
|
+
- **highlight.js** - Syntax highlighting for code blocks
|
|
208
|
+
- **i18next** - Internationalization framework
|
|
209
|
+
- **lodash** - Utility functions
|
|
210
|
+
- **marked** - Markdown parser
|
|
211
|
+
- **marked-highlight** - Syntax highlighting for marked
|
|
212
|
+
- **marked-katex-extension** - KaTeX math rendering for marked
|
|
213
|
+
|
|
214
|
+
## Contributing
|
|
215
|
+
|
|
216
|
+
Contributions are welcome! Please visit the main repository at [https://github.com/artiz/kate-chat](https://github.com/artiz/kate-chat) to contribute.
|
|
217
|
+
|
|
218
|
+
## License
|
|
219
|
+
|
|
220
|
+
MIT
|
|
221
|
+
|
|
222
|
+
## Links
|
|
223
|
+
|
|
224
|
+
- **GitHub Repository**: [https://github.com/artiz/kate-chat](https://github.com/artiz/kate-chat)
|
|
225
|
+
- **Issues**: [https://github.com/artiz/kate-chat/issues](https://github.com/artiz/kate-chat/issues)
|
|
226
|
+
- **NPM Package**: [https://www.npmjs.com/package/@katechat/ui](https://www.npmjs.com/package/@katechat/ui)
|
|
227
|
+
|
|
228
|
+
## Support
|
|
229
|
+
|
|
230
|
+
For questions, issues, or feature requests, please open an issue on the [GitHub repository](https://github.com/artiz/kate-chat/issues).
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
Made with ❤️ by the KateChat team
|
package/package.json
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@katechat/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "KateChat - AI Chat Interface modules collection",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/artiz/kate-chat",
|
|
8
|
+
"directory": "packages/katechat-ui"
|
|
9
|
+
},
|
|
10
|
+
"keywords": [
|
|
11
|
+
"chatbot"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/artiz/kate-chat/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://katechat.tech",
|
|
5
18
|
"main": "src/index.ts",
|
|
6
19
|
"publishConfig": {
|
|
7
20
|
"access": "public"
|