convex-feedback-ui 0.1.2 → 0.1.3
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 +115 -18
- package/dist/.tsbuildinfo +1 -1
- package/dist/native/expo/ExpoFeedbackBody.d.ts +4 -0
- package/dist/native/expo/ExpoFeedbackBody.d.ts.map +1 -0
- package/dist/native/expo/ExpoFeedbackBody.js +26 -0
- package/dist/native/expo/ExpoFeedbackBody.js.map +1 -0
- package/dist/native/expo/FeedbackScreen.d.ts +3 -0
- package/dist/native/expo/FeedbackScreen.d.ts.map +1 -0
- package/dist/native/expo/FeedbackScreen.js +9 -0
- package/dist/native/expo/FeedbackScreen.js.map +1 -0
- package/dist/native/expo/FeedbackStack.d.ts +3 -0
- package/dist/native/expo/FeedbackStack.d.ts.map +1 -0
- package/dist/native/expo/FeedbackStack.js +41 -0
- package/dist/native/expo/FeedbackStack.js.map +1 -0
- package/dist/native/expo/index.d.ts +9 -0
- package/dist/native/expo/index.d.ts.map +1 -0
- package/dist/native/expo/index.js +7 -0
- package/dist/native/expo/index.js.map +1 -0
- package/dist/native/expo/types.d.ts +20 -0
- package/dist/native/expo/types.d.ts.map +1 -0
- package/dist/native/expo/types.js +2 -0
- package/dist/native/expo/types.js.map +1 -0
- package/dist/native/native/FeedbackScreen.d.ts +3 -0
- package/dist/native/native/FeedbackScreen.d.ts.map +1 -0
- package/dist/native/native/FeedbackScreen.js +9 -0
- package/dist/native/native/FeedbackScreen.js.map +1 -0
- package/dist/native/native/index.d.ts +8 -0
- package/dist/native/native/index.d.ts.map +1 -0
- package/dist/native/native/index.js +7 -0
- package/dist/native/native/index.js.map +1 -0
- package/dist/native/shared/helpers.d.ts +3 -0
- package/dist/native/shared/helpers.d.ts.map +1 -0
- package/dist/native/shared/helpers.js +4 -0
- package/dist/native/shared/helpers.js.map +1 -0
- package/dist/native/shared/ui/BodyContent.d.ts +3 -0
- package/dist/native/shared/ui/BodyContent.d.ts.map +1 -0
- package/dist/native/shared/ui/BodyContent.js +18 -0
- package/dist/native/shared/ui/BodyContent.js.map +1 -0
- package/dist/native/shared/ui/Button.d.ts +5 -0
- package/dist/native/shared/ui/Button.d.ts.map +1 -0
- package/dist/native/shared/ui/Button.js +15 -0
- package/dist/native/shared/ui/Button.js.map +1 -0
- package/dist/native/shared/ui/CommentBranch.d.ts +3 -0
- package/dist/native/shared/ui/CommentBranch.d.ts.map +1 -0
- package/dist/native/shared/ui/CommentBranch.js +35 -0
- package/dist/native/shared/ui/CommentBranch.js.map +1 -0
- package/dist/native/shared/ui/EntryCard.d.ts +3 -0
- package/dist/native/shared/ui/EntryCard.d.ts.map +1 -0
- package/dist/native/shared/ui/EntryCard.js +13 -0
- package/dist/native/shared/ui/EntryCard.js.map +1 -0
- package/dist/native/shared/ui/EntryDetail.d.ts +3 -0
- package/dist/native/shared/ui/EntryDetail.d.ts.map +1 -0
- package/dist/native/shared/ui/EntryDetail.js +37 -0
- package/dist/native/shared/ui/EntryDetail.js.map +1 -0
- package/dist/native/shared/ui/FeedbackScreenHeader.d.ts +2 -0
- package/dist/native/shared/ui/FeedbackScreenHeader.d.ts.map +1 -0
- package/dist/native/shared/ui/FeedbackScreenHeader.js +20 -0
- package/dist/native/shared/ui/FeedbackScreenHeader.js.map +1 -0
- package/dist/native/shared/ui/FeedbackScreenList.d.ts +3 -0
- package/dist/native/shared/ui/FeedbackScreenList.d.ts.map +1 -0
- package/dist/native/shared/ui/FeedbackScreenList.js +19 -0
- package/dist/native/shared/ui/FeedbackScreenList.js.map +1 -0
- package/dist/native/shared/ui/NewEntry.d.ts +5 -0
- package/dist/native/shared/ui/NewEntry.d.ts.map +1 -0
- package/dist/native/shared/ui/NewEntry.js +158 -0
- package/dist/native/shared/ui/NewEntry.js.map +1 -0
- package/dist/native/shared/ui/ReplyList.d.ts +3 -0
- package/dist/native/shared/ui/ReplyList.d.ts.map +1 -0
- package/dist/native/shared/ui/ReplyList.js +19 -0
- package/dist/native/shared/ui/ReplyList.js.map +1 -0
- package/dist/native/{primitives.d.ts → shared/ui/primitives.d.ts} +10 -12
- package/dist/native/shared/ui/primitives.d.ts.map +1 -0
- package/dist/native/{primitives.js → shared/ui/primitives.js} +19 -25
- package/dist/native/shared/ui/primitives.js.map +1 -0
- package/dist/react/{context.d.ts → css.d.ts} +2 -4
- package/dist/react/css.d.ts.map +1 -0
- package/dist/react/css.js +18 -0
- package/dist/react/css.js.map +1 -0
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.d.ts.map +1 -1
- package/dist/react/index.js +1 -1
- package/dist/react/index.js.map +1 -1
- package/dist/react/primitives.d.ts.map +1 -1
- package/dist/react/primitives.js +2 -1
- package/dist/react/primitives.js.map +1 -1
- package/dist/react/screen.d.ts +3 -3
- package/dist/react/screen.d.ts.map +1 -1
- package/dist/react/screen.js +25 -22
- package/dist/react/screen.js.map +1 -1
- package/dist/shared/context/FeedbackBodyProvider.d.ts +5 -0
- package/dist/shared/context/FeedbackBodyProvider.d.ts.map +1 -0
- package/dist/shared/context/FeedbackBodyProvider.js +43 -0
- package/dist/shared/context/FeedbackBodyProvider.js.map +1 -0
- package/dist/{native/context.d.ts → shared/context/FeedbackProvider.d.ts} +2 -2
- package/dist/shared/context/FeedbackProvider.d.ts.map +1 -0
- package/dist/{native/context.js → shared/context/FeedbackProvider.js} +3 -3
- package/dist/shared/context/FeedbackProvider.js.map +1 -0
- package/dist/shared/helpers.d.ts +7 -0
- package/dist/shared/helpers.d.ts.map +1 -0
- package/dist/shared/helpers.js +24 -0
- package/dist/shared/helpers.js.map +1 -0
- package/dist/shared/messages.d.ts.map +1 -1
- package/dist/shared/messages.js +23 -14
- package/dist/shared/messages.js.map +1 -1
- package/dist/shared/theme.d.ts.map +1 -1
- package/dist/shared/theme.js +1 -0
- package/dist/shared/theme.js.map +1 -1
- package/dist/shared/types/context.d.ts +4 -0
- package/dist/shared/types/context.d.ts.map +1 -1
- package/dist/shared/types/messages.d.ts +12 -1
- package/dist/shared/types/messages.d.ts.map +1 -1
- package/dist/shared/types/screen.d.ts +55 -18
- package/dist/shared/types/screen.d.ts.map +1 -1
- package/dist/shared/types/theme.d.ts +4 -0
- package/dist/shared/types/theme.d.ts.map +1 -1
- package/package.json +27 -12
- package/src/native/expo/ExpoFeedbackBody.tsx +48 -0
- package/src/native/expo/FeedbackScreen.tsx +37 -0
- package/src/native/expo/FeedbackStack.tsx +99 -0
- package/src/native/expo/README.md +17 -0
- package/src/native/expo/index.ts +8 -0
- package/src/native/expo/types.ts +23 -0
- package/src/native/native/FeedbackScreen.tsx +37 -0
- package/src/native/native/index.ts +7 -0
- package/src/native/shared/helpers.ts +9 -0
- package/src/native/shared/ui/BodyContent.tsx +43 -0
- package/src/native/shared/ui/Button.tsx +29 -0
- package/src/native/shared/ui/CommentBranch.tsx +88 -0
- package/src/native/shared/ui/EntryCard.tsx +37 -0
- package/src/native/shared/ui/EntryDetail.tsx +103 -0
- package/src/native/shared/ui/FeedbackScreenHeader.tsx +40 -0
- package/src/native/shared/ui/FeedbackScreenList.tsx +61 -0
- package/src/native/shared/ui/NewEntry.tsx +375 -0
- package/src/native/shared/ui/ReplyList.tsx +41 -0
- package/src/native/{primitives.tsx → shared/ui/primitives.tsx} +84 -92
- package/src/react/{context.tsx → css.tsx} +2 -44
- package/src/react/index.ts +1 -1
- package/src/react/primitives.tsx +2 -1
- package/src/react/screen.tsx +67 -123
- package/src/shared/context/FeedbackBodyProvider.tsx +82 -0
- package/src/{native/context.tsx → shared/context/FeedbackProvider.tsx} +3 -3
- package/src/shared/helpers.ts +33 -0
- package/src/shared/messages.ts +23 -22
- package/src/shared/theme.ts +1 -0
- package/src/shared/types/context.ts +5 -0
- package/src/shared/types/messages.ts +16 -1
- package/src/shared/types/screen.ts +69 -23
- package/src/shared/types/theme.ts +5 -0
- package/dist/native/context.d.ts.map +0 -1
- package/dist/native/context.js.map +0 -1
- package/dist/native/index.d.ts +0 -7
- package/dist/native/index.d.ts.map +0 -1
- package/dist/native/index.js +0 -6
- package/dist/native/index.js.map +0 -1
- package/dist/native/primitives.d.ts.map +0 -1
- package/dist/native/primitives.js.map +0 -1
- package/dist/native/screen.d.ts +0 -3
- package/dist/native/screen.d.ts.map +0 -1
- package/dist/native/screen.js +0 -284
- package/dist/native/screen.js.map +0 -1
- package/dist/react/context.d.ts.map +0 -1
- package/dist/react/context.js +0 -41
- package/dist/react/context.js.map +0 -1
- package/src/native/index.ts +0 -6
- package/src/native/screen.tsx +0 -831
- /package/src/native/{README.md → native/README.md} +0 -0
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
[][](https://www.convex.dev/components/convex-feedback)
|
|
1
|
+
[](https://badge.fury.io/js/convex-feedback-ui) [](https://www.convex.dev/components/convex-feedback)    
|
|
2
2
|
|
|
3
|
-
[Vite demo](https://convex-feedback-vite.vercel.app/) • [Expo/React Native demo](https://convex-feedback-
|
|
3
|
+
[Vite demo](https://convex-feedback-vite.vercel.app/) • [Expo demo](https://convex-feedback-expo.vercel.app/) • [React Native demo](https://convex-feedback-native.vercel.app/)
|
|
4
4
|
|
|
5
5
|
# convex-feedback-ui
|
|
6
6
|
|
|
7
|
-
Optional React DOM
|
|
7
|
+
Optional React DOM, React Native, and Expo Router UI for `convex-feedback`.
|
|
8
8
|
|
|
9
9
|
The package is intentionally layered:
|
|
10
10
|
|
|
@@ -14,14 +14,17 @@ convex-feedback hooks
|
|
|
14
14
|
compound UI primitives
|
|
15
15
|
↓
|
|
16
16
|
prebuilt FeedbackScreen
|
|
17
|
+
↓
|
|
18
|
+
optional Expo Router integration
|
|
17
19
|
```
|
|
18
20
|
|
|
19
|
-
Use the prebuilt screen for a complete feedback board, compose primitives for custom layouts, or ignore this package and use the headless hooks directly.
|
|
21
|
+
Use the prebuilt screen for a complete feedback board, compose primitives for custom layouts, or ignore this package entirely and use the headless `convex-feedback` hooks directly.
|
|
20
22
|
|
|
21
23
|
## React DOM
|
|
22
24
|
|
|
23
25
|
```tsx
|
|
24
26
|
import { FeedbackScreen } from "convex-feedback-ui";
|
|
27
|
+
import { feedbackHooks } from "./hooks/feedbackHooks";
|
|
25
28
|
import "convex-feedback-ui/styles.css";
|
|
26
29
|
|
|
27
30
|
<FeedbackScreen hooks={feedbackHooks} />;
|
|
@@ -33,8 +36,8 @@ The default stylesheet:
|
|
|
33
36
|
- uses namespaced `cf-*` classes;
|
|
34
37
|
- uses low-specificity `:where(...)` selectors;
|
|
35
38
|
- uses CSS custom properties for theme values;
|
|
36
|
-
- allows normal host CSS
|
|
37
|
-
- can be omitted entirely if you want
|
|
39
|
+
- allows normal host CSS, Tailwind, or CSS-module classes to override defaults;
|
|
40
|
+
- can be omitted entirely if you want to provide your own styling.
|
|
38
41
|
|
|
39
42
|
Key colors can be overridden directly:
|
|
40
43
|
|
|
@@ -54,7 +57,7 @@ Or provide theme tokens through `FeedbackProvider`.
|
|
|
54
57
|
|
|
55
58
|
## React Native
|
|
56
59
|
|
|
57
|
-
|
|
60
|
+
Use the `/native` entry point for React Native projects that do not use Expo Router, or whenever you want the standard React Native implementation without native stack integration:
|
|
58
61
|
|
|
59
62
|
```tsx
|
|
60
63
|
import { FeedbackScreen } from "convex-feedback-ui/native";
|
|
@@ -71,17 +74,80 @@ import { FeedbackScreen } from "convex-feedback-ui/native";
|
|
|
71
74
|
/>;
|
|
72
75
|
```
|
|
73
76
|
|
|
74
|
-
|
|
77
|
+
The native `FeedbackScreen` includes the feedback UI using React Native components.
|
|
78
|
+
|
|
79
|
+
## Expo Router
|
|
80
|
+
|
|
81
|
+
Expo Router projects can use the `/expo` entry point:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import { FeedbackScreen } from "convex-feedback-ui/expo";
|
|
85
|
+
|
|
86
|
+
<FeedbackScreen
|
|
87
|
+
hooks={feedbackHooks}
|
|
88
|
+
theme={{
|
|
89
|
+
colors: {
|
|
90
|
+
primary: "#6d5efc",
|
|
91
|
+
background: "#ffffff",
|
|
92
|
+
surface: "#ffffff",
|
|
93
|
+
},
|
|
94
|
+
}}
|
|
95
|
+
/>;
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
The Expo version uses the same native feedback UI, but adds optional Expo Router stack integration.
|
|
99
|
+
|
|
100
|
+
By default, `useStack` is enabled:
|
|
101
|
+
|
|
102
|
+
```tsx
|
|
103
|
+
<FeedbackScreen hooks={feedbackHooks} useStack />
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
When enabled, the prebuilt screen can integrate with the current Expo Router stack, including native stack configuration, toolbar actions, back behavior, and native search UI.
|
|
107
|
+
|
|
108
|
+
Stack options can be customized through `StackOptions`:
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
<FeedbackScreen
|
|
112
|
+
hooks={feedbackHooks}
|
|
113
|
+
stackOptions={{
|
|
114
|
+
headerLargeTitleEnabled: true,
|
|
115
|
+
headerTransparent: true,
|
|
116
|
+
}}
|
|
117
|
+
/>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Using the Expo screen without stack integration
|
|
121
|
+
|
|
122
|
+
Expo projects do not have to use the native stack integration.
|
|
123
|
+
|
|
124
|
+
Set `useStack={false}` to use the standard native feedback layout instead:
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
<FeedbackScreen hooks={feedbackHooks} useStack={false} />
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
When `useStack={false}`, the Expo convenience screen behaves like the regular React Native screen.
|
|
131
|
+
|
|
132
|
+
`StackOptions` is only available when stack integration is enabled.
|
|
133
|
+
|
|
134
|
+
## Choosing an API
|
|
135
|
+
|
|
136
|
+
For a complete implementation with minimal setup:
|
|
75
137
|
|
|
76
138
|
```text
|
|
77
|
-
|
|
78
|
-
→
|
|
79
|
-
→
|
|
139
|
+
Web → convex-feedback-ui
|
|
140
|
+
React Native → convex-feedback-ui/native
|
|
141
|
+
Expo Router → convex-feedback-ui/expo
|
|
80
142
|
```
|
|
81
143
|
|
|
82
|
-
|
|
144
|
+
For custom layouts, use the primitives exposed by the relevant entry point instead of the prebuilt `FeedbackScreen`.
|
|
145
|
+
|
|
146
|
+
The prebuilt screens are convenience APIs. They are built from the same public primitives available to consumers, so applications are not required to adopt the prebuilt layout or navigation behavior.
|
|
83
147
|
|
|
84
|
-
|
|
148
|
+
You can also import the prebuilt screen components directly if you only want certain parts without reaching for primitives.
|
|
149
|
+
|
|
150
|
+
## Using primitives
|
|
85
151
|
|
|
86
152
|
Web and native expose the same conceptual compounds:
|
|
87
153
|
|
|
@@ -95,6 +161,7 @@ Example:
|
|
|
95
161
|
```tsx
|
|
96
162
|
<FeedbackEntry.Root entry={entry}>
|
|
97
163
|
<FeedbackEntry.Upvote onToggle={setUpvote} />
|
|
164
|
+
|
|
98
165
|
<FeedbackEntry.Content>
|
|
99
166
|
<FeedbackEntry.Status />
|
|
100
167
|
<FeedbackEntry.Title />
|
|
@@ -104,7 +171,29 @@ Example:
|
|
|
104
171
|
</FeedbackEntry.Root>
|
|
105
172
|
```
|
|
106
173
|
|
|
107
|
-
Containers accept arbitrary children, so layout
|
|
174
|
+
Containers accept arbitrary children, so layout remains controlled by the host application.
|
|
175
|
+
|
|
176
|
+
Native primitives can also be composed directly:
|
|
177
|
+
|
|
178
|
+
```tsx
|
|
179
|
+
<FeedbackBoard.Root>
|
|
180
|
+
<FeedbackBoard.Header>
|
|
181
|
+
<FeedbackBoard.Title />
|
|
182
|
+
</FeedbackBoard.Header>
|
|
183
|
+
|
|
184
|
+
<FeedbackBoard.Search value={query} onValueChange={setQuery} />
|
|
185
|
+
|
|
186
|
+
<FeedbackBoard.List>
|
|
187
|
+
{entries.map((entry) => (
|
|
188
|
+
<FeedbackEntry.Root key={entry.id} entry={entry}>
|
|
189
|
+
{/* custom entry layout */}
|
|
190
|
+
</FeedbackEntry.Root>
|
|
191
|
+
))}
|
|
192
|
+
</FeedbackBoard.List>
|
|
193
|
+
</FeedbackBoard.Root>
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Using primitives directly is the recommended escape hatch when the prebuilt screen's navigation, search, layout, or presentation does not fit the host application.
|
|
108
197
|
|
|
109
198
|
## Replacing primitive implementations
|
|
110
199
|
|
|
@@ -118,9 +207,9 @@ Interactive leaf primitives accept typed render-function children. This is the e
|
|
|
118
207
|
</Comment.Like>
|
|
119
208
|
```
|
|
120
209
|
|
|
121
|
-
The render function replaces the entire visual implementation while preserving state
|
|
210
|
+
The render function replaces the entire visual implementation while preserving state and action wiring. Regular children replace only the default content where supported.
|
|
122
211
|
|
|
123
|
-
This pattern is intentionally used instead of relying on a DOM-specific `asChild` clone mechanism, so it works
|
|
212
|
+
This pattern is intentionally used instead of relying on a DOM-specific `asChild` clone mechanism, so it works across React DOM and React Native.
|
|
124
213
|
|
|
125
214
|
## Localization and copy customization
|
|
126
215
|
|
|
@@ -168,7 +257,9 @@ Pass `commentSort="top" | "newest" | "oldest"` to the prebuilt screen for global
|
|
|
168
257
|
For custom presentation ordering, provide:
|
|
169
258
|
|
|
170
259
|
```tsx
|
|
171
|
-
transformComments={(comments) =>
|
|
260
|
+
transformComments={(comments) =>
|
|
261
|
+
[...comments].sort(myComparator)
|
|
262
|
+
}
|
|
172
263
|
```
|
|
173
264
|
|
|
174
265
|
That transform only affects comments already loaded at the current direct-child level. It is deliberately not described as a globally paginated server sort.
|
|
@@ -186,4 +277,10 @@ Do not hardcode new visible sentences inside a primitive or prebuilt screen.
|
|
|
186
277
|
|
|
187
278
|
## Monorepo development
|
|
188
279
|
|
|
189
|
-
From the repository root, run
|
|
280
|
+
From the repository root, run:
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
npm install
|
|
284
|
+
npm run codegen
|
|
285
|
+
npm run test:all
|
|
286
|
+
```
|