@katechat/ui 1.0.5 → 1.0.7
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 +16 -20
- package/dist/cjs/index.css +130 -114
- package/dist/cjs/index.css.map +3 -3
- package/dist/cjs/index.js +48 -64
- package/dist/cjs/index.js.map +3 -3
- package/dist/esm/index.css +130 -114
- package/dist/esm/index.css.map +3 -3
- package/dist/esm/index.js +50 -66
- package/dist/esm/index.js.map +4 -4
- package/dist/types/components/chat/ChatMessagesContainer.d.ts +1 -0
- package/dist/types/components/chat/ChatMessagesContainer.d.ts.map +1 -1
- package/dist/types/components/chat/ChatMessagesList.d.ts.map +1 -1
- package/dist/types/components/chat/input/ChatInput.d.ts +2 -2
- package/dist/types/components/chat/message/ChatMessage.d.ts +1 -0
- package/dist/types/components/chat/message/ChatMessage.d.ts.map +1 -1
- package/dist/types/components/chat/message/ChatMessagePreview.d.ts +1 -0
- package/dist/types/components/chat/message/ChatMessagePreview.d.ts.map +1 -1
- package/dist/types/components/chat/message/LinkedChatMessage.d.ts +1 -0
- package/dist/types/components/chat/message/LinkedChatMessage.d.ts.map +1 -1
- package/dist/types/lib/markdown.parser.d.ts +1 -1
- package/dist/types/lib/markdown.parser.d.ts.map +1 -1
- package/dist/types/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/dist/index.css +0 -1
- package/dist/index.js +0 -539
package/README.md
CHANGED
|
@@ -72,25 +72,30 @@ The package automatically uses the correct build format based on your bundler an
|
|
|
72
72
|
### Components
|
|
73
73
|
|
|
74
74
|
#### Chat Components (`./components/chat`)
|
|
75
|
+
|
|
75
76
|
- **ChatMessagesContainer** - Container component for chat messages with scrolling behavior
|
|
76
77
|
- **ChatMessagesList** - List component for rendering chat messages
|
|
77
78
|
- **Chat Input** - Input components for user messages
|
|
78
79
|
- **Chat Message** - Individual message display components
|
|
79
80
|
|
|
80
81
|
#### Modal Components (`./components/modal`)
|
|
82
|
+
|
|
81
83
|
- **ImagePopup** - Modal for displaying images in fullscreen
|
|
82
84
|
|
|
83
85
|
#### Icon Components (`./components/icons`)
|
|
86
|
+
|
|
84
87
|
- **ProviderIcon** - Icons for different AI providers (OpenAI, Anthropic, etc.)
|
|
85
88
|
|
|
86
89
|
### Controls
|
|
87
90
|
|
|
88
91
|
#### File Controls (`./controls`)
|
|
92
|
+
|
|
89
93
|
- **FileDropzone** - Drag-and-drop file upload component
|
|
90
94
|
|
|
91
95
|
### Core Types & Utilities (`./core`)
|
|
92
96
|
|
|
93
97
|
Type definitions and utilities for:
|
|
98
|
+
|
|
94
99
|
- **Message Types** - Chat message structures and interfaces
|
|
95
100
|
- **Model Types** - AI model configurations and metadata
|
|
96
101
|
- **User Types** - User profile and authentication types
|
|
@@ -99,6 +104,7 @@ Type definitions and utilities for:
|
|
|
99
104
|
### Hooks (`./hooks`)
|
|
100
105
|
|
|
101
106
|
Custom React hooks:
|
|
107
|
+
|
|
102
108
|
- **useIntersectionObserver** - Detect element visibility for lazy loading and infinite scroll
|
|
103
109
|
- **useTheme** - Access and manage application theme
|
|
104
110
|
|
|
@@ -130,19 +136,13 @@ import "@katechat/ui/styles.css";
|
|
|
130
136
|
### Basic Import
|
|
131
137
|
|
|
132
138
|
```typescript
|
|
133
|
-
import {
|
|
134
|
-
ChatMessagesContainer,
|
|
135
|
-
ChatMessagesList,
|
|
136
|
-
FileDropzone,
|
|
137
|
-
useTheme,
|
|
138
|
-
useIntersectionObserver
|
|
139
|
-
} from '@katechat/ui';
|
|
139
|
+
import { ChatMessagesContainer, ChatMessagesList, FileDropzone, useTheme, useIntersectionObserver } from "@katechat/ui";
|
|
140
140
|
```
|
|
141
141
|
|
|
142
142
|
### Using Chat Components
|
|
143
143
|
|
|
144
144
|
```tsx
|
|
145
|
-
import { ChatMessagesContainer, ChatMessagesList } from
|
|
145
|
+
import { ChatMessagesContainer, ChatMessagesList } from "@katechat/ui";
|
|
146
146
|
|
|
147
147
|
function ChatView({ messages }) {
|
|
148
148
|
return (
|
|
@@ -156,11 +156,11 @@ function ChatView({ messages }) {
|
|
|
156
156
|
### Using File Upload
|
|
157
157
|
|
|
158
158
|
```tsx
|
|
159
|
-
import { FileDropzone } from
|
|
159
|
+
import { FileDropzone } from "@katechat/ui";
|
|
160
160
|
|
|
161
161
|
function UploadArea() {
|
|
162
162
|
const handleFileDrop = (files: File[]) => {
|
|
163
|
-
console.log(
|
|
163
|
+
console.log("Files uploaded:", files);
|
|
164
164
|
};
|
|
165
165
|
|
|
166
166
|
return <FileDropzone onDrop={handleFileDrop} />;
|
|
@@ -170,31 +170,27 @@ function UploadArea() {
|
|
|
170
170
|
### Using Custom Hooks
|
|
171
171
|
|
|
172
172
|
```tsx
|
|
173
|
-
import { useTheme, useIntersectionObserver } from
|
|
173
|
+
import { useTheme, useIntersectionObserver } from "@katechat/ui";
|
|
174
174
|
|
|
175
175
|
function MyComponent() {
|
|
176
176
|
const { theme, setTheme } = useTheme();
|
|
177
|
-
|
|
177
|
+
|
|
178
178
|
const { ref, isIntersecting } = useIntersectionObserver({
|
|
179
|
-
threshold: 0.5
|
|
179
|
+
threshold: 0.5,
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
return
|
|
183
|
-
<div ref={ref}>
|
|
184
|
-
{isIntersecting && <div>Element is visible!</div>}
|
|
185
|
-
</div>
|
|
186
|
-
);
|
|
182
|
+
return <div ref={ref}>{isIntersecting && <div>Element is visible!</div>}</div>;
|
|
187
183
|
}
|
|
188
184
|
```
|
|
189
185
|
|
|
190
186
|
### Using Markdown Parser
|
|
191
187
|
|
|
192
188
|
```tsx
|
|
193
|
-
import { parseMarkdown } from
|
|
189
|
+
import { parseMarkdown } from "@katechat/ui";
|
|
194
190
|
|
|
195
191
|
function MessageRenderer({ content }) {
|
|
196
192
|
const html = parseMarkdown(content);
|
|
197
|
-
|
|
193
|
+
|
|
198
194
|
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
|
199
195
|
}
|
|
200
196
|
```
|