convex-feedback-ui 0.1.2 → 0.1.4

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.
Files changed (165) hide show
  1. package/README.md +119 -18
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/native/expo/ExpoFeedbackBody.d.ts +4 -0
  4. package/dist/native/expo/ExpoFeedbackBody.d.ts.map +1 -0
  5. package/dist/native/expo/ExpoFeedbackBody.js +26 -0
  6. package/dist/native/expo/ExpoFeedbackBody.js.map +1 -0
  7. package/dist/native/expo/FeedbackScreen.d.ts +3 -0
  8. package/dist/native/expo/FeedbackScreen.d.ts.map +1 -0
  9. package/dist/native/expo/FeedbackScreen.js +9 -0
  10. package/dist/native/expo/FeedbackScreen.js.map +1 -0
  11. package/dist/native/expo/FeedbackStack.d.ts +3 -0
  12. package/dist/native/expo/FeedbackStack.d.ts.map +1 -0
  13. package/dist/native/expo/FeedbackStack.js +41 -0
  14. package/dist/native/expo/FeedbackStack.js.map +1 -0
  15. package/dist/native/expo/index.d.ts +9 -0
  16. package/dist/native/expo/index.d.ts.map +1 -0
  17. package/dist/native/expo/index.js +7 -0
  18. package/dist/native/expo/index.js.map +1 -0
  19. package/dist/native/expo/types.d.ts +20 -0
  20. package/dist/native/expo/types.d.ts.map +1 -0
  21. package/dist/native/expo/types.js +2 -0
  22. package/dist/native/expo/types.js.map +1 -0
  23. package/dist/native/native/FeedbackScreen.d.ts +3 -0
  24. package/dist/native/native/FeedbackScreen.d.ts.map +1 -0
  25. package/dist/native/native/FeedbackScreen.js +9 -0
  26. package/dist/native/native/FeedbackScreen.js.map +1 -0
  27. package/dist/native/native/index.d.ts +8 -0
  28. package/dist/native/native/index.d.ts.map +1 -0
  29. package/dist/native/native/index.js +7 -0
  30. package/dist/native/native/index.js.map +1 -0
  31. package/dist/native/shared/helpers.d.ts +3 -0
  32. package/dist/native/shared/helpers.d.ts.map +1 -0
  33. package/dist/native/shared/helpers.js +4 -0
  34. package/dist/native/shared/helpers.js.map +1 -0
  35. package/dist/native/shared/ui/BodyContent.d.ts +3 -0
  36. package/dist/native/shared/ui/BodyContent.d.ts.map +1 -0
  37. package/dist/native/shared/ui/BodyContent.js +18 -0
  38. package/dist/native/shared/ui/BodyContent.js.map +1 -0
  39. package/dist/native/shared/ui/Button.d.ts +5 -0
  40. package/dist/native/shared/ui/Button.d.ts.map +1 -0
  41. package/dist/native/shared/ui/Button.js +15 -0
  42. package/dist/native/shared/ui/Button.js.map +1 -0
  43. package/dist/native/shared/ui/CommentBranch.d.ts +5 -0
  44. package/dist/native/shared/ui/CommentBranch.d.ts.map +1 -0
  45. package/dist/native/shared/ui/CommentBranch.js +45 -0
  46. package/dist/native/shared/ui/CommentBranch.js.map +1 -0
  47. package/dist/native/shared/ui/EntryCard.d.ts +3 -0
  48. package/dist/native/shared/ui/EntryCard.d.ts.map +1 -0
  49. package/dist/native/shared/ui/EntryCard.js +13 -0
  50. package/dist/native/shared/ui/EntryCard.js.map +1 -0
  51. package/dist/native/shared/ui/EntryDetail.d.ts +3 -0
  52. package/dist/native/shared/ui/EntryDetail.d.ts.map +1 -0
  53. package/dist/native/shared/ui/EntryDetail.js +37 -0
  54. package/dist/native/shared/ui/EntryDetail.js.map +1 -0
  55. package/dist/native/shared/ui/FeedbackScreenHeader.d.ts +2 -0
  56. package/dist/native/shared/ui/FeedbackScreenHeader.d.ts.map +1 -0
  57. package/dist/native/shared/ui/FeedbackScreenHeader.js +22 -0
  58. package/dist/native/shared/ui/FeedbackScreenHeader.js.map +1 -0
  59. package/dist/native/shared/ui/FeedbackScreenList.d.ts +3 -0
  60. package/dist/native/shared/ui/FeedbackScreenList.d.ts.map +1 -0
  61. package/dist/native/shared/ui/FeedbackScreenList.js +19 -0
  62. package/dist/native/shared/ui/FeedbackScreenList.js.map +1 -0
  63. package/dist/native/shared/ui/NewEntry.d.ts +5 -0
  64. package/dist/native/shared/ui/NewEntry.d.ts.map +1 -0
  65. package/dist/native/shared/ui/NewEntry.js +158 -0
  66. package/dist/native/shared/ui/NewEntry.js.map +1 -0
  67. package/dist/native/shared/ui/ReplyList.d.ts +3 -0
  68. package/dist/native/shared/ui/ReplyList.d.ts.map +1 -0
  69. package/dist/native/shared/ui/ReplyList.js +19 -0
  70. package/dist/native/shared/ui/ReplyList.js.map +1 -0
  71. package/dist/native/{primitives.d.ts → shared/ui/primitives.d.ts} +10 -12
  72. package/dist/native/shared/ui/primitives.d.ts.map +1 -0
  73. package/dist/native/{primitives.js → shared/ui/primitives.js} +19 -25
  74. package/dist/native/shared/ui/primitives.js.map +1 -0
  75. package/dist/react/{context.d.ts → css.d.ts} +2 -4
  76. package/dist/react/css.d.ts.map +1 -0
  77. package/dist/react/css.js +18 -0
  78. package/dist/react/css.js.map +1 -0
  79. package/dist/react/index.d.ts +1 -1
  80. package/dist/react/index.d.ts.map +1 -1
  81. package/dist/react/index.js +1 -1
  82. package/dist/react/index.js.map +1 -1
  83. package/dist/react/primitives.d.ts.map +1 -1
  84. package/dist/react/primitives.js +2 -1
  85. package/dist/react/primitives.js.map +1 -1
  86. package/dist/react/screen.d.ts +3 -3
  87. package/dist/react/screen.d.ts.map +1 -1
  88. package/dist/react/screen.js +25 -22
  89. package/dist/react/screen.js.map +1 -1
  90. package/dist/shared/context/FeedbackBodyProvider.d.ts +5 -0
  91. package/dist/shared/context/FeedbackBodyProvider.d.ts.map +1 -0
  92. package/dist/shared/context/FeedbackBodyProvider.js +43 -0
  93. package/dist/shared/context/FeedbackBodyProvider.js.map +1 -0
  94. package/dist/{native/context.d.ts → shared/context/FeedbackProvider.d.ts} +2 -2
  95. package/dist/shared/context/FeedbackProvider.d.ts.map +1 -0
  96. package/dist/{native/context.js → shared/context/FeedbackProvider.js} +3 -3
  97. package/dist/shared/context/FeedbackProvider.js.map +1 -0
  98. package/dist/shared/helpers.d.ts +7 -0
  99. package/dist/shared/helpers.d.ts.map +1 -0
  100. package/dist/shared/helpers.js +24 -0
  101. package/dist/shared/helpers.js.map +1 -0
  102. package/dist/shared/messages.d.ts.map +1 -1
  103. package/dist/shared/messages.js +23 -14
  104. package/dist/shared/messages.js.map +1 -1
  105. package/dist/shared/theme.d.ts.map +1 -1
  106. package/dist/shared/theme.js +1 -0
  107. package/dist/shared/theme.js.map +1 -1
  108. package/dist/shared/types/context.d.ts +4 -0
  109. package/dist/shared/types/context.d.ts.map +1 -1
  110. package/dist/shared/types/messages.d.ts +12 -1
  111. package/dist/shared/types/messages.d.ts.map +1 -1
  112. package/dist/shared/types/screen.d.ts +55 -18
  113. package/dist/shared/types/screen.d.ts.map +1 -1
  114. package/dist/shared/types/theme.d.ts +4 -0
  115. package/dist/shared/types/theme.d.ts.map +1 -1
  116. package/package.json +27 -12
  117. package/src/native/expo/ExpoFeedbackBody.tsx +48 -0
  118. package/src/native/expo/FeedbackScreen.tsx +37 -0
  119. package/src/native/expo/FeedbackStack.tsx +99 -0
  120. package/src/native/expo/README.md +17 -0
  121. package/src/native/expo/index.ts +8 -0
  122. package/src/native/expo/types.ts +23 -0
  123. package/src/native/native/FeedbackScreen.tsx +37 -0
  124. package/src/native/native/index.ts +7 -0
  125. package/src/native/shared/helpers.ts +9 -0
  126. package/src/native/shared/ui/BodyContent.tsx +43 -0
  127. package/src/native/shared/ui/Button.tsx +29 -0
  128. package/src/native/shared/ui/CommentBranch.tsx +122 -0
  129. package/src/native/shared/ui/EntryCard.tsx +37 -0
  130. package/src/native/shared/ui/EntryDetail.tsx +103 -0
  131. package/src/native/shared/ui/FeedbackScreenHeader.tsx +42 -0
  132. package/src/native/shared/ui/FeedbackScreenList.tsx +61 -0
  133. package/src/native/shared/ui/NewEntry.tsx +375 -0
  134. package/src/native/{primitives.tsx → shared/ui/primitives.tsx} +84 -92
  135. package/src/react/{context.tsx → css.tsx} +2 -44
  136. package/src/react/index.ts +1 -1
  137. package/src/react/primitives.tsx +2 -1
  138. package/src/react/screen.tsx +67 -123
  139. package/src/shared/context/FeedbackBodyProvider.tsx +82 -0
  140. package/src/{native/context.tsx → shared/context/FeedbackProvider.tsx} +3 -3
  141. package/src/shared/helpers.ts +33 -0
  142. package/src/shared/messages.ts +23 -22
  143. package/src/shared/theme.ts +1 -0
  144. package/src/shared/types/context.ts +5 -0
  145. package/src/shared/types/messages.ts +16 -1
  146. package/src/shared/types/screen.ts +69 -23
  147. package/src/shared/types/theme.ts +5 -0
  148. package/dist/native/context.d.ts.map +0 -1
  149. package/dist/native/context.js.map +0 -1
  150. package/dist/native/index.d.ts +0 -7
  151. package/dist/native/index.d.ts.map +0 -1
  152. package/dist/native/index.js +0 -6
  153. package/dist/native/index.js.map +0 -1
  154. package/dist/native/primitives.d.ts.map +0 -1
  155. package/dist/native/primitives.js.map +0 -1
  156. package/dist/native/screen.d.ts +0 -3
  157. package/dist/native/screen.d.ts.map +0 -1
  158. package/dist/native/screen.js +0 -284
  159. package/dist/native/screen.js.map +0 -1
  160. package/dist/react/context.d.ts.map +0 -1
  161. package/dist/react/context.js +0 -41
  162. package/dist/react/context.js.map +0 -1
  163. package/src/native/index.ts +0 -6
  164. package/src/native/screen.tsx +0 -831
  165. /package/src/native/{README.md → native/README.md} +0 -0
package/README.md CHANGED
@@ -1,10 +1,14 @@
1
- [![npm version](https://badge.fury.io/js/convex-feedback-ui.svg)][![Convex Component](https://www.convex.dev/components/badge/convex-feedback)](https://www.convex.dev/components/convex-feedback)(https://badge.fury.io/js/convex-feedback-ui) ![NPM License](https://img.shields.io/npm/l/convex-feedback-ui) ![NPM Downloads](https://img.shields.io/npm/dw/convex-feedback-ui) ![GitHub forks](https://img.shields.io/github/forks/moumen-io/convex-feedback) ![GitHub Repo stars](https://img.shields.io/github/stars/moumen-io/convex-feedback)
1
+ [![npm version](https://badge.fury.io/js/convex-feedback-ui.svg)](https://badge.fury.io/js/convex-feedback-ui) [![Convex Component](https://www.convex.dev/components/badge/convex-feedback)](https://www.convex.dev/components/convex-feedback) ![NPM License](https://img.shields.io/npm/l/convex-feedback-ui) ![NPM Downloads](https://img.shields.io/npm/dw/convex-feedback-ui) ![GitHub forks](https://img.shields.io/github/forks/moumen-io/convex-feedback) ![GitHub Repo stars](https://img.shields.io/github/stars/moumen-io/convex-feedback)
2
2
 
3
- [Vite demo](https://convex-feedback-vite.vercel.app/) • [Expo/React Native demo](https://convex-feedback-expo.vercel.app/)
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 and React Native UI for `convex-feedback`.
7
+ | Expo | React Native |
8
+ | ------------------------------------ | ---------------------------------------------- |
9
+ | ![Expo](./docs/screenshots/expo.png) | ![React Native](./docs/screenshots/native.png) |
10
+
11
+ Optional React DOM, React Native, and Expo Router UI for `convex-feedback`.
8
12
 
9
13
  The package is intentionally layered:
10
14
 
@@ -14,14 +18,17 @@ convex-feedback hooks
14
18
  compound UI primitives
15
19
 
16
20
  prebuilt FeedbackScreen
21
+
22
+ optional Expo Router integration
17
23
  ```
18
24
 
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.
25
+ 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
26
 
21
27
  ## React DOM
22
28
 
23
29
  ```tsx
24
30
  import { FeedbackScreen } from "convex-feedback-ui";
31
+ import { feedbackHooks } from "./hooks/feedbackHooks";
25
32
  import "convex-feedback-ui/styles.css";
26
33
 
27
34
  <FeedbackScreen hooks={feedbackHooks} />;
@@ -33,8 +40,8 @@ The default stylesheet:
33
40
  - uses namespaced `cf-*` classes;
34
41
  - uses low-specificity `:where(...)` selectors;
35
42
  - uses CSS custom properties for theme values;
36
- - allows normal host CSS/Tailwind/CSS-module classes to override defaults;
37
- - can be omitted entirely if you want headless markup.
43
+ - allows normal host CSS, Tailwind, or CSS-module classes to override defaults;
44
+ - can be omitted entirely if you want to provide your own styling.
38
45
 
39
46
  Key colors can be overridden directly:
40
47
 
@@ -54,7 +61,7 @@ Or provide theme tokens through `FeedbackProvider`.
54
61
 
55
62
  ## React Native
56
63
 
57
- All native implementation files and exports live under `/native`:
64
+ 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
65
 
59
66
  ```tsx
60
67
  import { FeedbackScreen } from "convex-feedback-ui/native";
@@ -71,17 +78,80 @@ import { FeedbackScreen } from "convex-feedback-ui/native";
71
78
  />;
72
79
  ```
73
80
 
74
- There is no NativeWind dependency. Native style precedence is:
81
+ The native `FeedbackScreen` includes the feedback UI using React Native components.
82
+
83
+ ## Expo Router
84
+
85
+ Expo Router projects can use the `/expo` entry point:
86
+
87
+ ```tsx
88
+ import { FeedbackScreen } from "convex-feedback-ui/expo";
89
+
90
+ <FeedbackScreen
91
+ hooks={feedbackHooks}
92
+ theme={{
93
+ colors: {
94
+ primary: "#6d5efc",
95
+ background: "#ffffff",
96
+ surface: "#ffffff",
97
+ },
98
+ }}
99
+ />;
100
+ ```
101
+
102
+ The Expo version uses the same native feedback UI, but adds optional Expo Router stack integration.
103
+
104
+ By default, `useStack` is enabled:
105
+
106
+ ```tsx
107
+ <FeedbackScreen hooks={feedbackHooks} useStack />
108
+ ```
109
+
110
+ 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.
111
+
112
+ Stack options can be customized through `StackOptions`:
113
+
114
+ ```tsx
115
+ <FeedbackScreen
116
+ hooks={feedbackHooks}
117
+ stackOptions={{
118
+ headerLargeTitleEnabled: true,
119
+ headerTransparent: true,
120
+ }}
121
+ />
122
+ ```
123
+
124
+ ### Using the Expo screen without stack integration
125
+
126
+ Expo projects do not have to use the native stack integration.
127
+
128
+ Set `useStack={false}` to use the standard native feedback layout instead:
129
+
130
+ ```tsx
131
+ <FeedbackScreen hooks={feedbackHooks} useStack={false} />
132
+ ```
133
+
134
+ When `useStack={false}`, the Expo convenience screen behaves like the regular React Native screen.
135
+
136
+ `StackOptions` is only available when stack integration is enabled.
137
+
138
+ ## Choosing an API
139
+
140
+ For a complete implementation with minimal setup:
75
141
 
76
142
  ```text
77
- component color/style prop
78
- provider theme
79
- built-in fallback theme
143
+ Web → convex-feedback-ui
144
+ React Native convex-feedback-ui/native
145
+ Expo Router convex-feedback-ui/expo
80
146
  ```
81
147
 
82
- Normal React Native `style` props remain available.
148
+ For custom layouts, use the primitives exposed by the relevant entry point instead of the prebuilt `FeedbackScreen`.
149
+
150
+ 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
151
 
84
- ## Compound components
152
+ You can also import the prebuilt screen components directly if you only want certain parts without reaching for primitives.
153
+
154
+ ## Using primitives
85
155
 
86
156
  Web and native expose the same conceptual compounds:
87
157
 
@@ -95,6 +165,7 @@ Example:
95
165
  ```tsx
96
166
  <FeedbackEntry.Root entry={entry}>
97
167
  <FeedbackEntry.Upvote onToggle={setUpvote} />
168
+
98
169
  <FeedbackEntry.Content>
99
170
  <FeedbackEntry.Status />
100
171
  <FeedbackEntry.Title />
@@ -104,7 +175,29 @@ Example:
104
175
  </FeedbackEntry.Root>
105
176
  ```
106
177
 
107
- Containers accept arbitrary children, so layout is controlled by the host.
178
+ Containers accept arbitrary children, so layout remains controlled by the host application.
179
+
180
+ Native primitives can also be composed directly:
181
+
182
+ ```tsx
183
+ <FeedbackBoard.Root>
184
+ <FeedbackBoard.Header>
185
+ <FeedbackBoard.Title />
186
+ </FeedbackBoard.Header>
187
+
188
+ <FeedbackBoard.Search value={query} onValueChange={setQuery} />
189
+
190
+ <FeedbackBoard.List>
191
+ {entries.map((entry) => (
192
+ <FeedbackEntry.Root key={entry.id} entry={entry}>
193
+ {/* custom entry layout */}
194
+ </FeedbackEntry.Root>
195
+ ))}
196
+ </FeedbackBoard.List>
197
+ </FeedbackBoard.Root>
198
+ ```
199
+
200
+ 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
201
 
109
202
  ## Replacing primitive implementations
110
203
 
@@ -118,9 +211,9 @@ Interactive leaf primitives accept typed render-function children. This is the e
118
211
  </Comment.Like>
119
212
  ```
120
213
 
121
- The render function replaces the entire visual implementation while preserving state/action wiring. Regular children replace only the default content where supported.
214
+ The render function replaces the entire visual implementation while preserving state and action wiring. Regular children replace only the default content where supported.
122
215
 
123
- This pattern is intentionally used instead of relying on a DOM-specific `asChild` clone mechanism, so it works on both React DOM and React Native.
216
+ 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
217
 
125
218
  ## Localization and copy customization
126
219
 
@@ -168,7 +261,9 @@ Pass `commentSort="top" | "newest" | "oldest"` to the prebuilt screen for global
168
261
  For custom presentation ordering, provide:
169
262
 
170
263
  ```tsx
171
- transformComments={(comments) => [...comments].sort(myComparator)}
264
+ transformComments={(comments) =>
265
+ [...comments].sort(myComparator)
266
+ }
172
267
  ```
173
268
 
174
269
  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 +281,10 @@ Do not hardcode new visible sentences inside a primitive or prebuilt screen.
186
281
 
187
282
  ## Monorepo development
188
283
 
189
- From the repository root, run `npm install`, `npm run codegen`, then `npm run check`. The workspace intentionally avoids `prepare`; the root build compiles `convex-feedback` before this package so its exported declarations exist before the UI package is type-checked. `prepack` is reserved for package publishing.
284
+ From the repository root, run:
285
+
286
+ ```bash
287
+ npm install
288
+ npm run codegen
289
+ npm run test:all
290
+ ```