convex-feedback-ui 0.1.1

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 (118) hide show
  1. package/README.md +187 -0
  2. package/dist/.tsbuildinfo +1 -0
  3. package/dist/native/context.d.ts +10 -0
  4. package/dist/native/context.d.ts.map +1 -0
  5. package/dist/native/context.js +33 -0
  6. package/dist/native/context.js.map +1 -0
  7. package/dist/native/index.d.ts +7 -0
  8. package/dist/native/index.d.ts.map +1 -0
  9. package/dist/native/index.js +6 -0
  10. package/dist/native/index.js.map +1 -0
  11. package/dist/native/primitives.d.ts +94 -0
  12. package/dist/native/primitives.d.ts.map +1 -0
  13. package/dist/native/primitives.js +303 -0
  14. package/dist/native/primitives.js.map +1 -0
  15. package/dist/native/screen.d.ts +3 -0
  16. package/dist/native/screen.d.ts.map +1 -0
  17. package/dist/native/screen.js +284 -0
  18. package/dist/native/screen.js.map +1 -0
  19. package/dist/react/context.d.ts +22 -0
  20. package/dist/react/context.d.ts.map +1 -0
  21. package/dist/react/context.js +41 -0
  22. package/dist/react/context.js.map +1 -0
  23. package/dist/react/index.d.ts +7 -0
  24. package/dist/react/index.d.ts.map +1 -0
  25. package/dist/react/index.js +6 -0
  26. package/dist/react/index.js.map +1 -0
  27. package/dist/react/primitives.d.ts +105 -0
  28. package/dist/react/primitives.d.ts.map +1 -0
  29. package/dist/react/primitives.js +217 -0
  30. package/dist/react/primitives.js.map +1 -0
  31. package/dist/react/screen.d.ts +6 -0
  32. package/dist/react/screen.d.ts.map +1 -0
  33. package/dist/react/screen.js +152 -0
  34. package/dist/react/screen.js.map +1 -0
  35. package/dist/react/styles.css +299 -0
  36. package/dist/shared/messages.d.ts +4 -0
  37. package/dist/shared/messages.d.ts.map +1 -0
  38. package/dist/shared/messages.js +85 -0
  39. package/dist/shared/messages.js.map +1 -0
  40. package/dist/shared/render.d.ts +4 -0
  41. package/dist/shared/render.d.ts.map +1 -0
  42. package/dist/shared/render.js +6 -0
  43. package/dist/shared/render.js.map +1 -0
  44. package/dist/shared/theme.d.ts +4 -0
  45. package/dist/shared/theme.d.ts.map +1 -0
  46. package/dist/shared/theme.js +23 -0
  47. package/dist/shared/theme.js.map +1 -0
  48. package/dist/shared/types/board.d.ts +43 -0
  49. package/dist/shared/types/board.d.ts.map +1 -0
  50. package/dist/shared/types/board.js +2 -0
  51. package/dist/shared/types/board.js.map +1 -0
  52. package/dist/shared/types/comment.d.ts +85 -0
  53. package/dist/shared/types/comment.d.ts.map +1 -0
  54. package/dist/shared/types/comment.js +2 -0
  55. package/dist/shared/types/comment.js.map +1 -0
  56. package/dist/shared/types/context.d.ts +68 -0
  57. package/dist/shared/types/context.d.ts.map +1 -0
  58. package/dist/shared/types/context.js +2 -0
  59. package/dist/shared/types/context.js.map +1 -0
  60. package/dist/shared/types/entry.d.ts +41 -0
  61. package/dist/shared/types/entry.d.ts.map +1 -0
  62. package/dist/shared/types/entry.js +2 -0
  63. package/dist/shared/types/entry.js.map +1 -0
  64. package/dist/shared/types/form.d.ts +25 -0
  65. package/dist/shared/types/form.d.ts.map +1 -0
  66. package/dist/shared/types/form.js +2 -0
  67. package/dist/shared/types/form.js.map +1 -0
  68. package/dist/shared/types/helpers.d.ts +2 -0
  69. package/dist/shared/types/helpers.d.ts.map +1 -0
  70. package/dist/shared/types/helpers.js +2 -0
  71. package/dist/shared/types/helpers.js.map +1 -0
  72. package/dist/shared/types/index.d.ts +10 -0
  73. package/dist/shared/types/index.d.ts.map +1 -0
  74. package/dist/shared/types/index.js +2 -0
  75. package/dist/shared/types/index.js.map +1 -0
  76. package/dist/shared/types/messages.d.ts +117 -0
  77. package/dist/shared/types/messages.d.ts.map +1 -0
  78. package/dist/shared/types/messages.js +2 -0
  79. package/dist/shared/types/messages.js.map +1 -0
  80. package/dist/shared/types/render.d.ts +12 -0
  81. package/dist/shared/types/render.d.ts.map +1 -0
  82. package/dist/shared/types/render.js +2 -0
  83. package/dist/shared/types/render.js.map +1 -0
  84. package/dist/shared/types/screen.d.ts +95 -0
  85. package/dist/shared/types/screen.d.ts.map +1 -0
  86. package/dist/shared/types/screen.js +2 -0
  87. package/dist/shared/types/screen.js.map +1 -0
  88. package/dist/shared/types/theme.d.ts +48 -0
  89. package/dist/shared/types/theme.d.ts.map +1 -0
  90. package/dist/shared/types/theme.js +2 -0
  91. package/dist/shared/types/theme.js.map +1 -0
  92. package/package.json +58 -0
  93. package/src/native/README.md +17 -0
  94. package/src/native/context.tsx +74 -0
  95. package/src/native/index.ts +39 -0
  96. package/src/native/primitives.tsx +730 -0
  97. package/src/native/screen.tsx +831 -0
  98. package/src/react/README.md +7 -0
  99. package/src/react/context.tsx +83 -0
  100. package/src/react/index.ts +42 -0
  101. package/src/react/primitives.tsx +589 -0
  102. package/src/react/screen.tsx +633 -0
  103. package/src/react/styles.css +299 -0
  104. package/src/shared/README.md +9 -0
  105. package/src/shared/messages.ts +99 -0
  106. package/src/shared/render.ts +12 -0
  107. package/src/shared/theme.ts +27 -0
  108. package/src/shared/types/board.ts +48 -0
  109. package/src/shared/types/comment.ts +101 -0
  110. package/src/shared/types/context.ts +81 -0
  111. package/src/shared/types/entry.ts +48 -0
  112. package/src/shared/types/form.ts +27 -0
  113. package/src/shared/types/helpers.ts +1 -0
  114. package/src/shared/types/index.ts +45 -0
  115. package/src/shared/types/messages.ts +160 -0
  116. package/src/shared/types/render.ts +12 -0
  117. package/src/shared/types/screen.ts +123 -0
  118. package/src/shared/types/theme.ts +61 -0
@@ -0,0 +1,303 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createContext, useContext, useMemo } from "react";
3
+ import { Pressable, ScrollView, Text, TextInput, View, } from "react-native";
4
+ import { SafeAreaView, } from "react-native-safe-area-context";
5
+ import { FeedbackNativeThemeScope, useFeedbackUi } from "./context.js";
6
+ function combineStyle(enabled, fallback, style) {
7
+ return enabled ? [fallback, style] : style;
8
+ }
9
+ function BoardRoot({ primaryColor, backgroundColor, surfaceColor, textColor, mutedColor, borderColor, dangerColor, children, style, ...props }) {
10
+ const { theme, unstyled } = useFeedbackUi();
11
+ const colorOverrides = useMemo(() => ({
12
+ ...(primaryColor === undefined ? {} : { primary: primaryColor }),
13
+ ...(backgroundColor === undefined ? {} : { background: backgroundColor }),
14
+ ...(surfaceColor === undefined ? {} : { surface: surfaceColor }),
15
+ ...(textColor === undefined ? {} : { text: textColor }),
16
+ ...(mutedColor === undefined ? {} : { mutedText: mutedColor }),
17
+ ...(borderColor === undefined ? {} : { border: borderColor }),
18
+ ...(dangerColor === undefined ? {} : { danger: dangerColor }),
19
+ }), [
20
+ backgroundColor,
21
+ borderColor,
22
+ dangerColor,
23
+ mutedColor,
24
+ primaryColor,
25
+ surfaceColor,
26
+ textColor,
27
+ ]);
28
+ const background = backgroundColor ?? theme.colors.background;
29
+ return (_jsx(FeedbackNativeThemeScope, { colors: colorOverrides, children: _jsx(SafeAreaView, { ...props, style: combineStyle(!unstyled, {
30
+ flex: 1,
31
+ gap: theme.spacing,
32
+ padding: theme.spacing,
33
+ backgroundColor: background,
34
+ }, style), children: children }) }));
35
+ }
36
+ function BoardHeader({ style, ...props }) {
37
+ const { theme, unstyled } = useFeedbackUi();
38
+ return (_jsx(View, { ...props, style: combineStyle(!unstyled, { gap: theme.spacing }, style) }));
39
+ }
40
+ function BoardTitle({ style, children, ...props }) {
41
+ const { messages, theme, unstyled } = useFeedbackUi();
42
+ return (_jsx(Text, { ...props, style: combineStyle(!unstyled, { color: theme.colors.text, fontSize: 24, fontWeight: "700" }, style), children: children ?? messages.board.title }));
43
+ }
44
+ function BoardSearch({ value, onValueChange, children, style, ...props }) {
45
+ const { messages, theme, unstyled } = useFeedbackUi();
46
+ const state = { value, setValue: onValueChange };
47
+ if (typeof children === "function")
48
+ return _jsx(_Fragment, { children: children(state) });
49
+ return (_jsx(TextInput, { ...props, value: value, onChangeText: onValueChange, placeholder: props.placeholder ?? messages.board.searchPlaceholder, placeholderTextColor: props.placeholderTextColor ?? theme.colors.mutedText, style: combineStyle(!unstyled, {
50
+ color: theme.colors.text,
51
+ borderWidth: 1,
52
+ borderColor: theme.colors.border,
53
+ borderRadius: Math.max(8, theme.radius - 2),
54
+ paddingHorizontal: 12,
55
+ paddingVertical: 10,
56
+ backgroundColor: theme.colors.surface,
57
+ }, style) }));
58
+ }
59
+ function BoardList({ style, ...props }) {
60
+ const { theme, unstyled } = useFeedbackUi();
61
+ return (_jsx(ScrollView, { keyboardShouldPersistTaps: "handled", contentInsetAdjustmentBehavior: "automatic", automaticallyAdjustKeyboardInsets: true, style: { flex: 1 }, ...props, contentContainerStyle: combineStyle(!unstyled, { gap: Math.max(8, theme.spacing - 2) }, style) }));
62
+ }
63
+ export const FeedbackBoard = {
64
+ Root: BoardRoot,
65
+ Header: BoardHeader,
66
+ Title: BoardTitle,
67
+ Search: BoardSearch,
68
+ List: BoardList,
69
+ };
70
+ const EntryContext = createContext(null);
71
+ function useEntryContext() {
72
+ const value = useContext(EntryContext);
73
+ if (value === null)
74
+ throw new Error("FeedbackEntry compound must be inside FeedbackEntry.Root.");
75
+ return value;
76
+ }
77
+ function EntryRoot({ entry, style, ...props }) {
78
+ const { theme, unstyled } = useFeedbackUi();
79
+ return (_jsx(EntryContext.Provider, { value: entry, children: _jsx(View, { ...props, style: combineStyle(!unstyled, {
80
+ flexDirection: "row",
81
+ gap: 12,
82
+ padding: 12,
83
+ borderWidth: 1,
84
+ borderColor: theme.colors.border,
85
+ borderRadius: theme.radius,
86
+ backgroundColor: theme.colors.surface,
87
+ }, style) }) }));
88
+ }
89
+ function EntryUpvote({ onToggle, children, primaryColor, style, accessibilityLabel, ...props }) {
90
+ const entry = useEntryContext();
91
+ const { theme, unstyled, messages } = useFeedbackUi();
92
+ const activeColor = primaryColor ?? theme.colors.primary;
93
+ const toggle = () => onToggle(!entry.viewerHasUpvoted);
94
+ const state = {
95
+ entry,
96
+ active: entry.viewerHasUpvoted,
97
+ count: entry.upvoteCount,
98
+ toggle,
99
+ };
100
+ if (typeof children === "function")
101
+ return _jsx(_Fragment, { children: children(state) });
102
+ return (_jsx(Pressable, { ...props, accessibilityLabel: accessibilityLabel ??
103
+ (entry.viewerHasUpvoted
104
+ ? messages.entry.removeUpvote
105
+ : messages.entry.upvote), onPress: toggle, style: combineStyle(!unstyled, {
106
+ width: 48,
107
+ minHeight: 54,
108
+ alignItems: "center",
109
+ justifyContent: "center",
110
+ borderWidth: 1,
111
+ borderColor: entry.viewerHasUpvoted
112
+ ? activeColor
113
+ : theme.colors.border,
114
+ borderRadius: 10,
115
+ backgroundColor: theme.colors.surfaceMuted,
116
+ }, style), children: children ?? (_jsxs(_Fragment, { children: [_jsx(Text, { style: {
117
+ color: entry.viewerHasUpvoted
118
+ ? activeColor
119
+ : theme.colors.mutedText,
120
+ }, children: "\u25B2" }), _jsx(Text, { style: {
121
+ color: entry.viewerHasUpvoted ? activeColor : theme.colors.text,
122
+ fontWeight: "700",
123
+ }, children: entry.upvoteCount })] })) }));
124
+ }
125
+ function EntryKind({ style, children, ...props }) {
126
+ const entry = useEntryContext();
127
+ const { messages, theme, unstyled } = useFeedbackUi();
128
+ return (_jsx(Text, { ...props, style: combineStyle(!unstyled, {
129
+ color: theme.colors.mutedText,
130
+ fontSize: 12,
131
+ fontWeight: "600",
132
+ }, style), children: children ?? messages.kinds[entry.kind] }));
133
+ }
134
+ function EntryContent({ style, ...props }) {
135
+ return _jsx(View, { ...props, style: [{ flex: 1, minWidth: 0 }, style] });
136
+ }
137
+ function EntryTitle({ style, children, ...props }) {
138
+ const entry = useEntryContext();
139
+ const { theme, unstyled } = useFeedbackUi();
140
+ return (_jsx(Text, { ...props, style: combineStyle(!unstyled, { color: theme.colors.text, fontWeight: "700", fontSize: 16 }, style), children: children ?? entry.title }));
141
+ }
142
+ function EntryBody({ style, children, ...props }) {
143
+ const entry = useEntryContext();
144
+ const { theme, unstyled } = useFeedbackUi();
145
+ return (_jsx(Text, { ...props, style: combineStyle(!unstyled, { color: theme.colors.mutedText, lineHeight: 20 }, style), children: children ?? entry.body }));
146
+ }
147
+ function EntryStatus({ style, children, ...props }) {
148
+ const entry = useEntryContext();
149
+ const { messages, theme, unstyled } = useFeedbackUi();
150
+ return (_jsx(Text, { ...props, style: combineStyle(!unstyled, { color: theme.colors.mutedText, fontSize: 12, fontWeight: "600" }, style), children: children ?? messages.statuses[entry.status] }));
151
+ }
152
+ function EntryCommentCount({ style, children, ...props }) {
153
+ const entry = useEntryContext();
154
+ const { messages, theme, unstyled } = useFeedbackUi();
155
+ return (_jsx(Text, { ...props, style: combineStyle(!unstyled, { color: theme.colors.mutedText, fontSize: 12 }, style), children: children ?? messages.entry.comments(entry.commentCount) }));
156
+ }
157
+ export const FeedbackEntry = {
158
+ Root: EntryRoot,
159
+ Upvote: EntryUpvote,
160
+ Content: EntryContent,
161
+ Kind: EntryKind,
162
+ Title: EntryTitle,
163
+ Body: EntryBody,
164
+ Status: EntryStatus,
165
+ CommentCount: EntryCommentCount,
166
+ };
167
+ const CommentContext = createContext(null);
168
+ function useCommentContext() {
169
+ const value = useContext(CommentContext);
170
+ if (value === null)
171
+ throw new Error("Comment compound must be inside Comment.Root.");
172
+ return value;
173
+ }
174
+ function CommentRoot({ comment, style, ...props }) {
175
+ const { theme, unstyled } = useFeedbackUi();
176
+ return (_jsx(CommentContext.Provider, { value: comment, children: _jsx(View, { ...props, style: combineStyle(!unstyled, {
177
+ gap: 7,
178
+ padding: 10,
179
+ borderWidth: 1,
180
+ borderColor: theme.colors.border,
181
+ borderRadius: Math.max(8, theme.radius - 2),
182
+ backgroundColor: theme.colors.surface,
183
+ }, style) }) }));
184
+ }
185
+ function CommentBody({ style, children, ...props }) {
186
+ const comment = useCommentContext();
187
+ const { messages, theme, unstyled } = useFeedbackUi();
188
+ return (_jsx(Text, { ...props, style: combineStyle(!unstyled, {
189
+ color: comment.body === null ? theme.colors.mutedText : theme.colors.text,
190
+ lineHeight: 20,
191
+ }, style), children: children ?? comment.body ?? messages.comments.deleted }));
192
+ }
193
+ function CommentLike({ onToggle, children, primaryColor, style, accessibilityLabel, ...props }) {
194
+ const comment = useCommentContext();
195
+ const { theme, unstyled, messages } = useFeedbackUi();
196
+ const color = primaryColor ?? theme.colors.primary;
197
+ const toggle = () => onToggle(!comment.viewerHasLiked);
198
+ const state = {
199
+ comment,
200
+ active: comment.viewerHasLiked,
201
+ count: comment.likeCount,
202
+ toggle,
203
+ };
204
+ if (typeof children === "function")
205
+ return _jsx(_Fragment, { children: children(state) });
206
+ return (_jsx(Pressable, { ...props, accessibilityLabel: accessibilityLabel ??
207
+ props["aria-label"] ??
208
+ (comment.viewerHasLiked
209
+ ? messages.comments.unlike
210
+ : messages.comments.like), onPress: toggle, style: combineStyle(!unstyled, {
211
+ flexDirection: "row",
212
+ gap: 4,
213
+ alignItems: "center",
214
+ paddingVertical: 4,
215
+ paddingHorizontal: 5,
216
+ }, style), children: children ?? (_jsxs(_Fragment, { children: [_jsx(Text, { style: {
217
+ color: comment.viewerHasLiked ? color : theme.colors.mutedText,
218
+ }, children: comment.viewerHasLiked ? "♥" : "♡" }), _jsx(Text, { style: {
219
+ color: comment.viewerHasLiked ? color : theme.colors.mutedText,
220
+ fontSize: 12,
221
+ }, children: comment.likeCount })] })) }));
222
+ }
223
+ function CommentReply({ onActivate, children, style, ...props }) {
224
+ const comment = useCommentContext();
225
+ const { messages, theme, unstyled } = useFeedbackUi();
226
+ const state = { comment, activate: onActivate };
227
+ if (typeof children === "function")
228
+ return _jsx(_Fragment, { children: children(state) });
229
+ return (_jsx(Pressable, { ...props, onPress: onActivate, style: combineStyle(!unstyled, { padding: 5 }, style), children: _jsx(Text, { style: { color: theme.colors.mutedText, fontSize: 12 }, children: children ?? messages.comments.reply }) }));
230
+ }
231
+ function CommentRepliesButton({ expanded, onExpandedChange, children, style, ...props }) {
232
+ const comment = useCommentContext();
233
+ const { messages, theme, unstyled } = useFeedbackUi();
234
+ const activate = () => onExpandedChange(!expanded);
235
+ const state = { comment, expanded, count: comment.replyCount, activate };
236
+ if (typeof children === "function")
237
+ return _jsx(_Fragment, { children: children(state) });
238
+ if (comment.replyCount === 0)
239
+ return null;
240
+ return (_jsx(Pressable, { ...props, onPress: activate, style: combineStyle(!unstyled, { padding: 5 }, style), children: _jsx(Text, { style: { color: theme.colors.primary, fontSize: 12, fontWeight: "600" }, children: children ??
241
+ (expanded
242
+ ? messages.comments.hideReplies
243
+ : messages.comments.viewReplies(comment.replyCount)) }) }));
244
+ }
245
+ function CommentChildren({ style, ...props }) {
246
+ const { theme, unstyled } = useFeedbackUi();
247
+ return (_jsx(View, { ...props, style: combineStyle(!unstyled, {
248
+ gap: 8,
249
+ marginLeft: 14,
250
+ paddingLeft: 10,
251
+ borderLeftWidth: 2,
252
+ borderLeftColor: theme.colors.border,
253
+ }, style) }));
254
+ }
255
+ export const Comment = {
256
+ Root: CommentRoot,
257
+ Body: CommentBody,
258
+ Like: CommentLike,
259
+ Reply: CommentReply,
260
+ RepliesButton: CommentRepliesButton,
261
+ Children: CommentChildren,
262
+ };
263
+ function FormRoot({ style, ...props }) {
264
+ const { unstyled } = useFeedbackUi();
265
+ return (_jsx(View, { ...props, style: combineStyle(!unstyled, { gap: 9 }, style) }));
266
+ }
267
+ function FormInput({ style, ...props }) {
268
+ const { theme, unstyled } = useFeedbackUi();
269
+ return (_jsx(TextInput, { ...props, placeholderTextColor: props.placeholderTextColor ?? theme.colors.mutedText, style: combineStyle(!unstyled, {
270
+ color: theme.colors.text,
271
+ borderWidth: 1,
272
+ borderColor: theme.colors.border,
273
+ borderRadius: Math.max(8, theme.radius - 2),
274
+ paddingHorizontal: 11,
275
+ paddingVertical: 9,
276
+ backgroundColor: theme.colors.surface,
277
+ }, style) }));
278
+ }
279
+ function FormTextarea({ style, ...props }) {
280
+ return (_jsx(FormInput, { ...props, multiline: true, textAlignVertical: props.textAlignVertical ?? "top", style: [{ minHeight: 90 }, style] }));
281
+ }
282
+ function FormSubmit({ submitting = false, children, primaryColor, disabled, style, ...props }) {
283
+ const { messages, theme, unstyled } = useFeedbackUi();
284
+ const state = { submitting };
285
+ if (typeof children === "function")
286
+ return _jsx(_Fragment, { children: children(state) });
287
+ return (_jsx(Pressable, { ...props, disabled: disabled ?? submitting, style: combineStyle(!unstyled, {
288
+ minHeight: 42,
289
+ alignItems: "center",
290
+ justifyContent: "center",
291
+ borderRadius: Math.max(8, theme.radius - 2),
292
+ paddingHorizontal: 12,
293
+ backgroundColor: primaryColor ?? theme.colors.primary,
294
+ opacity: (disabled ?? submitting) ? 0.55 : 1,
295
+ }, style), children: _jsx(Text, { style: { color: "#ffffff", fontWeight: "700" }, children: children ?? messages.form.submit }) }));
296
+ }
297
+ export const FeedbackForm = {
298
+ Root: FormRoot,
299
+ Input: FormInput,
300
+ Textarea: FormTextarea,
301
+ Submit: FormSubmit,
302
+ };
303
+ //# sourceMappingURL=primitives.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primitives.js","sourceRoot":"","sources":["../../src/native/primitives.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC3D,OAAO,EACL,SAAS,EACT,UAAU,EACV,IAAI,EACJ,SAAS,EACT,IAAI,GASL,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,YAAY,GAEb,MAAM,gCAAgC,CAAC;AAiBxC,OAAO,EAAE,wBAAwB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEvE,SAAS,YAAY,CACnB,OAAgB,EAChB,QAAsB,EACtB,KAAmB;IAEnB,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AAC7C,CAAC;AAOD,SAAS,SAAS,CAAC,EACjB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,SAAS,EACT,UAAU,EACV,WAAW,EACX,WAAW,EACX,QAAQ,EACR,KAAK,EACL,GAAG,KAAK,EACO;IACf,MAAM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I,OAAO,QAAQ,KAAK,UAAU;QAAE,OAAO,4BAAG,QAAQ,CAAC,KAAK,CAAC,GAAI,CAAC;IAClE,OAAO,CACL,KAAC,SAAS,OACJ,KAAK,EACT,QAAQ,EAAE,QAAQ,IAAI,UAAU,EAChC,KAAK,EAAE,YAAY,CACjB,CAAC,QAAQ,EACT;YACE,SAAS,EAAE,EAAE;YACb,UAAU,EAAE,QAAQ;YACpB,cAAc,EAAE,QAAQ;YACxB,YAAY,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YAC3C,iBAAiB,EAAE,EAAE;YACrB,eAAe,EAAE,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO;YACrD,OAAO,EAAE,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAC7C,EACD,KAAK,CACN,YAED,KAAC,IAAI,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,YACjD,QAAQ,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,GAC5B,GACG,CACb,CAAC;AACJ,CAAC;AACD,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,QAAQ;IACd,KAAK,EAAE,SAAS;IAChB,QAAQ,EAAE,YAAY;IACtB,MAAM,EAAE,UAAU;CACnB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { FeedbackScreenRootProps } from "../shared/types";
2
+ export declare function FeedbackScreen({ hooks, messages, theme, unstyled, entrySort, commentSort, enabledKinds, maxCommentDepth, transformComments, renderActor, ...colors }: FeedbackScreenRootProps): import("react").JSX.Element;
3
+ //# sourceMappingURL=screen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen.d.ts","sourceRoot":"","sources":["../../src/native/screen.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAOV,uBAAuB,EACxB,MAAM,iBAAiB,CAAC;AAmBzB,wBAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,SAAiB,EACjB,WAAmB,EACnB,YAAoB,EACpB,eAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,GAAG,MAAM,EACV,EAAE,uBAAuB,+BAezB"}
@@ -0,0 +1,284 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useMemo, useState } from "react";
3
+ import { ActivityIndicator, Alert, Modal, Platform, Pressable, ScrollView, Text, View, } from "react-native";
4
+ import { FeedbackProvider, useFeedbackUi } from "./context.js";
5
+ import { Comment, FeedbackBoard, FeedbackEntry, FeedbackForm, } from "./primitives.js";
6
+ const kinds = [
7
+ "feedback",
8
+ "feature_request",
9
+ "bug_report",
10
+ ];
11
+ const isIos26OrNewer = Platform.OS === "ios" &&
12
+ Number.parseInt(String(Platform.Version).split(".")[0] ?? "0", 10) >= 26;
13
+ export function FeedbackScreen({ hooks, messages, theme, unstyled, entrySort = "top", commentSort = "top", enabledKinds = kinds, maxCommentDepth = 5, transformComments, renderActor, ...colors }) {
14
+ return (_jsx(FeedbackProvider, { messages: messages, theme: theme, unstyled: unstyled, children: _jsx(ScreenBody, { hooks: hooks, entrySort: entrySort, commentSort: commentSort, enabledKinds: enabledKinds, maxCommentDepth: maxCommentDepth, transformComments: transformComments, renderActor: renderActor, ...colors }) }));
15
+ }
16
+ function ScreenBody({ hooks, entrySort, commentSort, enabledKinds, maxCommentDepth, transformComments, renderActor, ...colors }) {
17
+ const { messages, theme } = useFeedbackUi();
18
+ const [query, setQuery] = useState("");
19
+ const [selectedEntryId, setSelectedEntryId] = useState(null);
20
+ const [showForm, setShowForm] = useState(false);
21
+ const list = hooks.useEntries({ sort: entrySort, kinds: enabledKinds });
22
+ const search = hooks.useSearchEntries({
23
+ searchQuery: query,
24
+ kinds: enabledKinds,
25
+ });
26
+ if (selectedEntryId !== null) {
27
+ return (_jsx(FeedbackBoard.Root, { ...colors, children: _jsx(EntryDetail, { hooks: hooks, entryId: selectedEntryId, onBack: () => setSelectedEntryId(null), commentSort: commentSort, maxCommentDepth: maxCommentDepth, transformComments: transformComments, renderActor: renderActor }) }));
28
+ }
29
+ const searching = query.trim().length > 0;
30
+ const entries = searching ? search : list.results;
31
+ return (_jsxs(_Fragment, { children: [_jsxs(FeedbackBoard.Root, { ...colors, children: [_jsxs(FeedbackBoard.Header, { children: [_jsx(FeedbackBoard.Title, {}), _jsx(Text, { style: { color: theme.colors.mutedText }, children: messages.board.subtitle }), _jsx(Pressable, { onPress: () => setShowForm(true), style: {
32
+ alignSelf: "flex-start",
33
+ paddingVertical: 9,
34
+ paddingHorizontal: 12,
35
+ borderRadius: 9,
36
+ backgroundColor: theme.colors.primary,
37
+ }, children: _jsx(Text, { style: { color: "#ffffff", fontWeight: "700" }, children: messages.board.createEntry }) })] }), _jsx(FeedbackBoard.Search, { value: query, onValueChange: setQuery }), _jsx(FeedbackBoard.List, { children: (entries ?? []).map((entry) => (_jsx(EntryCard, { entry: entry, hooks: hooks, onOpen: () => setSelectedEntryId(entry.id) }, entry.id))) }), !searching && list.status === "CanLoadMore" ? (_jsx(NativeButton, { label: messages.board.loadMore, onPress: () => list.loadMore(hooks.pageSizes.entries) })) : null] }), showForm ? (_jsx(CreateEntryModal, { hooks: hooks, enabledKinds: enabledKinds, onRequestClose: () => setShowForm(false), onCreated: (id) => {
38
+ setShowForm(false);
39
+ setSelectedEntryId(id);
40
+ } })) : null] }));
41
+ }
42
+ function NativeButton({ label, onPress, }) {
43
+ const { theme } = useFeedbackUi();
44
+ return (_jsx(Pressable, { onPress: onPress, style: {
45
+ alignSelf: "flex-start",
46
+ paddingVertical: 8,
47
+ paddingHorizontal: 11,
48
+ borderRadius: 8,
49
+ borderWidth: 1,
50
+ borderColor: theme.colors.border,
51
+ }, children: _jsx(Text, { style: { color: theme.colors.text, fontWeight: "600" }, children: label }) }));
52
+ }
53
+ function EntryCard({ entry, hooks, onOpen }) {
54
+ const setUpvote = hooks.useSetEntryUpvote();
55
+ return (_jsxs(FeedbackEntry.Root, { entry: entry, children: [_jsx(FeedbackEntry.Upvote, { onToggle: (active) => void setUpvote({ entryId: entry.id, desiredState: active }) }), _jsxs(Pressable, { onPress: onOpen, style: { flex: 1, gap: 4 }, children: [_jsxs(View, { style: {
56
+ flexDirection: "row",
57
+ alignItems: "center",
58
+ justifyContent: "space-between",
59
+ gap: 8,
60
+ }, children: [_jsx(FeedbackEntry.Kind, {}), _jsx(FeedbackEntry.Status, {})] }), _jsx(FeedbackEntry.Title, {}), _jsx(FeedbackEntry.Body, { numberOfLines: 3 }), _jsx(FeedbackEntry.CommentCount, {})] })] }));
61
+ }
62
+ function CreateEntryModal({ hooks, enabledKinds, onRequestClose, onCreated, }) {
63
+ const { messages, theme } = useFeedbackUi();
64
+ const isIos = Platform.OS === "ios";
65
+ const [previewEntryId, setPreviewEntryId] = useState(null);
66
+ const [kind, setKind] = useState(enabledKinds[0] ?? "feedback");
67
+ const [title, setTitle] = useState("");
68
+ const [body, setBody] = useState("");
69
+ return (_jsx(Modal, { visible: true, animationType: "slide", presentationStyle: isIos ? "formSheet" : "overFullScreen", transparent: !isIos, allowSwipeDismissal: isIos, onRequestClose: onRequestClose, ...(isIos
70
+ ? {
71
+ backdropColor: isIos26OrNewer
72
+ ? "transparent"
73
+ : theme.colors.background,
74
+ }
75
+ : {}), children: _jsxs(View, { style: isIos
76
+ ? {
77
+ flex: 1,
78
+ backgroundColor: isIos26OrNewer
79
+ ? "transparent"
80
+ : theme.colors.background,
81
+ }
82
+ : {
83
+ flex: 1,
84
+ justifyContent: "flex-end",
85
+ backgroundColor: "rgba(0, 0, 0, 0.35)",
86
+ }, children: [!isIos ? (_jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: messages.form.cancel, onPress: onRequestClose, style: {
87
+ position: "absolute",
88
+ top: 0,
89
+ right: 0,
90
+ bottom: 0,
91
+ left: 0,
92
+ } })) : null, _jsxs(View, { style: isIos
93
+ ? {
94
+ flex: 1,
95
+ backgroundColor: "transparent",
96
+ }
97
+ : {
98
+ maxHeight: "92%",
99
+ minHeight: 360,
100
+ overflow: "hidden",
101
+ borderTopLeftRadius: theme.radius * 2,
102
+ borderTopRightRadius: theme.radius * 2,
103
+ backgroundColor: theme.colors.background,
104
+ }, children: [_jsxs(View, { style: {
105
+ flexDirection: "row",
106
+ alignItems: "center",
107
+ justifyContent: "space-between",
108
+ paddingHorizontal: 16,
109
+ paddingVertical: 14,
110
+ borderBottomWidth: 1,
111
+ borderBottomColor: theme.colors.border,
112
+ }, children: [_jsx(Text, { style: {
113
+ color: theme.colors.text,
114
+ fontSize: 18,
115
+ fontWeight: "700",
116
+ }, children: messages.board.createEntry }), _jsx(Pressable, { accessibilityRole: "button", onPress: onRequestClose, hitSlop: 8, children: _jsx(Text, { style: {
117
+ color: theme.colors.primary,
118
+ fontWeight: "600",
119
+ }, children: messages.form.cancel }) })] }), _jsx(ScrollView, { keyboardShouldPersistTaps: "handled", keyboardDismissMode: isIos ? "interactive" : "on-drag", contentInsetAdjustmentBehavior: "automatic", contentContainerStyle: {
120
+ padding: 16,
121
+ paddingBottom: 32,
122
+ }, children: previewEntryId !== null ? (_jsx(EntryDetail, { hooks: hooks, entryId: previewEntryId, onBack: () => setPreviewEntryId(null), commentSort: "top", maxCommentDepth: 5 })) : (_jsx(CreateForm, { hooks: hooks, enabledKinds: enabledKinds, kind: kind, onKindChange: setKind, title: title, onTitleChange: setTitle, body: body, onBodyChange: setBody, onCreated: onCreated, onOpenSuggestion: setPreviewEntryId })) })] })] }) }));
123
+ }
124
+ function CreateForm({ hooks, enabledKinds, kind, onKindChange, title, onTitleChange, body, onBodyChange, onCreated, onOpenSuggestion, }) {
125
+ const { messages, theme } = useFeedbackUi();
126
+ const [submitting, setSubmitting] = useState(false);
127
+ const create = hooks.useCreateEntry();
128
+ const similar = hooks.useSimilarEntries({ title, body, kind, limit: 3 });
129
+ const suggestions = useMemo(() => {
130
+ if (similar === undefined)
131
+ return [];
132
+ return [...similar.exact, ...similar.similar];
133
+ }, [similar]);
134
+ const submit = async () => {
135
+ if (submitting || title.trim().length === 0 || body.trim().length === 0) {
136
+ return;
137
+ }
138
+ setSubmitting(true);
139
+ try {
140
+ onCreated(await create({ kind, title, body }));
141
+ }
142
+ finally {
143
+ setSubmitting(false);
144
+ }
145
+ };
146
+ const requestSubmit = () => {
147
+ if (submitting ||
148
+ similar === undefined ||
149
+ title.trim().length === 0 ||
150
+ body.trim().length === 0) {
151
+ return;
152
+ }
153
+ if (suggestions.length === 0) {
154
+ void submit();
155
+ return;
156
+ }
157
+ Alert.alert(similar.exact.length > 0
158
+ ? messages.form.exactDuplicate
159
+ : messages.form.possibleDuplicates, messages.form.duplicateWarning, [
160
+ {
161
+ text: messages.form.cancel,
162
+ style: "cancel",
163
+ },
164
+ {
165
+ text: messages.form.submitAnyway,
166
+ onPress: () => {
167
+ void submit();
168
+ },
169
+ },
170
+ ]);
171
+ };
172
+ return (_jsxs(FeedbackForm.Root, { children: [_jsx(Text, { style: { color: theme.colors.text, fontWeight: "600" }, children: messages.form.kind }), _jsx(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: 7 }, children: enabledKinds.map((value) => (_jsx(Pressable, { onPress: () => onKindChange(value), style: {
173
+ paddingVertical: 6,
174
+ paddingHorizontal: 9,
175
+ borderRadius: 999,
176
+ borderWidth: 1,
177
+ borderColor: value === kind ? theme.colors.primary : theme.colors.border,
178
+ }, children: _jsx(Text, { style: {
179
+ color: value === kind
180
+ ? theme.colors.primary
181
+ : theme.colors.mutedText,
182
+ }, children: messages.kinds[value] }) }, value))) }), _jsx(FeedbackForm.Input, { value: title, onChangeText: onTitleChange, placeholder: messages.form.titlePlaceholder }), _jsx(FeedbackForm.Textarea, { value: body, onChangeText: onBodyChange, placeholder: messages.form.bodyPlaceholder }), suggestions.length > 0 ? (_jsxs(View, { style: {
183
+ gap: 8,
184
+ padding: 10,
185
+ borderWidth: 1,
186
+ borderColor: theme.colors.border,
187
+ borderRadius: theme.radius,
188
+ backgroundColor: theme.colors.surfaceMuted,
189
+ }, children: [_jsx(Text, { style: {
190
+ color: theme.colors.text,
191
+ fontWeight: "600",
192
+ }, children: similar?.exact.length
193
+ ? messages.form.exactDuplicate
194
+ : messages.form.possibleDuplicates }), suggestions.map((entry) => (_jsxs(Pressable, { onPress: () => onOpenSuggestion(entry.id), style: {
195
+ gap: 4,
196
+ padding: 10,
197
+ borderWidth: 1,
198
+ borderColor: theme.colors.border,
199
+ borderRadius: Math.max(8, theme.radius - 2),
200
+ backgroundColor: theme.colors.surface,
201
+ }, children: [_jsxs(View, { style: {
202
+ flexDirection: "row",
203
+ alignItems: "center",
204
+ justifyContent: "space-between",
205
+ gap: 8,
206
+ }, children: [_jsx(Text, { style: {
207
+ flexShrink: 1,
208
+ color: theme.colors.mutedText,
209
+ fontSize: 12,
210
+ fontWeight: "600",
211
+ }, children: messages.kinds[entry.kind] }), _jsx(Text, { style: {
212
+ color: theme.colors.mutedText,
213
+ fontSize: 12,
214
+ }, children: messages.statuses[entry.status] })] }), _jsx(Text, { numberOfLines: 2, style: {
215
+ color: theme.colors.text,
216
+ fontWeight: "700",
217
+ }, children: entry.title }), _jsx(Text, { numberOfLines: 2, style: {
218
+ color: theme.colors.mutedText,
219
+ lineHeight: 18,
220
+ }, children: entry.body }), _jsxs(Text, { style: {
221
+ color: theme.colors.mutedText,
222
+ fontSize: 12,
223
+ }, children: ["\u25B2 ", entry.upvoteCount, " \u00B7", " ", messages.entry.comments(entry.commentCount)] })] }, entry.id)))] })) : null, _jsx(FeedbackForm.Submit, { submitting: submitting, onPress: requestSubmit })] }));
224
+ }
225
+ function EntryDetail({ hooks, entryId, onBack, commentSort, maxCommentDepth, transformComments, renderActor, }) {
226
+ const { messages, theme } = useFeedbackUi();
227
+ const entry = hooks.useEntry(entryId);
228
+ const comments = hooks.useComments({ entryId, sort: commentSort });
229
+ const setUpvote = hooks.useSetEntryUpvote();
230
+ const createComment = hooks.useCreateComment();
231
+ const [body, setBody] = useState("");
232
+ const visible = useMemo(() => transformComments?.(comments.results) ?? comments.results, [comments.results, transformComments]);
233
+ if (entry === undefined)
234
+ return (_jsxs(View, { style: {
235
+ flex: 1,
236
+ gap: 8,
237
+ alignItems: "center",
238
+ justifyContent: "center",
239
+ }, children: [_jsx(ActivityIndicator, { size: "large" }), _jsx(Text, { style: { color: theme.colors.mutedText }, children: messages.board.loading })] }));
240
+ if (entry === null)
241
+ return _jsx(NativeButton, { label: messages.entry.back, onPress: onBack });
242
+ return (_jsxs(View, { style: { gap: 12 }, children: [_jsx(NativeButton, { label: messages.entry.back, onPress: onBack }), _jsxs(FeedbackEntry.Root, { entry: entry, children: [_jsx(FeedbackEntry.Upvote, { onToggle: (active) => void setUpvote({ entryId, desiredState: active }) }), _jsxs(FeedbackEntry.Content, { style: { gap: 5 }, children: [_jsx(FeedbackEntry.Status, {}), _jsx(FeedbackEntry.Title, {}), _jsx(FeedbackEntry.Body, {}), _jsx(FeedbackEntry.CommentCount, {})] })] }), _jsx(Text, { style: { color: theme.colors.text, fontSize: 18, fontWeight: "700" }, children: messages.comments.title }), _jsxs(FeedbackForm.Root, { children: [_jsx(FeedbackForm.Textarea, { value: body, onChangeText: setBody, placeholder: messages.comments.placeholder }), _jsx(FeedbackForm.Submit, { onPress: async () => {
243
+ if (body.trim().length === 0)
244
+ return;
245
+ await createComment({ entryId, body });
246
+ setBody("");
247
+ }, children: messages.comments.submit })] }), _jsx(View, { style: { gap: 8 }, children: visible.map((comment) => (_jsx(CommentBranch, { comment: comment, entryId: entryId, hooks: hooks, commentSort: commentSort, maxCommentDepth: maxCommentDepth, transformComments: transformComments, renderActor: renderActor }, comment.id))) }), comments.status === "CanLoadMore" ? (_jsx(NativeButton, { label: messages.comments.loadMore, onPress: () => comments.loadMore(hooks.pageSizes.comments) })) : null] }));
248
+ }
249
+ function CommentBranch({ comment, entryId, hooks, commentSort, maxCommentDepth, transformComments, renderActor, }) {
250
+ const { messages, theme } = useFeedbackUi();
251
+ const [expanded, setExpanded] = useState(false);
252
+ const [replying, setReplying] = useState(false);
253
+ const [replyBody, setReplyBody] = useState("");
254
+ const setLike = hooks.useSetCommentLike();
255
+ const createComment = hooks.useCreateComment();
256
+ return (_jsxs(Comment.Root, { comment: comment, children: [renderActor === undefined ? null : (_jsx(View, { children: renderActor(comment.actorId) })), _jsx(Comment.Body, {}), _jsxs(View, { style: {
257
+ flexDirection: "row",
258
+ flexWrap: "wrap",
259
+ alignItems: "center",
260
+ gap: 4,
261
+ }, children: [_jsx(Comment.Like, { onToggle: (active) => void setLike({ commentId: comment.id, desiredState: active }) }), comment.body !== null && comment.depth < maxCommentDepth ? (_jsx(Comment.Reply, { onActivate: () => setReplying((value) => !value) })) : null, _jsx(Comment.RepliesButton, { expanded: expanded, onExpandedChange: setExpanded })] }), replying ? (_jsxs(FeedbackForm.Root, { children: [_jsx(FeedbackForm.Textarea, { value: replyBody, onChangeText: setReplyBody, placeholder: messages.comments.placeholder }), _jsx(FeedbackForm.Submit, { onPress: async () => {
262
+ if (replyBody.trim().length === 0)
263
+ return;
264
+ await createComment({
265
+ entryId,
266
+ parentCommentId: comment.id,
267
+ body: replyBody,
268
+ });
269
+ setReplyBody("");
270
+ setReplying(false);
271
+ setExpanded(true);
272
+ }, children: messages.comments.reply }), _jsx(NativeButton, { label: messages.comments.cancelReply, onPress: () => setReplying(false) })] })) : null, expanded ? (_jsx(ReplyList, { hooks: hooks, entryId: entryId, parentCommentId: comment.id, commentSort: commentSort, maxCommentDepth: maxCommentDepth, transformComments: transformComments, renderActor: renderActor })) : null, comment.deletedAt !== undefined ? (_jsx(Text, { style: { color: theme.colors.mutedText, fontSize: 11 }, children: messages.comments.deleted })) : null] }));
273
+ }
274
+ function ReplyList({ hooks, entryId, parentCommentId, commentSort, maxCommentDepth, transformComments, renderActor, }) {
275
+ const { messages } = useFeedbackUi();
276
+ const replies = hooks.useComments({
277
+ entryId,
278
+ parentCommentId,
279
+ sort: commentSort,
280
+ });
281
+ const visible = useMemo(() => transformComments?.(replies.results) ?? replies.results, [replies.results, transformComments]);
282
+ return (_jsxs(Comment.Children, { children: [visible.map((reply) => (_jsx(CommentBranch, { comment: reply, entryId: entryId, hooks: hooks, commentSort: commentSort, maxCommentDepth: maxCommentDepth, transformComments: transformComments, renderActor: renderActor }, reply.id))), replies.status === "CanLoadMore" ? (_jsx(NativeButton, { label: messages.comments.loadMore, onPress: () => replies.loadMore(hooks.pageSizes.replies) })) : null] }));
283
+ }
284
+ //# sourceMappingURL=screen.js.map