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.
Files changed (166) hide show
  1. package/README.md +115 -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 +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 +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 +88 -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 +40 -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/shared/ui/ReplyList.tsx +41 -0
  135. package/src/native/{primitives.tsx → shared/ui/primitives.tsx} +84 -92
  136. package/src/react/{context.tsx → css.tsx} +2 -44
  137. package/src/react/index.ts +1 -1
  138. package/src/react/primitives.tsx +2 -1
  139. package/src/react/screen.tsx +67 -123
  140. package/src/shared/context/FeedbackBodyProvider.tsx +82 -0
  141. package/src/{native/context.tsx → shared/context/FeedbackProvider.tsx} +3 -3
  142. package/src/shared/helpers.ts +33 -0
  143. package/src/shared/messages.ts +23 -22
  144. package/src/shared/theme.ts +1 -0
  145. package/src/shared/types/context.ts +5 -0
  146. package/src/shared/types/messages.ts +16 -1
  147. package/src/shared/types/screen.ts +69 -23
  148. package/src/shared/types/theme.ts +5 -0
  149. package/dist/native/context.d.ts.map +0 -1
  150. package/dist/native/context.js.map +0 -1
  151. package/dist/native/index.d.ts +0 -7
  152. package/dist/native/index.d.ts.map +0 -1
  153. package/dist/native/index.js +0 -6
  154. package/dist/native/index.js.map +0 -1
  155. package/dist/native/primitives.d.ts.map +0 -1
  156. package/dist/native/primitives.js.map +0 -1
  157. package/dist/native/screen.d.ts +0 -3
  158. package/dist/native/screen.d.ts.map +0 -1
  159. package/dist/native/screen.js +0 -284
  160. package/dist/native/screen.js.map +0 -1
  161. package/dist/react/context.d.ts.map +0 -1
  162. package/dist/react/context.js +0 -41
  163. package/dist/react/context.js.map +0 -1
  164. package/src/native/index.ts +0 -6
  165. package/src/native/screen.tsx +0 -831
  166. /package/src/native/{README.md → native/README.md} +0 -0
package/README.md CHANGED
@@ -1,10 +1,10 @@
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
+ 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/Tailwind/CSS-module classes to override defaults;
37
- - 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.
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
- 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:
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
- 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:
75
137
 
76
138
  ```text
77
- component color/style prop
78
- provider theme
79
- built-in fallback theme
139
+ Web → convex-feedback-ui
140
+ React Native convex-feedback-ui/native
141
+ Expo Router convex-feedback-ui/expo
80
142
  ```
81
143
 
82
- 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.
83
147
 
84
- ## 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
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 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.
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/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.
122
211
 
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.
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) => [...comments].sort(myComparator)}
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 `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
+ ```