@vvedantb/native-ui 0.17.2 → 0.18.0

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 (220) hide show
  1. package/dist/AlertDialog.jsx +123 -0
  2. package/dist/AmbientBackground.jsx +73 -0
  3. package/dist/ArtifactList.jsx +59 -0
  4. package/dist/Avatar.jsx +285 -0
  5. package/dist/Badge.jsx +154 -0
  6. package/dist/BottomSheetContainer.jsx +208 -0
  7. package/dist/BulkActionBar.jsx +717 -0
  8. package/dist/Button.jsx +344 -0
  9. package/dist/CaptureButton.jsx +104 -0
  10. package/dist/Card.jsx +371 -0
  11. package/dist/Checkbox.jsx +177 -0
  12. package/dist/Chip.jsx +79 -0
  13. package/dist/ColorSwatches.jsx +159 -0
  14. package/dist/ConfirmDialog.jsx +157 -0
  15. package/dist/DateTimeField.jsx +204 -0
  16. package/dist/Dialog.jsx +614 -0
  17. package/dist/DividedList.jsx +120 -0
  18. package/dist/DropdownMenu.jsx +849 -0
  19. package/dist/EmptyState.jsx +434 -0
  20. package/dist/ExpoWebRoot.jsx +134 -0
  21. package/dist/FloatingFAB.jsx +95 -0
  22. package/dist/FloatingSurface.jsx +226 -0
  23. package/dist/FloatingTabBar.jsx +403 -0
  24. package/dist/HeaderIconButton.jsx +53 -0
  25. package/dist/IconButton.jsx +157 -0
  26. package/dist/Input.jsx +96 -0
  27. package/dist/Label.jsx +96 -0
  28. package/dist/LabeledSwitchRow.jsx +170 -0
  29. package/dist/LiquidGlass.jsx +2 -0
  30. package/dist/ListRow.jsx +281 -0
  31. package/dist/LoadingState.jsx +205 -0
  32. package/dist/PageIndicator.jsx +128 -0
  33. package/dist/PageTitle.jsx +205 -0
  34. package/dist/Pager.jsx +105 -0
  35. package/dist/PasswordInput.jsx +120 -0
  36. package/dist/PillTabs.jsx +300 -0
  37. package/dist/PinnedBotTile.jsx +212 -0
  38. package/dist/Progress.jsx +147 -0
  39. package/dist/SafeAreaContainer.jsx +38 -0
  40. package/dist/ScreenContainer.jsx +117 -0
  41. package/dist/SearchInput.jsx +150 -0
  42. package/dist/SectionLabel.jsx +128 -0
  43. package/dist/Select.jsx +223 -0
  44. package/dist/Separator.jsx +95 -0
  45. package/dist/Sheet.jsx +343 -0
  46. package/dist/SheetRow.jsx +198 -0
  47. package/dist/Skeleton.jsx +311 -0
  48. package/dist/Spinner.jsx +195 -0
  49. package/dist/StackPageHeader.jsx +160 -0
  50. package/dist/StatGrid.jsx +74 -0
  51. package/dist/StatusDot.jsx +129 -0
  52. package/dist/SurfaceRow.jsx +143 -0
  53. package/dist/SwipeableRow.jsx +50 -0
  54. package/dist/Switch.jsx +130 -0
  55. package/dist/Tabs.jsx +385 -0
  56. package/dist/Textarea.jsx +103 -0
  57. package/dist/ThemeToggle.jsx +78 -0
  58. package/dist/Toast.jsx +396 -0
  59. package/dist/ai/activity-step-detail.jsx +179 -0
  60. package/dist/ai/activity-step-label.js +816 -0
  61. package/dist/ai/activity-step-types.js +14 -0
  62. package/dist/ai/activity-step.jsx +98 -0
  63. package/dist/ai/activity-tasks-utils.js +172 -0
  64. package/dist/ai/activity-timeline.js +47 -0
  65. package/dist/ai/attachments.jsx +258 -0
  66. package/dist/ai/card-button.jsx +188 -0
  67. package/dist/ai/chain-of-thought.jsx +459 -0
  68. package/dist/ai/chat-jump-rail.jsx +57 -0
  69. package/dist/ai/chat-text.js +44 -0
  70. package/dist/ai/chat-thread.jsx +135 -0
  71. package/dist/ai/choice-question.jsx +925 -0
  72. package/dist/ai/code-block.jsx +574 -0
  73. package/dist/ai/collapsible.jsx +275 -0
  74. package/dist/ai/conversation.jsx +723 -0
  75. package/dist/ai/file-chip.jsx +198 -0
  76. package/dist/ai/icon-button.jsx +179 -0
  77. package/dist/ai/index.js +37 -0
  78. package/dist/ai/message-action-sheet.jsx +408 -0
  79. package/dist/ai/message-quote.jsx +241 -0
  80. package/dist/ai/message.jsx +739 -0
  81. package/dist/ai/prompt-input-menu.jsx +365 -0
  82. package/dist/ai/prompt-input.jsx +626 -0
  83. package/dist/ai/reasoning.jsx +446 -0
  84. package/dist/ai/reply-quote-chip.jsx +278 -0
  85. package/dist/ai/response-text.jsx +130 -0
  86. package/dist/ai/shimmer.jsx +149 -0
  87. package/dist/ai/sources.jsx +260 -0
  88. package/dist/ai/subagent-cards.jsx +645 -0
  89. package/dist/ai/suggestion.jsx +186 -0
  90. package/dist/ai/tool-approval-card.jsx +359 -0
  91. package/dist/ai/trace.jsx +728 -0
  92. package/dist/ai/unified-diff.jsx +280 -0
  93. package/dist/ai/use-streaming-disclosure.js +70 -0
  94. package/dist/auth/AuthProviders.jsx +27 -0
  95. package/dist/auth/AuthScreen.jsx +292 -0
  96. package/dist/auth/GoogleSignInButton.jsx +188 -0
  97. package/dist/auth/SecondFactorScreen.jsx +133 -0
  98. package/dist/auth/SignInScreen.jsx +482 -0
  99. package/dist/auth/authErrors.js +131 -0
  100. package/dist/auth/index.js +11 -0
  101. package/dist/auth/totp.js +378 -0
  102. package/dist/blur.js +36 -0
  103. package/dist/brand/AppIcons.jsx +118 -0
  104. package/dist/brand/AppMark.jsx +128 -0
  105. package/dist/brand/AppWordmark.jsx +138 -0
  106. package/dist/brand/GoogleMark.jsx +71 -0
  107. package/dist/brand/ProviderIcon.jsx +192 -0
  108. package/dist/brand/familyApps.js +33 -0
  109. package/dist/brand/index.js +11 -0
  110. package/dist/brand/svg.js +252 -0
  111. package/dist/brand/vProAppBenefits.js +19 -0
  112. package/dist/cn.js +5 -0
  113. package/dist/colors.js +15 -0
  114. package/dist/configureTheme.js +72 -0
  115. package/dist/controlStyles.js +520 -0
  116. package/dist/definiteSize.js +12 -0
  117. package/dist/dialogLayout.js +18 -0
  118. package/dist/entries/ai.js +4 -0
  119. package/dist/entries/ambient.js +3 -0
  120. package/dist/entries/auth.js +5 -0
  121. package/dist/entries/bottom-sheet.js +2 -0
  122. package/dist/entries/brand.js +2 -0
  123. package/dist/entries/button.js +2 -0
  124. package/dist/entries/date-time.js +3 -0
  125. package/dist/entries/expo-router.js +4 -0
  126. package/dist/entries/expo-web-root.js +3 -0
  127. package/dist/entries/floating.js +7 -0
  128. package/dist/entries/gesture-handler.js +4 -0
  129. package/dist/entries/keyboard-controller.js +4 -0
  130. package/dist/entries/layout.js +16 -0
  131. package/dist/entries/markdown.js +4 -0
  132. package/dist/entries/marketing.js +3 -0
  133. package/dist/entries/page-title.js +7 -0
  134. package/dist/entries/password-input.js +3 -0
  135. package/dist/entries/primitives.js +57 -0
  136. package/dist/entries/search-input.js +3 -0
  137. package/dist/entries/tab-bar.js +4 -0
  138. package/dist/entries/theme.js +7 -0
  139. package/dist/entries/toast.js +5 -0
  140. package/dist/entries/video.js +3 -0
  141. package/dist/entries/webview.js +4 -0
  142. package/dist/examples/AiChatGallery.jsx +509 -0
  143. package/dist/examples/ParityGallery.jsx +1307 -0
  144. package/dist/floating.js +62 -0
  145. package/dist/glassBlur.jsx +145 -0
  146. package/dist/gradient.js +17 -0
  147. package/dist/haptics.js +44 -0
  148. package/dist/highlight.js +382 -0
  149. package/dist/index.js +85 -0
  150. package/dist/initials.js +4 -0
  151. package/dist/loadingGrid.js +81 -0
  152. package/dist/markdown/Markdown.jsx +515 -0
  153. package/dist/markdown/MarkdownTable.jsx +443 -0
  154. package/dist/markdown/tableText.js +68 -0
  155. package/dist/marketing/PricingModal.jsx +608 -0
  156. package/dist/marketing/UpgradeToProCard.jsx +164 -0
  157. package/dist/marketing/pricing.js +34 -0
  158. package/dist/media/ImageGallery.jsx +580 -0
  159. package/dist/media/MediaCard.jsx +162 -0
  160. package/dist/media/imageGrid.js +54 -0
  161. package/dist/motion.js +33 -0
  162. package/dist/pagerSwipe.js +104 -0
  163. package/dist/palette.js +104 -0
  164. package/dist/primitives/button.jsx +127 -0
  165. package/dist/primitives/card.jsx +249 -0
  166. package/dist/primitives/icon.jsx +37 -0
  167. package/dist/primitives/input.jsx +56 -0
  168. package/dist/primitives/keyboard-controller.jsx +207 -0
  169. package/dist/primitives/keyboard-parts.jsx +75 -0
  170. package/dist/primitives/native-only-animated-view.jsx +68 -0
  171. package/dist/primitives/overlay.jsx +391 -0
  172. package/dist/primitives/pager-gesture.jsx +131 -0
  173. package/dist/primitives/select-host.jsx +103 -0
  174. package/dist/primitives/select.jsx +555 -0
  175. package/dist/primitives/sheet-drag.jsx +420 -0
  176. package/dist/primitives/sheet-gesture.jsx +219 -0
  177. package/dist/primitives/swipe-row-gesture.jsx +341 -0
  178. package/dist/primitives/switch.jsx +105 -0
  179. package/dist/primitives/text.jsx +145 -0
  180. package/dist/primitives/toast-drag-gesture.jsx +94 -0
  181. package/dist/primitives/use-controllable-state.js +40 -0
  182. package/dist/primitives/web-click-guard.js +69 -0
  183. package/dist/push.js +166 -0
  184. package/dist/relativeTime.js +70 -0
  185. package/dist/router/RouterStackPageHeader.jsx +53 -0
  186. package/dist/selectA11y.js +32 -0
  187. package/dist/settings/MoreFromProjectV.jsx +168 -0
  188. package/dist/settings/SettingsEmptyState.jsx +102 -0
  189. package/dist/settings/SettingsField.jsx +49 -0
  190. package/dist/settings/SettingsSection.jsx +101 -0
  191. package/dist/settings/SettingsStack.jsx +17 -0
  192. package/dist/settings/SettingsToggleRow.jsx +163 -0
  193. package/dist/settings/projectVMobileApps.js +126 -0
  194. package/dist/settings/relaxedSizeStyle.js +11 -0
  195. package/dist/sheetDrag.js +76 -0
  196. package/dist/svgA11y.js +46 -0
  197. package/dist/swipeRow.js +161 -0
  198. package/dist/tabBarRoutes.js +41 -0
  199. package/dist/tabIndicator.js +139 -0
  200. package/dist/tailwind-preset.cjs +255 -0
  201. package/dist/tailwind-preset.d.cts +55 -0
  202. package/dist/theme.jsx +62 -0
  203. package/dist/toastChrome.js +110 -0
  204. package/dist/toastDrag.js +51 -0
  205. package/dist/toastStore.js +54 -0
  206. package/dist/tokens.js +70 -0
  207. package/dist/typography.js +40 -0
  208. package/dist/useReduceMotion.js +32 -0
  209. package/dist/useReduceTransparency.js +27 -0
  210. package/dist/useScheme.js +15 -0
  211. package/dist/video/InlineVideo.jsx +115 -0
  212. package/dist/webview/HtmlView.jsx +169 -0
  213. package/dist/webview/HtmlView.web.jsx +63 -0
  214. package/dist/webview/htmlView.js +43 -0
  215. package/package.json +70 -33
  216. package/src/DropdownMenu.tsx +28 -16
  217. package/src/FloatingTabBar.tsx +78 -41
  218. package/src/ai/conversation.tsx +12 -8
  219. package/src/glassBlur.tsx +47 -22
  220. package/src/primitives/swipe-row-gesture.tsx +11 -2
@@ -0,0 +1,739 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { createContext, useContext, useEffect, useState } from "react";
3
+ import { Pressable, StyleSheet, Text, View } from "react-native";
4
+ import Animated, { useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
5
+ import { IconArrowBackUp, IconCopy, IconRefresh, IconThumbDown, IconThumbUp } from "@tabler/icons-react-native";
6
+ import { cn } from "../cn";
7
+ import { sizeStyle, typeStyle } from "../controlStyles";
8
+ import { palette, withAlpha } from "../palette";
9
+ import { useLargerText } from "../theme";
10
+ import { tokens } from "../tokens";
11
+ import { useReduceMotion } from "../useReduceMotion";
12
+ import { useScheme } from "../useScheme";
13
+ import { META_TEXT_STYLE, chatTextSize } from "./chat-text";
14
+ import { ChatIconButton } from "./icon-button";
15
+ import { MESSAGE_ACTIONS_TITLE, MessageActionSheet } from "./message-action-sheet";
16
+ import { ChatTextColorContext, ResponseText } from "./response-text";
17
+ const MessageContext = createContext("assistant");
18
+
19
+ /** The bot behind an incoming message in a group chat. */
20
+
21
+ /** How long the highlight wash takes to fade, in milliseconds. */
22
+ export const MESSAGE_HIGHLIGHT_MS = 1400;
23
+
24
+ /** Peak opacity of the highlight wash (the primary colour). */
25
+ const HIGHLIGHT_WASH = 0.18;
26
+ function MessageHighlight() {
27
+ const $ = _c(14);
28
+ const scheme = useScheme();
29
+ const reduceMotion = useReduceMotion();
30
+ const wash = useSharedValue(reduceMotion ? 0.5 : 1);
31
+ let t0;
32
+ let t1;
33
+ if ($[0] !== reduceMotion || $[1] !== wash) {
34
+ t0 = () => {
35
+ if (reduceMotion) {
36
+ wash.set(0.5);
37
+ return;
38
+ }
39
+ wash.set(1);
40
+ wash.set(withTiming(0, {
41
+ duration: MESSAGE_HIGHLIGHT_MS
42
+ }));
43
+ };
44
+ t1 = [wash, reduceMotion];
45
+ $[0] = reduceMotion;
46
+ $[1] = wash;
47
+ $[2] = t0;
48
+ $[3] = t1;
49
+ } else {
50
+ t0 = $[2];
51
+ t1 = $[3];
52
+ }
53
+ useEffect(t0, t1);
54
+ const animatedStyle = useAnimatedStyle(() => ({
55
+ opacity: wash.get()
56
+ }));
57
+ const t2 = palette.primary[scheme];
58
+ let t3;
59
+ if ($[4] !== t2) {
60
+ t3 = withAlpha(t2, 0.5);
61
+ $[4] = t2;
62
+ $[5] = t3;
63
+ } else {
64
+ t3 = $[5];
65
+ }
66
+ const t4 = palette.primary[scheme];
67
+ let t5;
68
+ if ($[6] !== t4) {
69
+ t5 = withAlpha(t4, HIGHLIGHT_WASH);
70
+ $[6] = t4;
71
+ $[7] = t5;
72
+ } else {
73
+ t5 = $[7];
74
+ }
75
+ let t6;
76
+ if ($[8] !== t3 || $[9] !== t5) {
77
+ t6 = {
78
+ borderRadius: tokens.radius.lg,
79
+ borderWidth: 1.5,
80
+ borderColor: t3,
81
+ backgroundColor: t5
82
+ };
83
+ $[8] = t3;
84
+ $[9] = t5;
85
+ $[10] = t6;
86
+ } else {
87
+ t6 = $[10];
88
+ }
89
+ let t7;
90
+ if ($[11] !== animatedStyle || $[12] !== t6) {
91
+ t7 = <Animated.View testID="message-highlight" pointerEvents="none" style={[StyleSheet.absoluteFill, t6, animatedStyle]} />;
92
+ $[11] = animatedStyle;
93
+ $[12] = t6;
94
+ $[13] = t7;
95
+ } else {
96
+ t7 = $[13];
97
+ }
98
+ return t7;
99
+ }
100
+
101
+ /**
102
+ * One message: the web `w-full max-w-[95%] flex-col gap-2`. A user message
103
+ * sits at the end of the row with its parts at the end; an assistant message
104
+ * at the start, its parts full width.
105
+ *
106
+ * With `onLongPress` or `actions` the message is a `Pressable` (same layout,
107
+ * `className`, `style` and view props) and a long press opens the
108
+ * `MessageActionSheet`; TalkBack reaches it as the `longpress` action. It stays
109
+ * a non-accessible container so its buttons and links keep their own focus:
110
+ * also offer the actions in a `MessageActionsBar` for screen reader users. `highlighted` draws the quote-jump highlight.
111
+ */
112
+ export function Message(t0) {
113
+ const $ = _c(45);
114
+ let actionSheetTitle;
115
+ let actions;
116
+ let bot;
117
+ let children;
118
+ let className;
119
+ let from;
120
+ let onLongPress;
121
+ let props;
122
+ let style;
123
+ let t1;
124
+ if ($[0] !== t0) {
125
+ ({
126
+ from,
127
+ className,
128
+ style,
129
+ onLongPress,
130
+ actions,
131
+ actionSheetTitle,
132
+ highlighted: t1,
133
+ bot,
134
+ children,
135
+ ...props
136
+ } = t0);
137
+ $[0] = t0;
138
+ $[1] = actionSheetTitle;
139
+ $[2] = actions;
140
+ $[3] = bot;
141
+ $[4] = children;
142
+ $[5] = className;
143
+ $[6] = from;
144
+ $[7] = onLongPress;
145
+ $[8] = props;
146
+ $[9] = style;
147
+ $[10] = t1;
148
+ } else {
149
+ actionSheetTitle = $[1];
150
+ actions = $[2];
151
+ bot = $[3];
152
+ children = $[4];
153
+ className = $[5];
154
+ from = $[6];
155
+ onLongPress = $[7];
156
+ props = $[8];
157
+ style = $[9];
158
+ t1 = $[10];
159
+ }
160
+ const highlighted = t1 === undefined ? false : t1;
161
+ const user = from === "user";
162
+ const [sheetOpen, setSheetOpen] = useState(false);
163
+ const hasActions = actions != null && actions.length > 0;
164
+ const longPressable = onLongPress != null || hasActions;
165
+ let t2;
166
+ if ($[11] !== hasActions || $[12] !== onLongPress) {
167
+ t2 = () => {
168
+ onLongPress?.();
169
+ if (hasActions) {
170
+ setSheetOpen(true);
171
+ }
172
+ };
173
+ $[11] = hasActions;
174
+ $[12] = onLongPress;
175
+ $[13] = t2;
176
+ } else {
177
+ t2 = $[13];
178
+ }
179
+ const longPress = t2;
180
+ const t3 = user ? "flex-end" : "flex-start";
181
+ const t4 = user ? "flex-end" : "stretch";
182
+ let t5;
183
+ if ($[14] !== t3 || $[15] !== t4) {
184
+ t5 = {
185
+ alignSelf: t3,
186
+ alignItems: t4
187
+ };
188
+ $[14] = t3;
189
+ $[15] = t4;
190
+ $[16] = t5;
191
+ } else {
192
+ t5 = $[16];
193
+ }
194
+ let t6;
195
+ if ($[17] !== style || $[18] !== t5) {
196
+ t6 = [t5, style];
197
+ $[17] = style;
198
+ $[18] = t5;
199
+ $[19] = t6;
200
+ } else {
201
+ t6 = $[19];
202
+ }
203
+ const layout = t6;
204
+ let t7;
205
+ if ($[20] !== className) {
206
+ t7 = cn("w-full max-w-[95%] gap-2", className);
207
+ $[20] = className;
208
+ $[21] = t7;
209
+ } else {
210
+ t7 = $[21];
211
+ }
212
+ const merged = t7;
213
+ let t8;
214
+ if ($[22] !== bot || $[23] !== user) {
215
+ t8 = bot && !user ? <MessageBotLabel name={bot.name} avatar={bot.avatar} /> : null;
216
+ $[22] = bot;
217
+ $[23] = user;
218
+ $[24] = t8;
219
+ } else {
220
+ t8 = $[24];
221
+ }
222
+ let t9;
223
+ if ($[25] !== highlighted) {
224
+ t9 = highlighted ? <MessageHighlight /> : null;
225
+ $[25] = highlighted;
226
+ $[26] = t9;
227
+ } else {
228
+ t9 = $[26];
229
+ }
230
+ let t10;
231
+ if ($[27] !== children || $[28] !== t8 || $[29] !== t9) {
232
+ t10 = <>{t8}{children}{t9}</>;
233
+ $[27] = children;
234
+ $[28] = t8;
235
+ $[29] = t9;
236
+ $[30] = t10;
237
+ } else {
238
+ t10 = $[30];
239
+ }
240
+ const parts = t10;
241
+ let t11;
242
+ if ($[31] !== actionSheetTitle || $[32] !== actions || $[33] !== hasActions || $[34] !== layout || $[35] !== longPress || $[36] !== longPressable || $[37] !== merged || $[38] !== parts || $[39] !== props || $[40] !== sheetOpen) {
243
+ t11 = longPressable ? <><Pressable accessible={false} className={merged} style={layout} onLongPress={longPress} accessibilityActions={[{
244
+ name: "longpress",
245
+ label: actionSheetTitle ?? MESSAGE_ACTIONS_TITLE
246
+ }]} onAccessibilityAction={event => {
247
+ if (event.nativeEvent.actionName === "longpress") {
248
+ longPress();
249
+ }
250
+ }} {...props}>{parts}</Pressable>{hasActions ? <MessageActionSheet open={sheetOpen} onClose={() => setSheetOpen(false)} actions={actions} title={actionSheetTitle} /> : null}</> : <View className={merged} style={layout} {...props}>{parts}</View>;
251
+ $[31] = actionSheetTitle;
252
+ $[32] = actions;
253
+ $[33] = hasActions;
254
+ $[34] = layout;
255
+ $[35] = longPress;
256
+ $[36] = longPressable;
257
+ $[37] = merged;
258
+ $[38] = parts;
259
+ $[39] = props;
260
+ $[40] = sheetOpen;
261
+ $[41] = t11;
262
+ } else {
263
+ t11 = $[41];
264
+ }
265
+ let t12;
266
+ if ($[42] !== from || $[43] !== t11) {
267
+ t12 = <MessageContext.Provider value={from}>{t11}</MessageContext.Provider>;
268
+ $[42] = from;
269
+ $[43] = t11;
270
+ $[44] = t12;
271
+ } else {
272
+ t12 = $[44];
273
+ }
274
+ return t12;
275
+ }
276
+
277
+ /**
278
+ * The web user bubble: `rounded-2xl rounded-br-md bg-primary` (radius 16 with
279
+ * the bottom-right corner at 14, `tokens.radius.md`).
280
+ */
281
+ export function userBubbleStyle(scheme) {
282
+ return {
283
+ backgroundColor: palette.primary[scheme],
284
+ borderRadius: tokens.radius.lg,
285
+ borderBottomRightRadius: tokens.radius.md
286
+ };
287
+ }
288
+
289
+ /**
290
+ * A user bubble's look. `primary` is the web default (`bg-primary` with the
291
+ * label colour). `tint` is the chat override Eva uses (`rounded-surface
292
+ * bg-primary/10 text-foreground`, still `px-4 py-3`): a 10% wash of the
293
+ * primary colour with foreground text and every corner at 16.
294
+ */
295
+
296
+ /** The `tint` bubble: the primary colour at 10% alpha, radius 16 on every corner. */
297
+ export function tintBubbleStyle(scheme) {
298
+ return {
299
+ backgroundColor: withAlpha(palette.primary[scheme], 0.1),
300
+ borderRadius: tokens.radius.lg
301
+ };
302
+ }
303
+ /**
304
+ * Which bot sent a message, for group chats: an optional avatar and the name
305
+ * in the caption size. `Message` draws it for its `bot` prop. To compose it
306
+ * yourself, render it above `MessageContent` (for example in `renderMessage`).
307
+ */
308
+ export function MessageBotLabel(t0) {
309
+ const $ = _c(37);
310
+ const {
311
+ name,
312
+ avatar,
313
+ className,
314
+ testID: t1
315
+ } = t0;
316
+ const testID = t1 === undefined ? "message-bot-label" : t1;
317
+ const scheme = useScheme();
318
+ const largerText = useLargerText();
319
+ let T0;
320
+ let T1;
321
+ let t2;
322
+ let t3;
323
+ let t4;
324
+ let t5;
325
+ let t6;
326
+ let t7;
327
+ let t8;
328
+ let t9;
329
+ if ($[0] !== avatar || $[1] !== className || $[2] !== largerText || $[3] !== name || $[4] !== testID) {
330
+ const size = chatTextSize("caption", largerText);
331
+ T1 = View;
332
+ t5 = testID;
333
+ t6 = true;
334
+ t7 = `From ${name}`;
335
+ if ($[15] !== className) {
336
+ t8 = cn("flex-row items-center gap-1.5", className);
337
+ $[15] = className;
338
+ $[16] = t8;
339
+ } else {
340
+ t8 = $[16];
341
+ }
342
+ t9 = avatar;
343
+ T0 = Text;
344
+ t3 = 1;
345
+ t4 = cn(size, "font-instrument-sans-semibold");
346
+ t2 = sizeStyle(size);
347
+ $[0] = avatar;
348
+ $[1] = className;
349
+ $[2] = largerText;
350
+ $[3] = name;
351
+ $[4] = testID;
352
+ $[5] = T0;
353
+ $[6] = T1;
354
+ $[7] = t2;
355
+ $[8] = t3;
356
+ $[9] = t4;
357
+ $[10] = t5;
358
+ $[11] = t6;
359
+ $[12] = t7;
360
+ $[13] = t8;
361
+ $[14] = t9;
362
+ } else {
363
+ T0 = $[5];
364
+ T1 = $[6];
365
+ t2 = $[7];
366
+ t3 = $[8];
367
+ t4 = $[9];
368
+ t5 = $[10];
369
+ t6 = $[11];
370
+ t7 = $[12];
371
+ t8 = $[13];
372
+ t9 = $[14];
373
+ }
374
+ let t10;
375
+ if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
376
+ t10 = typeStyle("semibold");
377
+ $[17] = t10;
378
+ } else {
379
+ t10 = $[17];
380
+ }
381
+ const t11 = tokens.color.muted[scheme];
382
+ let t12;
383
+ if ($[18] !== t11) {
384
+ t12 = {
385
+ color: t11
386
+ };
387
+ $[18] = t11;
388
+ $[19] = t12;
389
+ } else {
390
+ t12 = $[19];
391
+ }
392
+ let t13;
393
+ if ($[20] !== t12 || $[21] !== t2) {
394
+ t13 = [t2, t10, t12];
395
+ $[20] = t12;
396
+ $[21] = t2;
397
+ $[22] = t13;
398
+ } else {
399
+ t13 = $[22];
400
+ }
401
+ let t14;
402
+ if ($[23] !== T0 || $[24] !== name || $[25] !== t13 || $[26] !== t3 || $[27] !== t4) {
403
+ t14 = <T0 numberOfLines={t3} className={t4} style={t13}>{name}</T0>;
404
+ $[23] = T0;
405
+ $[24] = name;
406
+ $[25] = t13;
407
+ $[26] = t3;
408
+ $[27] = t4;
409
+ $[28] = t14;
410
+ } else {
411
+ t14 = $[28];
412
+ }
413
+ let t15;
414
+ if ($[29] !== T1 || $[30] !== t14 || $[31] !== t5 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8 || $[35] !== t9) {
415
+ t15 = <T1 testID={t5} accessible={t6} accessibilityLabel={t7} className={t8}>{t9}{t14}</T1>;
416
+ $[29] = T1;
417
+ $[30] = t14;
418
+ $[31] = t5;
419
+ $[32] = t6;
420
+ $[33] = t7;
421
+ $[34] = t8;
422
+ $[35] = t9;
423
+ $[36] = t15;
424
+ } else {
425
+ t15 = $[36];
426
+ }
427
+ return t15;
428
+ }
429
+ /**
430
+ * The message body. A user message is a filled bubble, `px-4 py-3`: by
431
+ * default with the primary fill and label colour, or with `bubble="tint"` on
432
+ * a 10% primary wash with the foreground colour. An assistant message has
433
+ * no fill and the foreground colour. A string child is drawn as
434
+ * `ResponseText`, and `ResponseText` inside takes the colour.
435
+ */
436
+ export function MessageContent(t0) {
437
+ const $ = _c(30);
438
+ let children;
439
+ let className;
440
+ let props;
441
+ let quote;
442
+ let style;
443
+ let t1;
444
+ if ($[0] !== t0) {
445
+ ({
446
+ children,
447
+ bubble: t1,
448
+ quote,
449
+ className,
450
+ style,
451
+ ...props
452
+ } = t0);
453
+ $[0] = t0;
454
+ $[1] = children;
455
+ $[2] = className;
456
+ $[3] = props;
457
+ $[4] = quote;
458
+ $[5] = style;
459
+ $[6] = t1;
460
+ } else {
461
+ children = $[1];
462
+ className = $[2];
463
+ props = $[3];
464
+ quote = $[4];
465
+ style = $[5];
466
+ t1 = $[6];
467
+ }
468
+ const bubble = t1 === undefined ? "primary" : t1;
469
+ const from = useContext(MessageContext);
470
+ const scheme = useScheme();
471
+ const user = from === "user";
472
+ const tint = user && bubble === "tint";
473
+ const color = user && !tint ? palette.primaryForeground[scheme] : tokens.color.foreground[scheme];
474
+ let t2;
475
+ if ($[7] !== scheme || $[8] !== tint || $[9] !== user) {
476
+ t2 = !user ? null : tint ? tintBubbleStyle(scheme) : userBubbleStyle(scheme);
477
+ $[7] = scheme;
478
+ $[8] = tint;
479
+ $[9] = user;
480
+ $[10] = t2;
481
+ } else {
482
+ t2 = $[10];
483
+ }
484
+ const bubbleStyle = t2;
485
+ let t3;
486
+ if ($[11] !== children) {
487
+ t3 = typeof children === "string" ? <ResponseText>{children}</ResponseText> : children;
488
+ $[11] = children;
489
+ $[12] = t3;
490
+ } else {
491
+ t3 = $[12];
492
+ }
493
+ const body = t3;
494
+ const t4 = user && "px-4 py-3";
495
+ let t5;
496
+ if ($[13] !== className || $[14] !== t4) {
497
+ t5 = cn("min-w-0 max-w-full gap-2", t4, className);
498
+ $[13] = className;
499
+ $[14] = t4;
500
+ $[15] = t5;
501
+ } else {
502
+ t5 = $[15];
503
+ }
504
+ let t6;
505
+ if ($[16] !== bubbleStyle || $[17] !== style) {
506
+ t6 = [bubbleStyle, style];
507
+ $[16] = bubbleStyle;
508
+ $[17] = style;
509
+ $[18] = t6;
510
+ } else {
511
+ t6 = $[18];
512
+ }
513
+ let t7;
514
+ if ($[19] !== body || $[20] !== quote) {
515
+ t7 = quote ? <>{quote}{body}</> : body;
516
+ $[19] = body;
517
+ $[20] = quote;
518
+ $[21] = t7;
519
+ } else {
520
+ t7 = $[21];
521
+ }
522
+ let t8;
523
+ if ($[22] !== props || $[23] !== t5 || $[24] !== t6 || $[25] !== t7) {
524
+ t8 = <View className={t5} style={t6} {...props}>{t7}</View>;
525
+ $[22] = props;
526
+ $[23] = t5;
527
+ $[24] = t6;
528
+ $[25] = t7;
529
+ $[26] = t8;
530
+ } else {
531
+ t8 = $[26];
532
+ }
533
+ let t9;
534
+ if ($[27] !== color || $[28] !== t8) {
535
+ t9 = <ChatTextColorContext.Provider value={color}>{t8}</ChatTextColorContext.Provider>;
536
+ $[27] = color;
537
+ $[28] = t8;
538
+ $[29] = t9;
539
+ } else {
540
+ t9 = $[29];
541
+ }
542
+ return t9;
543
+ }
544
+ /**
545
+ * The muted clock and duration after a message's actions, as Eva's web chat
546
+ * (`tabular-nums text-muted-foreground/60`, "10:21 PM · 1m"): the caption
547
+ * size (or `size="2xs"`), the muted colour at 60%, tabular figures.
548
+ */
549
+ export function MessageMeta(t0) {
550
+ const $ = _c(19);
551
+ const {
552
+ children,
553
+ size: t1,
554
+ className
555
+ } = t0;
556
+ const size = t1 === undefined ? "caption" : t1;
557
+ const scheme = useScheme();
558
+ const largerText = useLargerText();
559
+ let T0;
560
+ let t2;
561
+ let t3;
562
+ if ($[0] !== className || $[1] !== largerText || $[2] !== size) {
563
+ const caption = chatTextSize("caption", largerText);
564
+ const tiny = size === "2xs" && !largerText;
565
+ T0 = Text;
566
+ t3 = cn(!tiny && caption, "font-instrument-sans", className);
567
+ t2 = tiny ? META_TEXT_STYLE : sizeStyle(caption);
568
+ $[0] = className;
569
+ $[1] = largerText;
570
+ $[2] = size;
571
+ $[3] = T0;
572
+ $[4] = t2;
573
+ $[5] = t3;
574
+ } else {
575
+ T0 = $[3];
576
+ t2 = $[4];
577
+ t3 = $[5];
578
+ }
579
+ const t4 = tokens.color.muted[scheme];
580
+ let t5;
581
+ if ($[6] !== t4) {
582
+ t5 = withAlpha(t4, 0.6);
583
+ $[6] = t4;
584
+ $[7] = t5;
585
+ } else {
586
+ t5 = $[7];
587
+ }
588
+ let t6;
589
+ if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
590
+ t6 = ["tabular-nums"];
591
+ $[8] = t6;
592
+ } else {
593
+ t6 = $[8];
594
+ }
595
+ let t7;
596
+ if ($[9] !== t5) {
597
+ t7 = {
598
+ color: t5,
599
+ fontVariant: t6
600
+ };
601
+ $[9] = t5;
602
+ $[10] = t7;
603
+ } else {
604
+ t7 = $[10];
605
+ }
606
+ let t8;
607
+ if ($[11] !== t2 || $[12] !== t7) {
608
+ t8 = [t2, t7];
609
+ $[11] = t2;
610
+ $[12] = t7;
611
+ $[13] = t8;
612
+ } else {
613
+ t8 = $[13];
614
+ }
615
+ let t9;
616
+ if ($[14] !== T0 || $[15] !== children || $[16] !== t3 || $[17] !== t8) {
617
+ t9 = <T0 className={t3} style={t8}>{children}</T0>;
618
+ $[14] = T0;
619
+ $[15] = children;
620
+ $[16] = t3;
621
+ $[17] = t8;
622
+ $[18] = t9;
623
+ } else {
624
+ t9 = $[18];
625
+ }
626
+ return t9;
627
+ }
628
+ /** A row of `MessageAction`s under a message, as the web `flex items-center gap-1`. */
629
+ export function MessageActionsBar(t0) {
630
+ const $ = _c(8);
631
+ let className;
632
+ let props;
633
+ if ($[0] !== t0) {
634
+ ({
635
+ className,
636
+ ...props
637
+ } = t0);
638
+ $[0] = t0;
639
+ $[1] = className;
640
+ $[2] = props;
641
+ } else {
642
+ className = $[1];
643
+ props = $[2];
644
+ }
645
+ let t1;
646
+ if ($[3] !== className) {
647
+ t1 = cn("flex-row items-center gap-1", className);
648
+ $[3] = className;
649
+ $[4] = t1;
650
+ } else {
651
+ t1 = $[4];
652
+ }
653
+ let t2;
654
+ if ($[5] !== props || $[6] !== t1) {
655
+ t2 = <View className={t1} {...props} />;
656
+ $[5] = props;
657
+ $[6] = t1;
658
+ $[7] = t2;
659
+ } else {
660
+ t2 = $[7];
661
+ }
662
+ return t2;
663
+ }
664
+
665
+ /** The usual actions, with their icons and accessibility labels. */
666
+ export const MESSAGE_ACTIONS = {
667
+ reply: {
668
+ icon: IconArrowBackUp,
669
+ label: "Reply"
670
+ },
671
+ copy: {
672
+ icon: IconCopy,
673
+ label: "Copy"
674
+ },
675
+ retry: {
676
+ icon: IconRefresh,
677
+ label: "Retry"
678
+ },
679
+ like: {
680
+ icon: IconThumbUp,
681
+ label: "Good response"
682
+ },
683
+ dislike: {
684
+ icon: IconThumbDown,
685
+ label: "Bad response"
686
+ }
687
+ };
688
+ /**
689
+ * A ghost icon button under a message: the web `icon-sm` (32, 16 icon), or
690
+ * `icon-xs` with `size="xs"`, with the slop to 44 high. It has no sideways
691
+ * slop: the actions sit 2 to 4 apart, and slop there would overlap the next
692
+ * one, so a tap on Copy could fork or rate instead. Copying is up to the app (`onPress`): React Native's own
693
+ * `Clipboard` is deprecated, and native-ui adds no clipboard package.
694
+ */
695
+ export function MessageAction(t0) {
696
+ const $ = _c(11);
697
+ const {
698
+ kind,
699
+ icon,
700
+ label,
701
+ onPress,
702
+ selected: t1,
703
+ disabled,
704
+ size,
705
+ testID
706
+ } = t0;
707
+ const selected = t1 === undefined ? false : t1;
708
+ const scheme = useScheme();
709
+ const preset = kind ? MESSAGE_ACTIONS[kind] : undefined;
710
+ const Icon = icon ?? preset?.icon ?? IconCopy;
711
+ const t2 = label ?? preset?.label ?? "";
712
+ const t3 = selected ? tokens.color.foreground[scheme] : undefined;
713
+ let t4;
714
+ if ($[0] !== selected) {
715
+ t4 = {
716
+ selected
717
+ };
718
+ $[0] = selected;
719
+ $[1] = t4;
720
+ } else {
721
+ t4 = $[1];
722
+ }
723
+ let t5;
724
+ if ($[2] !== Icon || $[3] !== disabled || $[4] !== onPress || $[5] !== size || $[6] !== t2 || $[7] !== t3 || $[8] !== t4 || $[9] !== testID) {
725
+ t5 = <ChatIconButton icon={Icon} label={t2} iconColor={t3} accessibilityState={t4} onPress={onPress} disabled={disabled} size={size} slop="vertical" testID={testID} />;
726
+ $[2] = Icon;
727
+ $[3] = disabled;
728
+ $[4] = onPress;
729
+ $[5] = size;
730
+ $[6] = t2;
731
+ $[7] = t3;
732
+ $[8] = t4;
733
+ $[9] = testID;
734
+ $[10] = t5;
735
+ } else {
736
+ t5 = $[10];
737
+ }
738
+ return t5;
739
+ }