@vvedantb/native-ui 0.37.2 → 0.38.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 (42) hide show
  1. package/README.md +8 -7
  2. package/dist/app-root/AuthGroupGate.jsx +65 -0
  3. package/dist/app-root/SsoCallbackScreen.jsx +97 -0
  4. package/dist/app-root/fonts.js +88 -0
  5. package/dist/app-root/index.js +3 -0
  6. package/dist/auth/AuthScreen.jsx +252 -74
  7. package/dist/auth/SecondFactorScreen.jsx +18 -12
  8. package/dist/auth/SignInScreen.jsx +40 -17
  9. package/dist/crash/LastCrashDialog.jsx +56 -0
  10. package/dist/crash/lastCrash.js +213 -0
  11. package/dist/entries/app-root.js +6 -0
  12. package/dist/entries/crash.js +5 -0
  13. package/dist/entries/theme.js +3 -0
  14. package/dist/index.js +3 -0
  15. package/dist/neutralTheme.js +163 -0
  16. package/dist/primitives/icon.jsx +0 -4
  17. package/dist/primitives/select.jsx +0 -2
  18. package/dist/settings/ThemeModePicker.jsx +2 -5
  19. package/dist/themeModeStore.js +67 -0
  20. package/dist/themeModes.js +9 -0
  21. package/package.json +47 -19
  22. package/src/app-root/AuthGroupGate.tsx +46 -0
  23. package/src/app-root/SsoCallbackScreen.tsx +62 -0
  24. package/src/app-root/fonts.ts +55 -0
  25. package/src/app-root/index.ts +6 -0
  26. package/src/auth/AuthScreen.tsx +102 -1
  27. package/src/auth/SecondFactorScreen.tsx +20 -2
  28. package/src/auth/SignInScreen.tsx +119 -53
  29. package/src/crash/LastCrashDialog.tsx +42 -0
  30. package/src/crash/lastCrash.ts +239 -0
  31. package/src/entries/app-root.ts +6 -0
  32. package/src/entries/crash.ts +16 -0
  33. package/src/entries/theme.ts +6 -0
  34. package/src/highlight.ts +1 -1
  35. package/src/index.ts +5 -0
  36. package/src/neutralTheme.ts +130 -0
  37. package/src/primitives/icon.tsx +0 -2
  38. package/src/primitives/select.tsx +0 -2
  39. package/src/settings/ThemeModePicker.tsx +2 -5
  40. package/src/themeModeStore.ts +94 -0
  41. package/src/themeModes.ts +10 -0
  42. package/types/prism-react-renderer.d.ts +22 -0
@@ -1,11 +1,16 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
2
  import { useEffect, useState } from "react";
3
3
  import { Keyboard, KeyboardAvoidingView, ScrollView, StyleSheet, Text, View } from "react-native";
4
+ import { useSafeAreaInsets } from "react-native-safe-area-context";
4
5
  import { cn } from "../cn";
5
6
  import { textStyle, typeStyle } from "../controlStyles";
7
+ import { floatingShadow } from "../floating";
6
8
  import { palette } from "../palette";
7
9
  import { tokens } from "../tokens";
8
10
  import { useScheme } from "../useScheme";
11
+ const DEFAULT_HERO_COLOR = "#db2777";
12
+ const DEFAULT_HERO_FOREGROUND = "#ffffff";
13
+
9
14
  /** Space under the form while the keyboard is open, on top of its height. */
10
15
  const KEYBOARD_EXTRA = 24;
11
16
 
@@ -44,7 +49,7 @@ function _temp(sub) {
44
49
  return sub.remove();
45
50
  }
46
51
  export function AuthScreen(t0) {
47
- const $ = _c(39);
52
+ const $ = _c(49);
48
53
  const {
49
54
  title,
50
55
  subtitle,
@@ -52,87 +57,261 @@ export function AuthScreen(t0) {
52
57
  header,
53
58
  footer,
54
59
  testID,
55
- className
60
+ className,
61
+ variant: t1,
62
+ heroColor,
63
+ heroForeground
56
64
  } = t0;
65
+ const variant = t1 === undefined ? "default" : t1;
57
66
  const scheme = useScheme();
58
67
  const keyboardHeight = useKeyboardHeight();
59
68
  const keyboardOpen = keyboardHeight > 0;
60
- const t1 = tokens.color.background[scheme];
61
- let t2;
62
- if ($[0] !== t1) {
63
- t2 = {
64
- backgroundColor: t1
65
- };
66
- $[0] = t1;
67
- $[1] = t2;
68
- } else {
69
- t2 = $[1];
69
+ if (variant === "hero") {
70
+ const t2 = heroColor ?? DEFAULT_HERO_COLOR;
71
+ const t3 = heroForeground ?? DEFAULT_HERO_FOREGROUND;
72
+ let t4;
73
+ if ($[0] !== children || $[1] !== className || $[2] !== footer || $[3] !== header || $[4] !== subtitle || $[5] !== t2 || $[6] !== t3 || $[7] !== testID || $[8] !== title) {
74
+ t4 = <HeroAuthScreen title={title} subtitle={subtitle} header={header} footer={footer} testID={testID} className={className} heroColor={t2} heroForeground={t3}>{children}</HeroAuthScreen>;
75
+ $[0] = children;
76
+ $[1] = className;
77
+ $[2] = footer;
78
+ $[3] = header;
79
+ $[4] = subtitle;
80
+ $[5] = t2;
81
+ $[6] = t3;
82
+ $[7] = testID;
83
+ $[8] = title;
84
+ $[9] = t4;
85
+ } else {
86
+ t4 = $[9];
87
+ }
88
+ return t4;
70
89
  }
71
- const t3 = keyboardOpen ? "justify-start" : "justify-center";
72
- let t4;
73
- if ($[2] !== className || $[3] !== t3) {
74
- t4 = cn("grow px-6 py-12", t3, className);
75
- $[2] = className;
76
- $[3] = t3;
77
- $[4] = t4;
90
+ const t2 = tokens.color.background[scheme];
91
+ let t3;
92
+ if ($[10] !== t2) {
93
+ t3 = {
94
+ backgroundColor: t2
95
+ };
96
+ $[10] = t2;
97
+ $[11] = t3;
78
98
  } else {
79
- t4 = $[4];
99
+ t3 = $[11];
80
100
  }
101
+ const t4 = keyboardOpen ? "justify-start" : "justify-center";
81
102
  let t5;
82
- if ($[5] !== keyboardHeight || $[6] !== keyboardOpen) {
83
- t5 = keyboardOpen ? {
84
- paddingBottom: keyboardHeight + KEYBOARD_EXTRA
85
- } : undefined;
86
- $[5] = keyboardHeight;
87
- $[6] = keyboardOpen;
88
- $[7] = t5;
103
+ if ($[12] !== className || $[13] !== t4) {
104
+ t5 = cn("grow px-6 py-12", t4, className);
105
+ $[12] = className;
106
+ $[13] = t4;
107
+ $[14] = t5;
89
108
  } else {
90
- t5 = $[7];
109
+ t5 = $[14];
91
110
  }
92
111
  let t6;
93
- if ($[8] !== scheme) {
94
- t6 = textStyle("foreground", scheme);
95
- $[8] = scheme;
96
- $[9] = t6;
112
+ if ($[15] !== keyboardHeight || $[16] !== keyboardOpen) {
113
+ t6 = keyboardOpen ? {
114
+ paddingBottom: keyboardHeight + KEYBOARD_EXTRA
115
+ } : undefined;
116
+ $[15] = keyboardHeight;
117
+ $[16] = keyboardOpen;
118
+ $[17] = t6;
97
119
  } else {
98
- t6 = $[9];
120
+ t6 = $[17];
99
121
  }
100
122
  let t7;
101
- if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
102
- t7 = typeStyle("medium");
103
- $[10] = t7;
123
+ if ($[18] !== scheme) {
124
+ t7 = textStyle("foreground", scheme);
125
+ $[18] = scheme;
126
+ $[19] = t7;
104
127
  } else {
105
- t7 = $[10];
128
+ t7 = $[19];
106
129
  }
107
130
  let t8;
108
- if ($[11] !== t6) {
109
- t8 = [t6, t7];
110
- $[11] = t6;
111
- $[12] = t8;
131
+ if ($[20] === Symbol.for("react.memo_cache_sentinel")) {
132
+ t8 = typeStyle("medium");
133
+ $[20] = t8;
112
134
  } else {
113
- t8 = $[12];
135
+ t8 = $[20];
114
136
  }
115
137
  let t9;
116
- if ($[13] !== t8 || $[14] !== title) {
117
- t9 = <Text accessibilityRole="header" className="font-instrument-sans-medium text-2xl" style={t8}>{title}</Text>;
118
- $[13] = t8;
119
- $[14] = title;
120
- $[15] = t9;
138
+ if ($[21] !== t7) {
139
+ t9 = [t7, t8];
140
+ $[21] = t7;
141
+ $[22] = t9;
121
142
  } else {
122
- t9 = $[15];
143
+ t9 = $[22];
123
144
  }
124
145
  let t10;
125
- if ($[16] !== scheme || $[17] !== subtitle) {
126
- t10 = subtitle ? <Text className="font-instrument-sans text-base" style={textStyle("muted", scheme)}>{subtitle}</Text> : null;
127
- $[16] = scheme;
128
- $[17] = subtitle;
129
- $[18] = t10;
146
+ if ($[23] !== t9 || $[24] !== title) {
147
+ t10 = <Text accessibilityRole="header" className="font-instrument-sans-medium text-2xl" style={t9}>{title}</Text>;
148
+ $[23] = t9;
149
+ $[24] = title;
150
+ $[25] = t10;
151
+ } else {
152
+ t10 = $[25];
153
+ }
154
+ let t11;
155
+ if ($[26] !== scheme || $[27] !== subtitle) {
156
+ t11 = subtitle ? <Text className="font-instrument-sans text-base" style={textStyle("muted", scheme)}>{subtitle}</Text> : null;
157
+ $[26] = scheme;
158
+ $[27] = subtitle;
159
+ $[28] = t11;
160
+ } else {
161
+ t11 = $[28];
162
+ }
163
+ let t12;
164
+ if ($[29] !== t10 || $[30] !== t11) {
165
+ t12 = <View className="gap-2">{t10}{t11}</View>;
166
+ $[29] = t10;
167
+ $[30] = t11;
168
+ $[31] = t12;
169
+ } else {
170
+ t12 = $[31];
171
+ }
172
+ let t13;
173
+ if ($[32] !== children) {
174
+ t13 = <View className="gap-4">{children}</View>;
175
+ $[32] = children;
176
+ $[33] = t13;
177
+ } else {
178
+ t13 = $[33];
179
+ }
180
+ let t14;
181
+ if ($[34] !== footer) {
182
+ t14 = footer ? <View className="flex-row flex-wrap items-center justify-center gap-1">{footer}</View> : null;
183
+ $[34] = footer;
184
+ $[35] = t14;
185
+ } else {
186
+ t14 = $[35];
187
+ }
188
+ let t15;
189
+ if ($[36] !== header || $[37] !== t12 || $[38] !== t13 || $[39] !== t14) {
190
+ t15 = <View className="w-full max-w-sm self-center gap-6">{header}{t12}{t13}{t14}</View>;
191
+ $[36] = header;
192
+ $[37] = t12;
193
+ $[38] = t13;
194
+ $[39] = t14;
195
+ $[40] = t15;
196
+ } else {
197
+ t15 = $[40];
198
+ }
199
+ let t16;
200
+ if ($[41] !== t15 || $[42] !== t5 || $[43] !== t6 || $[44] !== testID) {
201
+ t16 = <ScrollView testID={testID} className="flex-1" contentContainerClassName={t5} contentContainerStyle={t6} keyboardShouldPersistTaps="handled" keyboardDismissMode="on-drag">{t15}</ScrollView>;
202
+ $[41] = t15;
203
+ $[42] = t5;
204
+ $[43] = t6;
205
+ $[44] = testID;
206
+ $[45] = t16;
207
+ } else {
208
+ t16 = $[45];
209
+ }
210
+ let t17;
211
+ if ($[46] !== t16 || $[47] !== t3) {
212
+ t17 = <KeyboardAvoidingView behavior="padding" className="flex-1" style={t3}>{t16}</KeyboardAvoidingView>;
213
+ $[46] = t16;
214
+ $[47] = t3;
215
+ $[48] = t17;
216
+ } else {
217
+ t17 = $[48];
218
+ }
219
+ return t17;
220
+ }
221
+ /** The `variant="hero"` frame. Separate so only the hero reads the safe-area insets. */
222
+ function HeroAuthScreen(t0) {
223
+ const $ = _c(38);
224
+ const {
225
+ title,
226
+ subtitle,
227
+ children,
228
+ header,
229
+ footer,
230
+ testID,
231
+ className,
232
+ heroColor,
233
+ heroForeground
234
+ } = t0;
235
+ const scheme = useScheme();
236
+ const insets = useSafeAreaInsets();
237
+ let t1;
238
+ if ($[0] !== heroColor) {
239
+ t1 = {
240
+ backgroundColor: heroColor
241
+ };
242
+ $[0] = heroColor;
243
+ $[1] = t1;
244
+ } else {
245
+ t1 = $[1];
246
+ }
247
+ const t2 = insets.top + 24;
248
+ let t3;
249
+ if ($[2] !== t2) {
250
+ t3 = {
251
+ paddingTop: t2
252
+ };
253
+ $[2] = t2;
254
+ $[3] = t3;
255
+ } else {
256
+ t3 = $[3];
257
+ }
258
+ let t4;
259
+ if ($[4] !== heroForeground) {
260
+ t4 = {
261
+ color: heroForeground
262
+ };
263
+ $[4] = heroForeground;
264
+ $[5] = t4;
265
+ } else {
266
+ t4 = $[5];
267
+ }
268
+ let t5;
269
+ if ($[6] !== t4 || $[7] !== title) {
270
+ t5 = <Text accessibilityRole="header" className="mt-10 mb-1 text-4xl font-instrument-sans-medium" style={t4}>{title}</Text>;
271
+ $[6] = t4;
272
+ $[7] = title;
273
+ $[8] = t5;
274
+ } else {
275
+ t5 = $[8];
276
+ }
277
+ let t6;
278
+ if ($[9] !== heroForeground || $[10] !== subtitle) {
279
+ t6 = subtitle ? <Text className="text-lg font-instrument-sans-medium" style={{
280
+ color: heroForeground
281
+ }}>{subtitle}</Text> : null;
282
+ $[9] = heroForeground;
283
+ $[10] = subtitle;
284
+ $[11] = t6;
285
+ } else {
286
+ t6 = $[11];
287
+ }
288
+ let t7;
289
+ if ($[12] !== header || $[13] !== t3 || $[14] !== t5 || $[15] !== t6) {
290
+ t7 = <View className="px-6 pb-6" style={t3}>{header}{t5}{t6}</View>;
291
+ $[12] = header;
292
+ $[13] = t3;
293
+ $[14] = t5;
294
+ $[15] = t6;
295
+ $[16] = t7;
296
+ } else {
297
+ t7 = $[16];
298
+ }
299
+ let t8;
300
+ if ($[17] !== className) {
301
+ t8 = cn("grow rounded-t-[32px] px-6 pt-8", className);
302
+ $[17] = className;
303
+ $[18] = t8;
130
304
  } else {
131
- t10 = $[18];
305
+ t8 = $[18];
132
306
  }
307
+ const t9 = tokens.color.surface[scheme];
308
+ const t10 = insets.bottom + 24;
133
309
  let t11;
134
310
  if ($[19] !== t10 || $[20] !== t9) {
135
- t11 = <View className="gap-2">{t9}{t10}</View>;
311
+ t11 = [{
312
+ backgroundColor: t9,
313
+ paddingBottom: t10
314
+ }, floatingShadow];
136
315
  $[19] = t10;
137
316
  $[20] = t9;
138
317
  $[21] = t11;
@@ -149,42 +328,41 @@ export function AuthScreen(t0) {
149
328
  }
150
329
  let t13;
151
330
  if ($[24] !== footer) {
152
- t13 = footer ? <View className="flex-row flex-wrap items-center justify-center gap-1">{footer}</View> : null;
331
+ t13 = footer ? <View className="mt-6 flex-row flex-wrap items-center justify-center gap-1">{footer}</View> : null;
153
332
  $[24] = footer;
154
333
  $[25] = t13;
155
334
  } else {
156
335
  t13 = $[25];
157
336
  }
158
337
  let t14;
159
- if ($[26] !== header || $[27] !== t11 || $[28] !== t12 || $[29] !== t13) {
160
- t14 = <View className="w-full max-w-sm self-center gap-6">{header}{t11}{t12}{t13}</View>;
161
- $[26] = header;
162
- $[27] = t11;
163
- $[28] = t12;
164
- $[29] = t13;
338
+ if ($[26] !== t11 || $[27] !== t12 || $[28] !== t13 || $[29] !== t8) {
339
+ t14 = <View className={t8} style={t11}>{t12}{t13}</View>;
340
+ $[26] = t11;
341
+ $[27] = t12;
342
+ $[28] = t13;
343
+ $[29] = t8;
165
344
  $[30] = t14;
166
345
  } else {
167
346
  t14 = $[30];
168
347
  }
169
348
  let t15;
170
- if ($[31] !== t14 || $[32] !== t4 || $[33] !== t5 || $[34] !== testID) {
171
- t15 = <ScrollView testID={testID} className="flex-1" contentContainerClassName={t4} contentContainerStyle={t5} keyboardShouldPersistTaps="handled" keyboardDismissMode="on-drag">{t14}</ScrollView>;
349
+ if ($[31] !== t14 || $[32] !== t7 || $[33] !== testID) {
350
+ t15 = <ScrollView testID={testID} className="flex-1" contentContainerClassName="grow" keyboardShouldPersistTaps="handled" keyboardDismissMode="on-drag">{t7}{t14}</ScrollView>;
172
351
  $[31] = t14;
173
- $[32] = t4;
174
- $[33] = t5;
175
- $[34] = testID;
176
- $[35] = t15;
352
+ $[32] = t7;
353
+ $[33] = testID;
354
+ $[34] = t15;
177
355
  } else {
178
- t15 = $[35];
356
+ t15 = $[34];
179
357
  }
180
358
  let t16;
181
- if ($[36] !== t15 || $[37] !== t2) {
182
- t16 = <KeyboardAvoidingView behavior="padding" className="flex-1" style={t2}>{t15}</KeyboardAvoidingView>;
359
+ if ($[35] !== t1 || $[36] !== t15) {
360
+ t16 = <KeyboardAvoidingView behavior="padding" className="flex-1" style={t1}>{t15}</KeyboardAvoidingView>;
361
+ $[35] = t1;
183
362
  $[36] = t15;
184
- $[37] = t2;
185
- $[38] = t16;
363
+ $[37] = t16;
186
364
  } else {
187
- t16 = $[38];
365
+ t16 = $[37];
188
366
  }
189
367
  return t16;
190
368
  }
@@ -7,7 +7,7 @@ import { Input } from "../Input";
7
7
  import { AuthScreen, FieldError } from "./AuthScreen";
8
8
  /** A one-time code step: digits only, a Verify button, an inline error and a back link. */
9
9
  export function SecondFactorScreen(t0) {
10
- const $ = _c(40);
10
+ const $ = _c(43);
11
11
  const {
12
12
  title,
13
13
  description,
@@ -21,7 +21,10 @@ export function SecondFactorScreen(t0) {
21
21
  testIDPrefix: t4,
22
22
  footer,
23
23
  digitsOnly: t5,
24
- placeholder
24
+ placeholder,
25
+ variant,
26
+ heroColor,
27
+ heroForeground
25
28
  } = t0;
26
29
  const codeLength = t1 === undefined ? 6 : t1;
27
30
  const loading = t2 === undefined ? false : t2;
@@ -114,20 +117,23 @@ export function SecondFactorScreen(t0) {
114
117
  t18 = $[29];
115
118
  }
116
119
  let t19;
117
- if ($[30] !== description || $[31] !== footer || $[32] !== header || $[33] !== t12 || $[34] !== t14 || $[35] !== t17 || $[36] !== t18 || $[37] !== t7 || $[38] !== title) {
118
- t19 = <AuthScreen testID={t7} title={title} subtitle={description} header={header} footer={footer}>{t12}{t14}{t17}{t18}</AuthScreen>;
120
+ if ($[30] !== description || $[31] !== footer || $[32] !== header || $[33] !== heroColor || $[34] !== heroForeground || $[35] !== t12 || $[36] !== t14 || $[37] !== t17 || $[38] !== t18 || $[39] !== t7 || $[40] !== title || $[41] !== variant) {
121
+ t19 = <AuthScreen testID={t7} title={title} subtitle={description} header={header} footer={footer} variant={variant} heroColor={heroColor} heroForeground={heroForeground}>{t12}{t14}{t17}{t18}</AuthScreen>;
119
122
  $[30] = description;
120
123
  $[31] = footer;
121
124
  $[32] = header;
122
- $[33] = t12;
123
- $[34] = t14;
124
- $[35] = t17;
125
- $[36] = t18;
126
- $[37] = t7;
127
- $[38] = title;
128
- $[39] = t19;
125
+ $[33] = heroColor;
126
+ $[34] = heroForeground;
127
+ $[35] = t12;
128
+ $[36] = t14;
129
+ $[37] = t17;
130
+ $[38] = t18;
131
+ $[39] = t7;
132
+ $[40] = title;
133
+ $[41] = variant;
134
+ $[42] = t19;
129
135
  } else {
130
- t19 = $[39];
136
+ t19 = $[42];
131
137
  }
132
138
  return t19;
133
139
  }
@@ -9,6 +9,7 @@ import { Input } from "../Input";
9
9
  import { PasswordInput } from "../PasswordInput";
10
10
  import { toast } from "../toastStore";
11
11
  import { useScheme } from "../useScheme";
12
+ import { SettingsField } from "../settings/SettingsField";
12
13
  import { AuthScreen, FieldError, OrDivider } from "./AuthScreen";
13
14
  import { authErrorMessage, DEFAULT_STAGE_TIMEOUT_MS, isAuthTimeoutError, logAuthFailure, withAuthTimeout } from "./authErrors";
14
15
  import { clerkCall, signInCalls } from "./clerkCore3";
@@ -130,11 +131,29 @@ export function SignInScreen({
130
131
  minPasswordLength,
131
132
  errorDisplay = "toast",
132
133
  testIDPrefix,
134
+ testIDs,
133
135
  header,
134
136
  footer,
135
137
  onIncomplete,
136
- stageTimeoutMs = DEFAULT_STAGE_TIMEOUT_MS
138
+ stageTimeoutMs = DEFAULT_STAGE_TIMEOUT_MS,
139
+ variant,
140
+ heroColor,
141
+ heroForeground,
142
+ submitLabel,
143
+ footerPrompt,
144
+ footerLinkLabel,
145
+ showFieldLabels = false,
146
+ emailPlaceholder = "Email",
147
+ passwordPlaceholder = "Password",
148
+ googleVariant,
149
+ googleSize
137
150
  }) {
151
+ const heroProps = {
152
+ variant,
153
+ heroColor,
154
+ heroForeground
155
+ };
156
+ const labelled = (label, control) => showFieldLabels ? <SettingsField label={label}>{control}</SettingsField> : control;
138
157
  // Both are always defined: before Clerk loads, a call waits for it.
139
158
  const signIn = signInCalls(useSignIn().signIn);
140
159
  const signUpAttempt = useSignUp().signUp;
@@ -170,7 +189,7 @@ export function SignInScreen({
170
189
  const confirmField = useRef(null);
171
190
  const signUp = mode === "sign-up";
172
191
  const reset = mode === "reset-password";
173
- const id = name => `${testIDPrefix ?? mode}-${name}`;
192
+ const id = name => testIDs?.[name] ?? `${testIDPrefix ?? mode}-${name}`;
174
193
  const fail = (heading, message) => {
175
194
  if (errorDisplay === "inline") setError(message);else toast.error(heading, message === heading ? undefined : {
176
195
  description: message
@@ -452,17 +471,17 @@ export function SignInScreen({
452
471
  const footerRow = <>
453
472
  {linkHref && !pendingVerification ? <>
454
473
  <Text className="font-instrument-sans text-sm" style={textStyle("muted", colorScheme)}>
455
- {reset ? "Remembered your password?" : signUp ? "Already have an account?" : "Don't have an account?"}
474
+ {footerPrompt ?? (reset ? "Remembered your password?" : signUp ? "Already have an account?" : "Don't have an account?")}
456
475
  </Text>
457
476
  <Button testID={id(toSignIn ? "sign-in-link" : "sign-up-link")} variant="link" size="sm" fullWidth={false} onPress={() => router.push(linkHref)}>
458
- {toSignIn ? "Sign in" : "Sign up"}
477
+ {footerLinkLabel ?? (toSignIn ? "Sign in" : "Sign up")}
459
478
  </Button>
460
479
  </> : null}
461
480
  {footer}
462
481
  </>;
463
482
  const hasFooter = Boolean(linkHref && !pendingVerification || footer);
464
483
  if (pendingNewPassword) {
465
- return <AuthScreen testID={id("new-password-screen")} title={AUTH_MESSAGES.newPasswordTitle} subtitle={reset ? AUTH_MESSAGES.resetNewPasswordDescription : AUTH_MESSAGES.newPasswordDescription} header={header}>
484
+ return <AuthScreen testID={id("new-password-screen")} title={AUTH_MESSAGES.newPasswordTitle} subtitle={reset ? AUTH_MESSAGES.resetNewPasswordDescription : AUTH_MESSAGES.newPasswordDescription} header={header} {...heroProps}>
466
485
  <PasswordInput testID={id("new-password")} accessibilityLabel={AUTH_MESSAGES.newPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" autoFocus returnKeyType="next" submitBehavior="submit" onSubmitEditing={() => confirmField.current?.focus()} value={newPassword} placeholder={AUTH_MESSAGES.newPasswordLabel} onChangeText={setNewPassword} />
467
486
  <PasswordInput testID={id("confirm-password")} ref={confirmField} accessibilityLabel={AUTH_MESSAGES.confirmPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" returnKeyType="go" value={confirmPassword} placeholder={AUTH_MESSAGES.confirmPasswordLabel} onChangeText={setConfirmPassword} onSubmitEditing={() => void onNewPassword()} />
468
487
  <FieldError testID={id("error")} message={error} />
@@ -477,7 +496,7 @@ export function SignInScreen({
477
496
  if (pendingResetCode && !pendingSecondFactor) {
478
497
  return <SecondFactorScreen key="reset-code" title={AUTH_MESSAGES.emailCodeTitle} description={AUTH_MESSAGES.emailCodeDescription} footer={<Button testID={id("resend")} variant="link" size="sm" fullWidth={false} disabled={resetLoading} onPress={() => void onResetResend()}>
479
498
  {AUTH_MESSAGES.resendCode}
480
- </Button>} onSubmit={onResetCode} error={resetCodeError} loading={resetLoading} onBack={onSecondFactorBack} backLabel="Use a different email" header={header} testIDPrefix={id("email-code")} />;
499
+ </Button>} onSubmit={onResetCode} error={resetCodeError} loading={resetLoading} onBack={onSecondFactorBack} backLabel="Use a different email" header={header} {...heroProps} testIDPrefix={id("email-code")} />;
481
500
  }
482
501
  if (pendingFirstFactor && !pendingSecondFactor && !pendingNewPassword) {
483
502
  const others = supportedFirstFactorStrategies(firstFactors).filter(strategy_3 => strategy_3 !== firstStrategy);
@@ -485,7 +504,7 @@ export function SignInScreen({
485
504
  const copy = secondFactorCopy(firstStrategy, false);
486
505
  return <SecondFactorScreen key={`first-${firstStrategy}`} title={copy.title} description={copy.description} footer={switchTo ? <Button testID={id("first-factor-switch")} variant="link" size="sm" fullWidth={false} disabled={firstLoading} onPress={() => void chooseFirstStrategy(switchTo, firstFactors)}>
487
506
  {METHOD_LABEL[switchTo]}
488
- </Button> : undefined} onSubmit={onFirstFactor} error={firstError} loading={firstLoading} onBack={onSecondFactorBack} backLabel="Use a different account" header={header} testIDPrefix={id("first-factor")} />;
507
+ </Button> : undefined} onSubmit={onFirstFactor} error={firstError} loading={firstLoading} onBack={onSecondFactorBack} backLabel="Use a different account" header={header} {...heroProps} testIDPrefix={id("first-factor")} />;
489
508
  }
490
509
  if (pendingSecondFactor) {
491
510
  const active = secondFactor.strategy;
@@ -497,10 +516,10 @@ export function SignInScreen({
497
516
  const backup = active === "backup_code";
498
517
  return <SecondFactorScreen key={active} title={copy_0.title} description={copy_0.description} codeLength={backup ? 8 : 6} digitsOnly={!backup} placeholder="Backup code" footer={switchTo_0 ? <Button testID={id("second-factor-switch")} variant="link" size="sm" fullWidth={false} disabled={secondFactor.loading} onPress={() => void chooseStrategy(switchTo_0, factors)}>
499
518
  {METHOD_LABEL[switchTo_0]}
500
- </Button> : undefined} onSubmit={onSecondFactor} error={secondFactor.error} loading={secondFactor.loading} onBack={onSecondFactorBack} backLabel="Use a different account" header={header} testIDPrefix={id("second-factor")} />;
519
+ </Button> : undefined} onSubmit={onSecondFactor} error={secondFactor.error} loading={secondFactor.loading} onBack={onSecondFactorBack} backLabel="Use a different account" header={header} {...heroProps} testIDPrefix={id("second-factor")} />;
501
520
  }
502
521
  if (pendingVerification) {
503
- return <AuthScreen testID={id("screen")} title="Check your email" subtitle="Enter the code we sent to your email." header={header} footer={hasFooter ? footerRow : undefined}>
522
+ return <AuthScreen testID={id("screen")} title="Check your email" subtitle="Enter the code we sent to your email." header={header} footer={hasFooter ? footerRow : undefined} {...heroProps}>
504
523
  <Input testID={id("code")} accessibilityLabel="Verification code" value={code} placeholder="Verification code" keyboardType="number-pad" autoComplete="one-time-code" textContentType="oneTimeCode" autoFocus returnKeyType="go" onChangeText={setCode} onSubmitEditing={() => void onVerify()} />
505
524
  <FieldError testID={id("error")} message={error} />
506
525
  <Button testID={id("verify")} loading={submitting} onPress={() => void onVerify()}>
@@ -515,21 +534,25 @@ export function SignInScreen({
515
534
  </Button>
516
535
  </AuthScreen>;
517
536
  }
518
- return <AuthScreen testID={id("screen")} title={title ?? (reset ? AUTH_MESSAGES.resetTitle : signUp ? "Create account" : "Welcome back")} subtitle={subtitle ?? (reset ? AUTH_MESSAGES.resetSubtitle : signUp ? "Sign up to get started" : "Sign in to continue")} header={header} footer={hasFooter ? footerRow : undefined}>
537
+ return <AuthScreen testID={id("screen")} title={title ?? (reset ? AUTH_MESSAGES.resetTitle : signUp ? "Create account" : "Welcome back")} subtitle={subtitle ?? (reset ? AUTH_MESSAGES.resetSubtitle : signUp ? "Sign up to get started" : "Sign in to continue")} header={header} footer={hasFooter ? footerRow : undefined} {...heroProps}>
519
538
  {showGoogle && !reset ? <>
520
- <GoogleSignInButton testID={id("google")} scheme={scheme} redirectPath={redirectPath} afterAuthHref={afterAuthHref} replaceOptions={replaceOptions} onSuccess={onSuccess} onError={message_0 => fail(message_0, message_0)} label={googleLabel} disabled={submitting} />
539
+ <GoogleSignInButton testID={id("google")} scheme={scheme} redirectPath={redirectPath} afterAuthHref={afterAuthHref} replaceOptions={replaceOptions} onSuccess={onSuccess} onError={message_0 => fail(message_0, message_0)} label={googleLabel} disabled={submitting} {...googleVariant ? {
540
+ variant: googleVariant
541
+ } : null} {...googleSize ? {
542
+ size: googleSize
543
+ } : null} />
521
544
  <OrDivider />
522
545
  </> : null}
523
- <Input testID={id("email")} accessibilityLabel="Email" autoCapitalize="none" autoComplete="email" textContentType="emailAddress" keyboardType="email-address" returnKeyType={reset ? "go" : "next"} submitBehavior={reset ? undefined : "submit"} onSubmitEditing={() => reset ? void onResetRequest() : passwordField.current?.focus()} value={email} placeholder="Email" onChangeText={setEmail} />
524
- {reset ? null : <PasswordInput testID={id("password")} ref={passwordField} accessibilityLabel="Password" autoCapitalize="none" autoComplete={signUp ? "new-password" : "password"} textContentType={signUp ? "newPassword" : "password"} returnKeyType={signUp ? "next" : "go"} submitBehavior={signUp ? "submit" : undefined} value={password} placeholder="Password" onChangeText={text => {
546
+ {labelled("Email", <Input testID={id("email")} accessibilityLabel="Email" autoCapitalize="none" autoComplete="email" textContentType="emailAddress" keyboardType="email-address" returnKeyType={reset ? "go" : "next"} submitBehavior={reset ? undefined : "submit"} onSubmitEditing={() => reset ? void onResetRequest() : passwordField.current?.focus()} value={email} placeholder={emailPlaceholder} onChangeText={setEmail} />)}
547
+ {reset ? null : labelled("Password", <PasswordInput testID={id("password")} ref={passwordField} accessibilityLabel="Password" autoCapitalize="none" autoComplete={signUp ? "new-password" : "password"} textContentType={signUp ? "newPassword" : "password"} returnKeyType={signUp ? "next" : "go"} submitBehavior={signUp ? "submit" : undefined} value={password} placeholder={passwordPlaceholder} onChangeText={text => {
525
548
  setPassword(text);
526
549
  setMismatch(false);
527
- }} onSubmitEditing={() => signUp ? confirmField.current?.focus() : void onSignIn()} />}
550
+ }} onSubmitEditing={() => signUp ? confirmField.current?.focus() : void onSignIn()} />)}
528
551
  {signUp ? <>
529
- <PasswordInput testID={id("confirm-password")} ref={confirmField} accessibilityLabel={AUTH_MESSAGES.confirmSignUpPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" returnKeyType="go" value={signUpConfirm} placeholder={AUTH_MESSAGES.confirmSignUpPasswordLabel} onChangeText={text_0 => {
552
+ {labelled("Confirm password", <PasswordInput testID={id("confirm-password")} ref={confirmField} accessibilityLabel={AUTH_MESSAGES.confirmSignUpPasswordLabel} autoCapitalize="none" autoComplete="new-password" textContentType="newPassword" returnKeyType="go" value={signUpConfirm} placeholder={AUTH_MESSAGES.confirmSignUpPasswordLabel} onChangeText={text_0 => {
530
553
  setSignUpConfirm(text_0);
531
554
  setMismatch(false);
532
- }} onSubmitEditing={() => void onSignUp()} />
555
+ }} onSubmitEditing={() => void onSignUp()} />)}
533
556
  <FieldError testID={id("confirm-error")} message={mismatch ? AUTH_MESSAGES.passwordMismatch : ""} />
534
557
  </> : null}
535
558
  {!signUp && !reset && forgotPasswordHref ? <View className="items-end">
@@ -539,7 +562,7 @@ export function SignInScreen({
539
562
  </View> : null}
540
563
  <FieldError testID={id("error")} message={error} />
541
564
  <Button testID={id("submit")} loading={submitting} onPress={() => void (reset ? onResetRequest() : signUp ? onSignUp() : onSignIn())}>
542
- {reset ? AUTH_MESSAGES.sendResetCode : signUp ? "Create account" : "Sign in"}
565
+ {reset ? AUTH_MESSAGES.sendResetCode : submitLabel ?? (signUp ? "Create account" : "Sign in")}
543
566
  </Button>
544
567
  {/* Bot protection mounts its widget here on web sign-up. */}
545
568
  {signUp ? <View nativeID="clerk-captcha" /> : null}
@@ -0,0 +1,56 @@
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import { Share } from "react-native";
3
+ import { ConfirmDialog } from "../ConfirmDialog";
4
+ import { crashDetails, dismissLastCrash, useLastCrash } from "./lastCrash";
5
+ /**
6
+ * "<App> closed after an error", once at start when the last session ended in
7
+ * a fatal error saved by `installCrashCapture`: the message, and a button for
8
+ * the full details to paste into a chat. Mount it once in the root layout.
9
+ */
10
+ export function LastCrashDialog(t0) {
11
+ const $ = _c(11);
12
+ const {
13
+ appName,
14
+ onCopy,
15
+ testID: t1
16
+ } = t0;
17
+ const testID = t1 === undefined ? "last-crash" : t1;
18
+ const crash = useLastCrash();
19
+ const t2 = crash !== null;
20
+ const t3 = `${appName} closed after an error`;
21
+ const t4 = crash ? `${crash.name}: ${crash.message}` : undefined;
22
+ const t5 = onCopy ? "Copy details" : "Share details";
23
+ let t6;
24
+ if ($[0] !== appName || $[1] !== crash || $[2] !== onCopy) {
25
+ t6 = () => {
26
+ if (crash) {
27
+ const details = crashDetails(crash, appName);
28
+ (onCopy ? onCopy(details) : Share.share({
29
+ message: details
30
+ })).catch(_temp);
31
+ }
32
+ dismissLastCrash();
33
+ };
34
+ $[0] = appName;
35
+ $[1] = crash;
36
+ $[2] = onCopy;
37
+ $[3] = t6;
38
+ } else {
39
+ t6 = $[3];
40
+ }
41
+ let t7;
42
+ if ($[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== t5 || $[8] !== t6 || $[9] !== testID) {
43
+ t7 = <ConfirmDialog testID={testID} open={t2} title={t3} description={t4} cancelLabel="Dismiss" confirmLabel={t5} onCancel={dismissLastCrash} onConfirm={t6} />;
44
+ $[4] = t2;
45
+ $[5] = t3;
46
+ $[6] = t4;
47
+ $[7] = t5;
48
+ $[8] = t6;
49
+ $[9] = testID;
50
+ $[10] = t7;
51
+ } else {
52
+ t7 = $[10];
53
+ }
54
+ return t7;
55
+ }
56
+ function _temp() {}