@katechat/ui 1.0.4 → 1.0.6
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 +32 -20
- package/dist/cjs/index.css +114 -111
- package/dist/cjs/index.css.map +2 -2
- package/dist/cjs/index.js +52 -48
- package/dist/cjs/index.js.map +2 -2
- package/dist/esm/index.css +114 -111
- package/dist/esm/index.css.map +2 -2
- package/dist/esm/index.js +53 -49
- package/dist/esm/index.js.map +3 -3
- package/dist/types/__mocks__/fileMock.d.ts +3 -0
- package/dist/types/__mocks__/fileMock.d.ts.map +1 -0
- package/dist/types/__mocks__/styleMock.d.ts +2 -0
- package/dist/types/__mocks__/styleMock.d.ts.map +1 -0
- package/dist/types/components/chat/ChatMessagesContainer.d.ts +23 -0
- package/dist/types/components/chat/ChatMessagesContainer.d.ts.map +1 -0
- package/dist/types/components/chat/ChatMessagesList.d.ts +16 -0
- package/dist/types/components/chat/ChatMessagesList.d.ts.map +1 -0
- package/dist/types/components/chat/index.d.ts +5 -0
- package/dist/types/components/chat/index.d.ts.map +1 -0
- package/dist/types/components/chat/input/ChatInput.d.ts +22 -0
- package/dist/types/components/chat/input/ChatInput.d.ts.map +1 -0
- package/dist/types/components/chat/input/index.d.ts +2 -0
- package/dist/types/components/chat/input/index.d.ts.map +1 -0
- package/dist/types/components/chat/message/ChatMessage.d.ts +16 -0
- package/dist/types/components/chat/message/ChatMessage.d.ts.map +1 -0
- package/dist/types/components/chat/message/ChatMessagePreview.d.ts +6 -0
- package/dist/types/components/chat/message/ChatMessagePreview.d.ts.map +1 -0
- package/dist/types/components/chat/message/LinkedChatMessage.d.ts +15 -0
- package/dist/types/components/chat/message/LinkedChatMessage.d.ts.map +1 -0
- package/dist/types/components/chat/message/MessageStatus.d.ts +6 -0
- package/dist/types/components/chat/message/MessageStatus.d.ts.map +1 -0
- package/dist/types/components/chat/message/controls/CopyMessageButton.d.ts +7 -0
- package/dist/types/components/chat/message/controls/CopyMessageButton.d.ts.map +1 -0
- package/dist/types/components/chat/message/index.d.ts +5 -0
- package/dist/types/components/chat/message/index.d.ts.map +1 -0
- package/dist/types/components/icons/ProviderIcon.d.ts +8 -0
- package/dist/types/components/icons/ProviderIcon.d.ts.map +1 -0
- package/dist/types/components/icons/index.d.ts +2 -0
- package/dist/types/components/icons/index.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +4 -0
- package/dist/types/components/index.d.ts.map +1 -0
- package/dist/types/components/modal/ImagePopup.d.ts +13 -0
- package/dist/types/components/modal/ImagePopup.d.ts.map +1 -0
- package/dist/types/components/modal/index.d.ts +2 -0
- package/dist/types/components/modal/index.d.ts.map +1 -0
- package/dist/types/controls/FileDropzone/FileDropzone.d.ts +10 -0
- package/dist/types/controls/FileDropzone/FileDropzone.d.ts.map +1 -0
- package/dist/types/controls/index.d.ts +2 -0
- package/dist/types/controls/index.d.ts.map +1 -0
- package/dist/types/core/ai.d.ts +2 -0
- package/dist/types/core/ai.d.ts.map +1 -0
- package/dist/types/core/index.d.ts +5 -0
- package/dist/types/core/index.d.ts.map +1 -0
- package/dist/types/core/message.d.ts +57 -0
- package/dist/types/core/message.d.ts.map +1 -0
- package/dist/types/core/model.d.ts +22 -0
- package/dist/types/core/model.d.ts.map +1 -0
- package/dist/types/core/user.d.ts +9 -0
- package/dist/types/core/user.d.ts.map +1 -0
- package/dist/types/hooks/index.d.ts +3 -0
- package/dist/types/hooks/index.d.ts.map +1 -0
- package/dist/types/hooks/useIntersectionObserver.d.ts +3 -0
- package/dist/types/hooks/useIntersectionObserver.d.ts.map +1 -0
- package/dist/types/hooks/useTheme.d.ts +14 -0
- package/dist/types/hooks/useTheme.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/lib/__tests__/markdown.parser.testUtils.d.ts +13 -0
- package/dist/types/lib/__tests__/markdown.parser.testUtils.d.ts.map +1 -0
- package/dist/types/lib/assert.d.ts +3 -0
- package/dist/types/lib/assert.d.ts.map +1 -0
- package/dist/types/lib/markdown.parser.d.ts +11 -0
- package/dist/types/lib/markdown.parser.d.ts.map +1 -0
- package/dist/types/setupTests.d.ts +2 -0
- package/dist/types/setupTests.d.ts.map +1 -0
- package/dist/types/{tsconfig.tsbuildinfo → tsconfig.build.tsbuildinfo} +1 -1
- package/package.json +5 -3
- 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
|
|
|
@@ -111,22 +117,32 @@ Custom React hooks:
|
|
|
111
117
|
|
|
112
118
|
## Usage
|
|
113
119
|
|
|
120
|
+
### Importing Styles
|
|
121
|
+
|
|
122
|
+
The package includes pre-bundled CSS with all Mantine styles. Import it in your main entry file:
|
|
123
|
+
|
|
124
|
+
```scss
|
|
125
|
+
// In your main SCSS file
|
|
126
|
+
@import "@katechat/ui/styles.css";
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Or in your JavaScript/TypeScript:
|
|
130
|
+
|
|
131
|
+
```typescript
|
|
132
|
+
// In your main entry file (e.g., index.tsx)
|
|
133
|
+
import "@katechat/ui/styles.css";
|
|
134
|
+
```
|
|
135
|
+
|
|
114
136
|
### Basic Import
|
|
115
137
|
|
|
116
138
|
```typescript
|
|
117
|
-
import {
|
|
118
|
-
ChatMessagesContainer,
|
|
119
|
-
ChatMessagesList,
|
|
120
|
-
FileDropzone,
|
|
121
|
-
useTheme,
|
|
122
|
-
useIntersectionObserver
|
|
123
|
-
} from '@katechat/ui';
|
|
139
|
+
import { ChatMessagesContainer, ChatMessagesList, FileDropzone, useTheme, useIntersectionObserver } from "@katechat/ui";
|
|
124
140
|
```
|
|
125
141
|
|
|
126
142
|
### Using Chat Components
|
|
127
143
|
|
|
128
144
|
```tsx
|
|
129
|
-
import { ChatMessagesContainer, ChatMessagesList } from
|
|
145
|
+
import { ChatMessagesContainer, ChatMessagesList } from "@katechat/ui";
|
|
130
146
|
|
|
131
147
|
function ChatView({ messages }) {
|
|
132
148
|
return (
|
|
@@ -140,11 +156,11 @@ function ChatView({ messages }) {
|
|
|
140
156
|
### Using File Upload
|
|
141
157
|
|
|
142
158
|
```tsx
|
|
143
|
-
import { FileDropzone } from
|
|
159
|
+
import { FileDropzone } from "@katechat/ui";
|
|
144
160
|
|
|
145
161
|
function UploadArea() {
|
|
146
162
|
const handleFileDrop = (files: File[]) => {
|
|
147
|
-
console.log(
|
|
163
|
+
console.log("Files uploaded:", files);
|
|
148
164
|
};
|
|
149
165
|
|
|
150
166
|
return <FileDropzone onDrop={handleFileDrop} />;
|
|
@@ -154,31 +170,27 @@ function UploadArea() {
|
|
|
154
170
|
### Using Custom Hooks
|
|
155
171
|
|
|
156
172
|
```tsx
|
|
157
|
-
import { useTheme, useIntersectionObserver } from
|
|
173
|
+
import { useTheme, useIntersectionObserver } from "@katechat/ui";
|
|
158
174
|
|
|
159
175
|
function MyComponent() {
|
|
160
176
|
const { theme, setTheme } = useTheme();
|
|
161
|
-
|
|
177
|
+
|
|
162
178
|
const { ref, isIntersecting } = useIntersectionObserver({
|
|
163
|
-
threshold: 0.5
|
|
179
|
+
threshold: 0.5,
|
|
164
180
|
});
|
|
165
181
|
|
|
166
|
-
return
|
|
167
|
-
<div ref={ref}>
|
|
168
|
-
{isIntersecting && <div>Element is visible!</div>}
|
|
169
|
-
</div>
|
|
170
|
-
);
|
|
182
|
+
return <div ref={ref}>{isIntersecting && <div>Element is visible!</div>}</div>;
|
|
171
183
|
}
|
|
172
184
|
```
|
|
173
185
|
|
|
174
186
|
### Using Markdown Parser
|
|
175
187
|
|
|
176
188
|
```tsx
|
|
177
|
-
import { parseMarkdown } from
|
|
189
|
+
import { parseMarkdown } from "@katechat/ui";
|
|
178
190
|
|
|
179
191
|
function MessageRenderer({ content }) {
|
|
180
192
|
const html = parseMarkdown(content);
|
|
181
|
-
|
|
193
|
+
|
|
182
194
|
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
|
183
195
|
}
|
|
184
196
|
```
|