@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,249 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+ import { View } from "react-native";
4
+ import { Text, TextClassContext } from "./text";
5
+ import { cn } from "../cn";
6
+ import { typeStyle } from "../controlStyles";
7
+ const Card = React.forwardRef((t0, ref) => {
8
+ const $ = _c(9);
9
+ let className;
10
+ let props;
11
+ if ($[0] !== t0) {
12
+ ({
13
+ className,
14
+ ...props
15
+ } = t0);
16
+ $[0] = t0;
17
+ $[1] = className;
18
+ $[2] = props;
19
+ } else {
20
+ className = $[1];
21
+ props = $[2];
22
+ }
23
+ let t1;
24
+ if ($[3] !== className) {
25
+ t1 = cn("flex flex-col gap-6 rounded-lg bg-surface py-6", className);
26
+ $[3] = className;
27
+ $[4] = t1;
28
+ } else {
29
+ t1 = $[4];
30
+ }
31
+ let t2;
32
+ if ($[5] !== props || $[6] !== ref || $[7] !== t1) {
33
+ t2 = <TextClassContext.Provider value="text-card-foreground"><View ref={ref} className={t1} {...props} /></TextClassContext.Provider>;
34
+ $[5] = props;
35
+ $[6] = ref;
36
+ $[7] = t1;
37
+ $[8] = t2;
38
+ } else {
39
+ t2 = $[8];
40
+ }
41
+ return t2;
42
+ });
43
+ const CardHeader = React.forwardRef((t0, ref) => {
44
+ const $ = _c(9);
45
+ let className;
46
+ let props;
47
+ if ($[0] !== t0) {
48
+ ({
49
+ className,
50
+ ...props
51
+ } = t0);
52
+ $[0] = t0;
53
+ $[1] = className;
54
+ $[2] = props;
55
+ } else {
56
+ className = $[1];
57
+ props = $[2];
58
+ }
59
+ let t1;
60
+ if ($[3] !== className) {
61
+ t1 = cn("flex flex-col gap-1.5 px-6", className);
62
+ $[3] = className;
63
+ $[4] = t1;
64
+ } else {
65
+ t1 = $[4];
66
+ }
67
+ let t2;
68
+ if ($[5] !== props || $[6] !== ref || $[7] !== t1) {
69
+ t2 = <View ref={ref} className={t1} {...props} />;
70
+ $[5] = props;
71
+ $[6] = ref;
72
+ $[7] = t1;
73
+ $[8] = t2;
74
+ } else {
75
+ t2 = $[8];
76
+ }
77
+ return t2;
78
+ });
79
+ const CardTitle = React.forwardRef((t0, ref) => {
80
+ const $ = _c(14);
81
+ let className;
82
+ let props;
83
+ let style;
84
+ if ($[0] !== t0) {
85
+ ({
86
+ className,
87
+ style,
88
+ ...props
89
+ } = t0);
90
+ $[0] = t0;
91
+ $[1] = className;
92
+ $[2] = props;
93
+ $[3] = style;
94
+ } else {
95
+ className = $[1];
96
+ props = $[2];
97
+ style = $[3];
98
+ }
99
+ let t1;
100
+ if ($[4] !== className) {
101
+ t1 = cn("font-instrument-sans-semibold leading-none", className);
102
+ $[4] = className;
103
+ $[5] = t1;
104
+ } else {
105
+ t1 = $[5];
106
+ }
107
+ let t2;
108
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
109
+ t2 = typeStyle("semibold");
110
+ $[6] = t2;
111
+ } else {
112
+ t2 = $[6];
113
+ }
114
+ let t3;
115
+ if ($[7] !== style) {
116
+ t3 = [t2, style];
117
+ $[7] = style;
118
+ $[8] = t3;
119
+ } else {
120
+ t3 = $[8];
121
+ }
122
+ let t4;
123
+ if ($[9] !== props || $[10] !== ref || $[11] !== t1 || $[12] !== t3) {
124
+ t4 = <Text ref={ref} role="heading" aria-level={3} className={t1} style={t3} {...props} />;
125
+ $[9] = props;
126
+ $[10] = ref;
127
+ $[11] = t1;
128
+ $[12] = t3;
129
+ $[13] = t4;
130
+ } else {
131
+ t4 = $[13];
132
+ }
133
+ return t4;
134
+ });
135
+ const CardDescription = React.forwardRef((t0, ref) => {
136
+ const $ = _c(9);
137
+ let className;
138
+ let props;
139
+ if ($[0] !== t0) {
140
+ ({
141
+ className,
142
+ ...props
143
+ } = t0);
144
+ $[0] = t0;
145
+ $[1] = className;
146
+ $[2] = props;
147
+ } else {
148
+ className = $[1];
149
+ props = $[2];
150
+ }
151
+ let t1;
152
+ if ($[3] !== className) {
153
+ t1 = cn("text-sm text-muted-foreground", className);
154
+ $[3] = className;
155
+ $[4] = t1;
156
+ } else {
157
+ t1 = $[4];
158
+ }
159
+ let t2;
160
+ if ($[5] !== props || $[6] !== ref || $[7] !== t1) {
161
+ t2 = <Text ref={ref} className={t1} {...props} />;
162
+ $[5] = props;
163
+ $[6] = ref;
164
+ $[7] = t1;
165
+ $[8] = t2;
166
+ } else {
167
+ t2 = $[8];
168
+ }
169
+ return t2;
170
+ });
171
+ const CardContent = React.forwardRef((t0, ref) => {
172
+ const $ = _c(9);
173
+ let className;
174
+ let props;
175
+ if ($[0] !== t0) {
176
+ ({
177
+ className,
178
+ ...props
179
+ } = t0);
180
+ $[0] = t0;
181
+ $[1] = className;
182
+ $[2] = props;
183
+ } else {
184
+ className = $[1];
185
+ props = $[2];
186
+ }
187
+ let t1;
188
+ if ($[3] !== className) {
189
+ t1 = cn("px-6", className);
190
+ $[3] = className;
191
+ $[4] = t1;
192
+ } else {
193
+ t1 = $[4];
194
+ }
195
+ let t2;
196
+ if ($[5] !== props || $[6] !== ref || $[7] !== t1) {
197
+ t2 = <View ref={ref} className={t1} {...props} />;
198
+ $[5] = props;
199
+ $[6] = ref;
200
+ $[7] = t1;
201
+ $[8] = t2;
202
+ } else {
203
+ t2 = $[8];
204
+ }
205
+ return t2;
206
+ });
207
+ const CardFooter = React.forwardRef((t0, ref) => {
208
+ const $ = _c(9);
209
+ let className;
210
+ let props;
211
+ if ($[0] !== t0) {
212
+ ({
213
+ className,
214
+ ...props
215
+ } = t0);
216
+ $[0] = t0;
217
+ $[1] = className;
218
+ $[2] = props;
219
+ } else {
220
+ className = $[1];
221
+ props = $[2];
222
+ }
223
+ let t1;
224
+ if ($[3] !== className) {
225
+ t1 = cn("flex flex-row items-center px-6", className);
226
+ $[3] = className;
227
+ $[4] = t1;
228
+ } else {
229
+ t1 = $[4];
230
+ }
231
+ let t2;
232
+ if ($[5] !== props || $[6] !== ref || $[7] !== t1) {
233
+ t2 = <View ref={ref} className={t1} {...props} />;
234
+ $[5] = props;
235
+ $[6] = ref;
236
+ $[7] = t1;
237
+ $[8] = t2;
238
+ } else {
239
+ t2 = $[8];
240
+ }
241
+ return t2;
242
+ });
243
+ Card.displayName = "Card";
244
+ CardHeader.displayName = "CardHeader";
245
+ CardTitle.displayName = "CardTitle";
246
+ CardDescription.displayName = "CardDescription";
247
+ CardContent.displayName = "CardContent";
248
+ CardFooter.displayName = "CardFooter";
249
+ export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
@@ -0,0 +1,37 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+
4
+ // Tabler, not Lucide: a Lucide icon always sets `testID` on its `Svg`, which
5
+ // on web is a DOM `<svg>`, so React logs it as an unknown DOM prop.
6
+
7
+ function Icon(t0) {
8
+ const $ = _c(6);
9
+ let Component;
10
+ let props;
11
+ if ($[0] !== t0) {
12
+ const {
13
+ as: t1,
14
+ className: _className,
15
+ ...t2
16
+ } = t0;
17
+ Component = t1;
18
+ props = t2;
19
+ $[0] = t0;
20
+ $[1] = Component;
21
+ $[2] = props;
22
+ } else {
23
+ Component = $[1];
24
+ props = $[2];
25
+ }
26
+ let t1;
27
+ if ($[3] !== Component || $[4] !== props) {
28
+ t1 = <Component {...props} />;
29
+ $[3] = Component;
30
+ $[4] = props;
31
+ $[5] = t1;
32
+ } else {
33
+ t1 = $[5];
34
+ }
35
+ return t1;
36
+ }
37
+ export { Icon };
@@ -0,0 +1,56 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import * as React from "react";
3
+ import { Platform, TextInput } from "react-native";
4
+ import { cn } from "../cn";
5
+ import { palette } from "../palette";
6
+ import { useScheme } from "../useScheme";
7
+ const Input = React.forwardRef((t0, ref) => {
8
+ const $ = _c(12);
9
+ let className;
10
+ let placeholderTextColor;
11
+ let props;
12
+ if ($[0] !== t0) {
13
+ ({
14
+ className,
15
+ placeholderTextColor,
16
+ ...props
17
+ } = t0);
18
+ $[0] = t0;
19
+ $[1] = className;
20
+ $[2] = placeholderTextColor;
21
+ $[3] = props;
22
+ } else {
23
+ className = $[1];
24
+ placeholderTextColor = $[2];
25
+ props = $[3];
26
+ }
27
+ const scheme = useScheme();
28
+ const t1 = placeholderTextColor ?? palette.fieldPlaceholder[scheme];
29
+ let t2;
30
+ if ($[4] !== className || $[5] !== props.editable) {
31
+ t2 = cn("flex w-full flex-row items-center rounded-lg border-0 bg-secondary px-3 py-2 text-base text-foreground", props.editable === false && cn("opacity-50", Platform.select({
32
+ web: "cursor-not-allowed pointer-events-none"
33
+ })), Platform.select({
34
+ web: "outline-none transition-[color,box-shadow] md:text-sm"
35
+ }), className);
36
+ $[4] = className;
37
+ $[5] = props.editable;
38
+ $[6] = t2;
39
+ } else {
40
+ t2 = $[6];
41
+ }
42
+ let t3;
43
+ if ($[7] !== props || $[8] !== ref || $[9] !== t1 || $[10] !== t2) {
44
+ t3 = <TextInput ref={ref} placeholderTextColor={t1} className={t2} {...props} />;
45
+ $[7] = props;
46
+ $[8] = ref;
47
+ $[9] = t1;
48
+ $[10] = t2;
49
+ $[11] = t3;
50
+ } else {
51
+ t3 = $[11];
52
+ }
53
+ return t3;
54
+ });
55
+ Input.displayName = "Input";
56
+ export { Input };
@@ -0,0 +1,207 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Platform } from "react-native";
3
+ import { KeyboardAvoidingView, KeyboardChatScrollView, KeyboardGestureArea, KeyboardStickyView, useKeyboardHandler } from "react-native-keyboard-controller";
4
+ import { runOnJS } from "react-native-reanimated";
5
+ import { COMPOSER_INPUT_ID, KeyboardPartsContext } from "./keyboard-parts";
6
+
7
+ // The keyboard parts on `react-native-keyboard-controller`: the keyboard's
8
+ // real position, frame by frame, on the UI thread. No timing of our own, so
9
+ // the composer can neither lag nor lead the keyboard; with Reduce Motion the
10
+ // system shortens the keyboard's own motion and the parts follow it.
11
+
12
+ /**
13
+ * A drag moves the keyboard on iOS (`keyboardDismissMode="interactive"`) and
14
+ * on Android 11+ (API 30, `WindowInsetsAnimation`). Android 10 and below has
15
+ * no interactive keyboard: `KeyboardGestureArea` then only renders its
16
+ * children, and the transcript keeps `on-drag`.
17
+ */
18
+ const INTERACTIVE = Platform.OS === "ios" || Platform.OS === "android" && Number(Platform.Version) >= 30;
19
+ function AvoidingView(props) {
20
+ const $ = _c(2);
21
+ let t0;
22
+ if ($[0] !== props) {
23
+ t0 = <KeyboardAvoidingView {...props} />;
24
+ $[0] = props;
25
+ $[1] = t0;
26
+ } else {
27
+ t0 = $[1];
28
+ }
29
+ return t0;
30
+ }
31
+ function StickyView(t0) {
32
+ const $ = _c(8);
33
+ let bottomOffset;
34
+ let props;
35
+ if ($[0] !== t0) {
36
+ ({
37
+ bottomOffset,
38
+ ...props
39
+ } = t0);
40
+ $[0] = t0;
41
+ $[1] = bottomOffset;
42
+ $[2] = props;
43
+ } else {
44
+ bottomOffset = $[1];
45
+ props = $[2];
46
+ }
47
+ let t1;
48
+ if ($[3] !== bottomOffset) {
49
+ t1 = {
50
+ opened: bottomOffset
51
+ };
52
+ $[3] = bottomOffset;
53
+ $[4] = t1;
54
+ } else {
55
+ t1 = $[4];
56
+ }
57
+ let t2;
58
+ if ($[5] !== props || $[6] !== t1) {
59
+ t2 = <KeyboardStickyView {...props} offset={t1} />;
60
+ $[5] = props;
61
+ $[6] = t1;
62
+ $[7] = t2;
63
+ } else {
64
+ t2 = $[7];
65
+ }
66
+ return t2;
67
+ }
68
+
69
+ /**
70
+ * `always`: the content rises with the keyboard wherever the reader is, so
71
+ * what sat on the composer stays there (the newest message, at the end).
72
+ * Inverted, the keyboard's space is the content's top inset, the visual
73
+ * bottom: iOS scrolls below offset 0 into it, so the end moves there; Android
74
+ * moves the content down by it instead, so offset 0 stays the end. While the
75
+ * keyboard moves, the list scrolls with it, through offsets that are not the
76
+ * end on either platform.
77
+ */
78
+ function ChatScrollView(t0) {
79
+ const $ = _c(17);
80
+ let bottomOffset;
81
+ let onInsetChange;
82
+ let onKeyboardMove;
83
+ let props;
84
+ let t1;
85
+ if ($[0] !== t0) {
86
+ ({
87
+ bottomOffset,
88
+ inverted: t1,
89
+ onInsetChange,
90
+ onKeyboardMove,
91
+ ...props
92
+ } = t0);
93
+ $[0] = t0;
94
+ $[1] = bottomOffset;
95
+ $[2] = onInsetChange;
96
+ $[3] = onKeyboardMove;
97
+ $[4] = props;
98
+ $[5] = t1;
99
+ } else {
100
+ bottomOffset = $[1];
101
+ onInsetChange = $[2];
102
+ onKeyboardMove = $[3];
103
+ props = $[4];
104
+ t1 = $[5];
105
+ }
106
+ const inverted = t1 === undefined ? false : t1;
107
+ let t2;
108
+ let t3;
109
+ if ($[6] !== onKeyboardMove) {
110
+ t2 = {
111
+ onStart: () => {
112
+ "worklet";
113
+
114
+ runOnJS(onKeyboardMove)(true);
115
+ },
116
+ onEnd: () => {
117
+ "worklet";
118
+
119
+ runOnJS(onKeyboardMove)(false);
120
+ }
121
+ };
122
+ t3 = [onKeyboardMove];
123
+ $[6] = onKeyboardMove;
124
+ $[7] = t2;
125
+ $[8] = t3;
126
+ } else {
127
+ t2 = $[7];
128
+ t3 = $[8];
129
+ }
130
+ useKeyboardHandler(t2, t3);
131
+ let t4;
132
+ if ($[9] !== inverted || $[10] !== onInsetChange) {
133
+ t4 = insets => onInsetChange(inverted ? Platform.OS === "ios" ? insets.top : 0 : insets.bottom);
134
+ $[9] = inverted;
135
+ $[10] = onInsetChange;
136
+ $[11] = t4;
137
+ } else {
138
+ t4 = $[11];
139
+ }
140
+ let t5;
141
+ if ($[12] !== bottomOffset || $[13] !== inverted || $[14] !== props || $[15] !== t4) {
142
+ t5 = <KeyboardChatScrollView {...props} inverted={inverted} offset={bottomOffset} keyboardLiftBehavior="always" onContentInsetChange={t4} />;
143
+ $[12] = bottomOffset;
144
+ $[13] = inverted;
145
+ $[14] = props;
146
+ $[15] = t4;
147
+ $[16] = t5;
148
+ } else {
149
+ t5 = $[16];
150
+ }
151
+ return t5;
152
+ }
153
+
154
+ /**
155
+ * `ios`: the keyboard follows once the finger reaches the composer, then 1:1,
156
+ * and a release carries the finger's velocity, on both platforms.
157
+ */
158
+ function GestureArea(t0) {
159
+ const $ = _c(4);
160
+ const {
161
+ offset,
162
+ style,
163
+ children
164
+ } = t0;
165
+ let t1;
166
+ if ($[0] !== children || $[1] !== offset || $[2] !== style) {
167
+ t1 = <KeyboardGestureArea interpolator="ios" offset={offset} textInputNativeID={COMPOSER_INPUT_ID} style={style}>{children}</KeyboardGestureArea>;
168
+ $[0] = children;
169
+ $[1] = offset;
170
+ $[2] = style;
171
+ $[3] = t1;
172
+ } else {
173
+ t1 = $[3];
174
+ }
175
+ return t1;
176
+ }
177
+ const PARTS = {
178
+ AvoidingView,
179
+ StickyView,
180
+ ChatScrollView,
181
+ GestureArea,
182
+ interactive: INTERACTIVE
183
+ };
184
+
185
+ /**
186
+ * Runs the kit's keyboard handling on `react-native-keyboard-controller`:
187
+ * the chat composer (`ConversationDock`), its scroll button and the
188
+ * transcript (`ConversationList`) follow the keyboard frame by frame, a drag
189
+ * on the transcript moves the keyboard with the finger, and `PromptInput`,
190
+ * `ChatThread`, the overlays and `KeyboardAvoidingView` pad frame by frame.
191
+ * Put it inside the app's `KeyboardProvider`.
192
+ */
193
+ export function KeyboardControllerProvider(t0) {
194
+ const $ = _c(2);
195
+ const {
196
+ children
197
+ } = t0;
198
+ let t1;
199
+ if ($[0] !== children) {
200
+ t1 = <KeyboardPartsContext.Provider value={PARTS}>{children}</KeyboardPartsContext.Provider>;
201
+ $[0] = children;
202
+ $[1] = t1;
203
+ } else {
204
+ t1 = $[1];
205
+ }
206
+ return t1;
207
+ }
@@ -0,0 +1,75 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { createContext, useContext } from "react";
3
+ import { KeyboardAvoidingView as NativeKeyboardAvoidingView } from "react-native";
4
+
5
+ /**
6
+ * The `react-native-keyboard-controller` build of the keyboard parts, from
7
+ * `@vvedantb/native-ui/keyboard-controller`. They follow the keyboard frame
8
+ * by frame on the UI thread, and a drag on the chat transcript moves the
9
+ * keyboard with the finger. Without them (the peer is optional) the kit keeps
10
+ * React Native's `KeyboardAvoidingView`. A context, so only that entry imports
11
+ * the peer and an app without it bundles as before.
12
+ */
13
+
14
+ export const KeyboardPartsContext = createContext(null);
15
+
16
+ /**
17
+ * True inside a part that already keeps its content clear of the keyboard
18
+ * (`ConversationDock` with the keyboard-controller parts, `ChatThread`): the
19
+ * chat parts in it add no lift of their own, so nothing lifts twice.
20
+ */
21
+ export const KeyboardLiftContext = createContext(false);
22
+
23
+ /**
24
+ * The keyboard-controller parts for a chat part that follows the keyboard
25
+ * itself, or `null`: without `KeyboardControllerProvider`, or inside a part
26
+ * that already lifts it (`KeyboardLiftContext`).
27
+ */
28
+ export function useKeyboardParts() {
29
+ const parts = useContext(KeyboardPartsContext);
30
+ const lifted = useContext(KeyboardLiftContext);
31
+ return lifted ? null : parts;
32
+ }
33
+
34
+ /**
35
+ * The `nativeID` of the `PromptInput` field. On iOS the transcript's gesture
36
+ * area keeps its `offset` (the composer above the keyboard) only for the
37
+ * focused field with this id.
38
+ */
39
+ export const COMPOSER_INPUT_ID = "native-ui-composer";
40
+ /**
41
+ * React Native's `KeyboardAvoidingView`, or with
42
+ * `@vvedantb/native-ui/keyboard-controller` the keyboard-controller one, which
43
+ * pads frame by frame with the keyboard instead of in one step at its end.
44
+ */
45
+ export function KeyboardAvoidingView(t0) {
46
+ const $ = _c(7);
47
+ let props;
48
+ let t1;
49
+ if ($[0] !== t0) {
50
+ ({
51
+ behavior: t1,
52
+ ...props
53
+ } = t0);
54
+ $[0] = t0;
55
+ $[1] = props;
56
+ $[2] = t1;
57
+ } else {
58
+ props = $[1];
59
+ t1 = $[2];
60
+ }
61
+ const behavior = t1 === undefined ? "padding" : t1;
62
+ const parts = useContext(KeyboardPartsContext);
63
+ const Avoiding = parts?.AvoidingView ?? NativeKeyboardAvoidingView;
64
+ let t2;
65
+ if ($[3] !== Avoiding || $[4] !== behavior || $[5] !== props) {
66
+ t2 = <Avoiding behavior={behavior} {...props} />;
67
+ $[3] = Avoiding;
68
+ $[4] = behavior;
69
+ $[5] = props;
70
+ $[6] = t2;
71
+ } else {
72
+ t2 = $[6];
73
+ }
74
+ return t2;
75
+ }
@@ -0,0 +1,68 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Platform, View } from "react-native";
3
+ import Animated from "react-native-reanimated";
4
+ import { useReduceMotion } from "../useReduceMotion";
5
+ /**
6
+ * `Animated.View` with layout animations on iOS and Android, a plain `View`
7
+ * on web. With Reduce Motion on, it drops the animations: sheets, toasts and
8
+ * the `Select` popover appear and leave in place.
9
+ */
10
+ function NativeOnlyAnimatedView(t0) {
11
+ const $ = _c(15);
12
+ let children;
13
+ let entering;
14
+ let exiting;
15
+ let layout;
16
+ let props;
17
+ if ($[0] !== t0) {
18
+ ({
19
+ children,
20
+ entering,
21
+ exiting,
22
+ layout,
23
+ ...props
24
+ } = t0);
25
+ $[0] = t0;
26
+ $[1] = children;
27
+ $[2] = entering;
28
+ $[3] = exiting;
29
+ $[4] = layout;
30
+ $[5] = props;
31
+ } else {
32
+ children = $[1];
33
+ entering = $[2];
34
+ exiting = $[3];
35
+ layout = $[4];
36
+ props = $[5];
37
+ }
38
+ const reduceMotion = useReduceMotion();
39
+ if (Platform.OS === "web") {
40
+ let t1;
41
+ if ($[6] !== children || $[7] !== props) {
42
+ t1 = <View {...props}>{children}</View>;
43
+ $[6] = children;
44
+ $[7] = props;
45
+ $[8] = t1;
46
+ } else {
47
+ t1 = $[8];
48
+ }
49
+ return t1;
50
+ }
51
+ const t1 = reduceMotion ? undefined : entering;
52
+ const t2 = reduceMotion ? undefined : exiting;
53
+ const t3 = reduceMotion ? undefined : layout;
54
+ let t4;
55
+ if ($[9] !== children || $[10] !== props || $[11] !== t1 || $[12] !== t2 || $[13] !== t3) {
56
+ t4 = <Animated.View entering={t1} exiting={t2} layout={t3} {...props}>{children}</Animated.View>;
57
+ $[9] = children;
58
+ $[10] = props;
59
+ $[11] = t1;
60
+ $[12] = t2;
61
+ $[13] = t3;
62
+ $[14] = t4;
63
+ } else {
64
+ t4 = $[14];
65
+ }
66
+ return t4;
67
+ }
68
+ export { NativeOnlyAnimatedView };