convex-feedback-ui 0.1.1 → 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.
Files changed (169) hide show
  1. package/README.md +116 -17
  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 +3 -0
  44. package/dist/native/shared/ui/CommentBranch.d.ts.map +1 -0
  45. package/dist/native/shared/ui/CommentBranch.js +35 -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 +20 -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 +6 -6
  80. package/dist/react/index.d.ts.map +1 -1
  81. package/dist/react/index.js +5 -5
  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/index.d.ts +9 -9
  111. package/dist/shared/types/index.d.ts.map +1 -1
  112. package/dist/shared/types/messages.d.ts +12 -1
  113. package/dist/shared/types/messages.d.ts.map +1 -1
  114. package/dist/shared/types/screen.d.ts +55 -18
  115. package/dist/shared/types/screen.d.ts.map +1 -1
  116. package/dist/shared/types/theme.d.ts +4 -0
  117. package/dist/shared/types/theme.d.ts.map +1 -1
  118. package/package.json +30 -12
  119. package/src/native/expo/ExpoFeedbackBody.tsx +48 -0
  120. package/src/native/expo/FeedbackScreen.tsx +37 -0
  121. package/src/native/expo/FeedbackStack.tsx +99 -0
  122. package/src/native/expo/README.md +17 -0
  123. package/src/native/expo/index.ts +8 -0
  124. package/src/native/expo/types.ts +23 -0
  125. package/src/native/native/FeedbackScreen.tsx +37 -0
  126. package/src/native/native/index.ts +7 -0
  127. package/src/native/shared/helpers.ts +9 -0
  128. package/src/native/shared/ui/BodyContent.tsx +43 -0
  129. package/src/native/shared/ui/Button.tsx +29 -0
  130. package/src/native/shared/ui/CommentBranch.tsx +88 -0
  131. package/src/native/shared/ui/EntryCard.tsx +37 -0
  132. package/src/native/shared/ui/EntryDetail.tsx +103 -0
  133. package/src/native/shared/ui/FeedbackScreenHeader.tsx +40 -0
  134. package/src/native/shared/ui/FeedbackScreenList.tsx +61 -0
  135. package/src/native/shared/ui/NewEntry.tsx +375 -0
  136. package/src/native/shared/ui/ReplyList.tsx +41 -0
  137. package/src/native/{primitives.tsx → shared/ui/primitives.tsx} +84 -92
  138. package/src/react/{context.tsx → css.tsx} +2 -44
  139. package/src/react/index.ts +6 -42
  140. package/src/react/primitives.tsx +2 -1
  141. package/src/react/screen.tsx +67 -123
  142. package/src/shared/context/FeedbackBodyProvider.tsx +82 -0
  143. package/src/{native/context.tsx → shared/context/FeedbackProvider.tsx} +3 -3
  144. package/src/shared/helpers.ts +33 -0
  145. package/src/shared/messages.ts +23 -22
  146. package/src/shared/theme.ts +1 -0
  147. package/src/shared/types/context.ts +5 -0
  148. package/src/shared/types/index.ts +9 -45
  149. package/src/shared/types/messages.ts +16 -1
  150. package/src/shared/types/screen.ts +69 -23
  151. package/src/shared/types/theme.ts +5 -0
  152. package/dist/native/context.d.ts.map +0 -1
  153. package/dist/native/context.js.map +0 -1
  154. package/dist/native/index.d.ts +0 -7
  155. package/dist/native/index.d.ts.map +0 -1
  156. package/dist/native/index.js +0 -6
  157. package/dist/native/index.js.map +0 -1
  158. package/dist/native/primitives.d.ts.map +0 -1
  159. package/dist/native/primitives.js.map +0 -1
  160. package/dist/native/screen.d.ts +0 -3
  161. package/dist/native/screen.d.ts.map +0 -1
  162. package/dist/native/screen.js +0 -284
  163. package/dist/native/screen.js.map +0 -1
  164. package/dist/react/context.d.ts.map +0 -1
  165. package/dist/react/context.js +0 -41
  166. package/dist/react/context.js.map +0 -1
  167. package/src/native/index.ts +0 -39
  168. package/src/native/screen.tsx +0 -831
  169. /package/src/native/{README.md → native/README.md} +0 -0
package/README.md CHANGED
@@ -1,8 +1,10 @@
1
- [![npm version](https://badge.fury.io/js/convex-feedback-ui.svg)](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
+
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/)
2
4
 
3
5
  # convex-feedback-ui
4
6
 
5
- Optional React DOM and React Native UI for `convex-feedback`.
7
+ Optional React DOM, React Native, and Expo Router UI for `convex-feedback`.
6
8
 
7
9
  The package is intentionally layered:
8
10
 
@@ -12,14 +14,17 @@ convex-feedback hooks
12
14
  compound UI primitives
13
15
 
14
16
  prebuilt FeedbackScreen
17
+
18
+ optional Expo Router integration
15
19
  ```
16
20
 
17
- 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.
18
22
 
19
23
  ## React DOM
20
24
 
21
25
  ```tsx
22
26
  import { FeedbackScreen } from "convex-feedback-ui";
27
+ import { feedbackHooks } from "./hooks/feedbackHooks";
23
28
  import "convex-feedback-ui/styles.css";
24
29
 
25
30
  <FeedbackScreen hooks={feedbackHooks} />;
@@ -31,8 +36,8 @@ The default stylesheet:
31
36
  - uses namespaced `cf-*` classes;
32
37
  - uses low-specificity `:where(...)` selectors;
33
38
  - uses CSS custom properties for theme values;
34
- - allows normal host CSS/Tailwind/CSS-module classes to override defaults;
35
- - can be omitted entirely if you want headless markup.
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.
36
41
 
37
42
  Key colors can be overridden directly:
38
43
 
@@ -52,7 +57,7 @@ Or provide theme tokens through `FeedbackProvider`.
52
57
 
53
58
  ## React Native
54
59
 
55
- All native implementation files and exports live under `/native`:
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:
56
61
 
57
62
  ```tsx
58
63
  import { FeedbackScreen } from "convex-feedback-ui/native";
@@ -69,17 +74,80 @@ import { FeedbackScreen } from "convex-feedback-ui/native";
69
74
  />;
70
75
  ```
71
76
 
72
- There is no NativeWind dependency. Native style precedence is:
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:
73
137
 
74
138
  ```text
75
- component color/style prop
76
- provider theme
77
- built-in fallback theme
139
+ Web → convex-feedback-ui
140
+ React Native convex-feedback-ui/native
141
+ Expo Router convex-feedback-ui/expo
78
142
  ```
79
143
 
80
- Normal React Native `style` props remain available.
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.
81
147
 
82
- ## Compound components
148
+ You can also import the prebuilt screen components directly if you only want certain parts without reaching for primitives.
149
+
150
+ ## Using primitives
83
151
 
84
152
  Web and native expose the same conceptual compounds:
85
153
 
@@ -93,6 +161,7 @@ Example:
93
161
  ```tsx
94
162
  <FeedbackEntry.Root entry={entry}>
95
163
  <FeedbackEntry.Upvote onToggle={setUpvote} />
164
+
96
165
  <FeedbackEntry.Content>
97
166
  <FeedbackEntry.Status />
98
167
  <FeedbackEntry.Title />
@@ -102,7 +171,29 @@ Example:
102
171
  </FeedbackEntry.Root>
103
172
  ```
104
173
 
105
- Containers accept arbitrary children, so layout is controlled by the host.
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.
106
197
 
107
198
  ## Replacing primitive implementations
108
199
 
@@ -116,9 +207,9 @@ Interactive leaf primitives accept typed render-function children. This is the e
116
207
  </Comment.Like>
117
208
  ```
118
209
 
119
- The render function replaces the entire visual implementation while preserving state/action wiring. Regular children replace only the default content where supported.
210
+ The render function replaces the entire visual implementation while preserving state and action wiring. Regular children replace only the default content where supported.
120
211
 
121
- 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.
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.
122
213
 
123
214
  ## Localization and copy customization
124
215
 
@@ -166,7 +257,9 @@ Pass `commentSort="top" | "newest" | "oldest"` to the prebuilt screen for global
166
257
  For custom presentation ordering, provide:
167
258
 
168
259
  ```tsx
169
- transformComments={(comments) => [...comments].sort(myComparator)}
260
+ transformComments={(comments) =>
261
+ [...comments].sort(myComparator)
262
+ }
170
263
  ```
171
264
 
172
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.
@@ -184,4 +277,10 @@ Do not hardcode new visible sentences inside a primitive or prebuilt screen.
184
277
 
185
278
  ## Monorepo development
186
279
 
187
- 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.
280
+ From the repository root, run:
281
+
282
+ ```bash
283
+ npm install
284
+ npm run codegen
285
+ npm run test:all
286
+ ```