@convokitapp/react-ui 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ConvoKit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/PARITY.md ADDED
@@ -0,0 +1,32 @@
1
+ # React UI parity
2
+
3
+ This package mirrors the current `convokit_flutter_ui` baseline while using
4
+ React-native composition patterns.
5
+
6
+ | Capability | Flutter UI | React UI |
7
+ | --- | --- | --- |
8
+ | SDK-backed conversation list | `ConvoKitConversationList` | `ConversationList` |
9
+ | Controlled conversation list | `ConvoKitConversationListView` | `ConversationListView` |
10
+ | SDK-backed conversation | `ConvoKitConversation` | `Conversation` |
11
+ | Controlled conversation | `ConvoKitConversationView` | `ConversationView` |
12
+ | Controlled message list | `ConvoKitMessageListView` | `MessageListView` |
13
+ | Replaceable SDK boundary | `ConvoKitUiClient` | `ConvoKitUiClient` |
14
+ | Conversation controller | `ConvoKitConversationController` | `useConversation` |
15
+ | Conversation-list controller | `ConvoKitConversationListController` | `useConversationList` |
16
+ | Offset pagination and de-duplication | Yes | Yes |
17
+ | Search, archived, participant, predicate, sort filters | Yes | Yes |
18
+ | Realtime messages, typing, reads | Yes | Yes |
19
+ | Read markers and reader resolution | Yes | Yes |
20
+ | Mark read on load/receive | Yes | Yes |
21
+ | Typing idle timeout | Yes | Yes |
22
+ | Image, file, location, contact rendering | Yes | Yes |
23
+ | Row/header/message/media/receipt/composer replacements | Builders | Render props |
24
+ | Empty/loading/error replacements | Builders | Render props |
25
+ | Theme tokens | Theme extension | CSS variables/provider |
26
+ | Compact presentation | Custom builders | `density="compact"` plus render props |
27
+ | Host-owned attachment opening | Callback | Callback |
28
+ | Accessibility primitives | Material semantics | Native semantics + Radix Avatar |
29
+
30
+ React additionally exposes controlled/uncontrolled composer text, per-part
31
+ `classNames` and `styles`, an `unstyled` mode, native element props, image
32
+ loading policy, time formatting, and scroll behavior controls.
package/README.md ADDED
@@ -0,0 +1,110 @@
1
+ # ConvoKit React UI
2
+
3
+ Accessible, plug-and-play React chat components for
4
+ [`@convokitapp/sdk`](https://www.npmjs.com/package/@convokitapp/sdk). Defaults
5
+ follow shadcn-style composition and CSS variables, use Radix Avatar for an
6
+ accessible primitive, and remain framework-CSS independent.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @convokitapp/sdk @convokitapp/react-ui
12
+ ```
13
+
14
+ Import the packaged styles once:
15
+
16
+ ```tsx
17
+ import '@convokitapp/react-ui/styles.css'
18
+ ```
19
+
20
+ ## SDK-backed UI
21
+
22
+ Connect the core SDK, adapt it once, and render the list and selected room. The
23
+ client secret belongs only in your token backend.
24
+
25
+ ```tsx
26
+ import { ConvoKitClient } from '@convokitapp/sdk'
27
+ import {
28
+ Conversation,
29
+ ConversationList,
30
+ createConvoKitUiClient,
31
+ } from '@convokitapp/react-ui'
32
+
33
+ const sdk = new ConvoKitClient({
34
+ backendUrl: 'https://api.example.com',
35
+ clientId: 'public-client-id',
36
+ tokenProvider: async (appUserId) =>
37
+ fetch('/api/chat/token', {
38
+ method: 'POST',
39
+ headers: { 'Content-Type': 'application/json' },
40
+ body: JSON.stringify({ appUserId }),
41
+ }).then(async (response) => (await response.json()).token),
42
+ })
43
+
44
+ await sdk.connectUser(currentUser.id)
45
+ const uiClient = createConvoKitUiClient(sdk)
46
+
47
+ <ConversationList
48
+ client={uiClient}
49
+ onConversationSelect={(room) => setRoomId(room.id)}
50
+ />
51
+
52
+ <Conversation
53
+ client={uiClient}
54
+ conversationId={roomId}
55
+ onAttachmentClick={(media) => openAttachment(media)}
56
+ />
57
+ ```
58
+
59
+ ## Controlled components
60
+
61
+ Use `ConversationListView`, `ConversationView`, and `MessageListView` when your
62
+ application owns state. `useConversationList` and `useConversation` expose the
63
+ same controller capabilities as the Flutter UI package without forcing a
64
+ state-management library.
65
+
66
+ ## Customization
67
+
68
+ Every meaningful section can be replaced through render props, including the
69
+ conversation row, separator, header, message, media block, read receipt, typing
70
+ indicator, composer, and loading/empty/error states.
71
+
72
+ ```tsx
73
+ <ConversationView
74
+ {...state}
75
+ onSendMessage={send}
76
+ density="compact"
77
+ classNames={{ root: 'h-full', outgoingMessage: 'my-message' }}
78
+ styles={{ composer: { padding: 16 } }}
79
+ renderReadReceipt={({ readerIds }) => (
80
+ <span>{readerIds.size ? `Seen by ${readerIds.size}` : 'Sent'}</span>
81
+ )}
82
+ renderMedia={({ media }) =>
83
+ media.type === 'location' ? <MyMap location={media} /> : undefined
84
+ }
85
+ />
86
+ ```
87
+
88
+ Set `unstyled` to remove package component classes while retaining behavior and
89
+ semantic markup. Use `ConvoKitThemeProvider` or override the documented
90
+ `--ckui-*` variables to theme defaults without rebuilding CSS.
91
+
92
+ ## Public examples
93
+
94
+ The public
95
+ [`ConvoKit-React-UI-Examples`](https://github.com/ConvoKitApp/ConvoKit-React-UI-Examples)
96
+ repository contains runnable standard, branded-support, and compact-operations
97
+ configurations plus a live SDK-backed example. The package implementation
98
+ remains in its private source repository.
99
+
100
+ ## Verification
101
+
102
+ ```bash
103
+ npm ci
104
+ npm run validate
105
+ ```
106
+
107
+ The release gate type-checks source and tests, runs component/controller tests
108
+ with coverage thresholds, builds ESM/CommonJS/TypeScript declarations and CSS,
109
+ checks Flutter UI parity, validates package exports, and inspects the npm
110
+ tarball.