@vvedantb/native-ui 0.38.0 → 0.40.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.
- package/dist/Avatar.jsx +22 -19
- package/dist/BottomSheetContainer.jsx +0 -6
- package/dist/BulkActionBar.jsx +0 -24
- package/dist/Button.jsx +92 -116
- package/dist/Card.jsx +56 -50
- package/dist/ColorSwatches.jsx +0 -6
- package/dist/Dialog.jsx +0 -12
- package/dist/DropdownMenu.jsx +0 -10
- package/dist/EmptyState.jsx +0 -3
- package/dist/ExpoWebRoot.jsx +0 -6
- package/dist/Field.jsx +0 -17
- package/dist/FloatingSurface.jsx +95 -80
- package/dist/FloatingTabBar.jsx +0 -23
- package/dist/IconButton.jsx +0 -1
- package/dist/LoadingState.jsx +0 -6
- package/dist/PasswordInput.jsx +0 -15
- package/dist/PillTabs.jsx +39 -36
- package/dist/SearchInput.jsx +0 -13
- package/dist/SectionLabel.jsx +0 -1
- package/dist/SharedTransition.jsx +0 -3
- package/dist/Skeleton.jsx +0 -2
- package/dist/Spinner.jsx +0 -2
- package/dist/StatusDot.jsx +0 -5
- package/dist/Switch.jsx +32 -22
- package/dist/Tabs.jsx +27 -26
- package/dist/Textarea.jsx +0 -1
- package/dist/ThemeToggle.jsx +0 -1
- package/dist/Toast.jsx +80 -91
- package/dist/UpdateChecker.jsx +0 -1
- package/dist/ai/activity-question.jsx +0 -6
- package/dist/ai/activity-step-label.js +0 -6
- package/dist/ai/activity-step-types.js +0 -4
- package/dist/ai/activity-tasks-utils.js +0 -17
- package/dist/ai/activity-timeline.js +0 -8
- package/dist/ai/attachments.jsx +0 -2
- package/dist/ai/chain-of-thought.jsx +0 -3
- package/dist/ai/chat-text.js +2 -3
- package/dist/ai/chat-thread.jsx +0 -1
- package/dist/ai/choice-question.jsx +0 -10
- package/dist/ai/code-block.jsx +0 -31
- package/dist/ai/collapsible.jsx +0 -14
- package/dist/ai/conversation-context.js +0 -3
- package/dist/ai/conversation.jsx +2 -48
- package/dist/ai/file-chip.jsx +0 -2
- package/dist/ai/icon-button.jsx +10 -18
- package/dist/ai/index.js +0 -5
- package/dist/ai/message-context-menu.jsx +0 -7
- package/dist/ai/message.jsx +0 -21
- package/dist/ai/prompt-input-menu.jsx +0 -3
- package/dist/ai/prompt-input.jsx +2 -29
- package/dist/ai/response-text.jsx +0 -6
- package/dist/ai/sources.jsx +0 -1
- package/dist/ai/suggestion.jsx +0 -1
- package/dist/ai/trace.jsx +0 -11
- package/dist/ai/unified-diff.jsx +0 -4
- package/dist/auth/AuthScreen.jsx +0 -5
- package/dist/auth/GoogleSignInButton.jsx +0 -3
- package/dist/auth/SecondFactorScreen.jsx +0 -2
- package/dist/auth/SignInScreen.jsx +0 -17
- package/dist/auth/authErrors.js +0 -4
- package/dist/auth/clerkCore3.js +0 -7
- package/dist/auth/index.js +0 -4
- package/dist/auth/totp.js +0 -2
- package/dist/brand/GoogleMark.jsx +0 -1
- package/dist/brand/ProviderIcon.jsx +0 -2
- package/dist/brand/index.js +0 -3
- package/dist/brand/svg.js +0 -6
- package/dist/configureTheme.js +0 -9
- package/dist/controlStyles.js +0 -14
- package/dist/crash/lastCrash.js +3 -24
- package/dist/entries/ai.js +0 -3
- package/dist/entries/ambient.js +0 -2
- package/dist/entries/app-root.js +0 -5
- package/dist/entries/auth.js +0 -4
- package/dist/entries/bottom-sheet.js +0 -2
- package/dist/entries/brand.js +0 -1
- package/dist/entries/button.js +0 -1
- package/dist/entries/crash.js +0 -3
- package/dist/entries/date-time.js +0 -2
- package/dist/entries/expo-router.js +0 -3
- package/dist/entries/expo-web-root.js +0 -2
- package/dist/entries/floating.js +0 -2
- package/dist/entries/generative-ui.js +0 -4
- package/dist/entries/gesture-handler.js +0 -3
- package/dist/entries/keyboard-controller.js +0 -3
- package/dist/entries/layout.js +0 -2
- package/dist/entries/markdown.js +0 -3
- package/dist/entries/marketing.js +0 -1
- package/dist/entries/page-title.js +0 -5
- package/dist/entries/password-input.js +0 -2
- package/dist/entries/paste-input.js +0 -3
- package/dist/entries/primitives.js +0 -6
- package/dist/entries/search-input.js +0 -2
- package/dist/entries/tab-bar.js +0 -2
- package/dist/entries/theme.js +1 -2
- package/dist/entries/toast.js +0 -3
- package/dist/entries/video.js +0 -2
- package/dist/entries/webview.js +0 -2
- package/dist/examples/AiChatGallery.jsx +0 -11
- package/dist/examples/ParityGallery.jsx +0 -12
- package/dist/floating.js +0 -8
- package/dist/generative-ui/GenerativeUiPanel.jsx +0 -2
- package/dist/generative-ui/components.jsx +0 -8
- package/dist/glass.js +55 -0
- package/dist/glassBlur.jsx +0 -12
- package/dist/highlight.js +0 -26
- package/dist/index.js +1 -2
- package/dist/loadingGrid.js +0 -13
- package/dist/markdown/Markdown.jsx +0 -59
- package/dist/markdown/MarkdownTable.jsx +0 -18
- package/dist/markdown/tableText.js +0 -5
- package/dist/marketing/UpgradeToProCard.jsx +0 -5
- package/dist/marketing/pricing.js +0 -3
- package/dist/media/ImageGallery.jsx +0 -16
- package/dist/media/imageZoom.js +0 -4
- package/dist/media/zoom-image-gesture.jsx +0 -8
- package/dist/media/zoomImage.js +0 -3
- package/dist/motion.js +0 -3
- package/dist/neutralTheme.js +0 -5
- package/dist/pagerSwipe.js +0 -16
- package/dist/palette.js +0 -10
- package/dist/primitives/button.jsx +0 -5
- package/dist/primitives/keyboard-controller.jsx +0 -27
- package/dist/primitives/native-only-animated-view.jsx +0 -5
- package/dist/primitives/overlay.jsx +0 -2
- package/dist/primitives/pager-gesture.jsx +3 -29
- package/dist/primitives/paste-input.jsx +0 -5
- package/dist/primitives/select.jsx +0 -8
- package/dist/primitives/sheet-drag.jsx +0 -3
- package/dist/primitives/sheet-gesture.jsx +0 -8
- package/dist/primitives/swipe-row-gesture.jsx +3 -45
- package/dist/primitives/text.jsx +0 -5
- package/dist/primitives/toast-drag-gesture.jsx +4 -24
- package/dist/primitives/web-click-guard.js +0 -3
- package/dist/primitives/window-layer.jsx +0 -14
- package/dist/push.js +0 -6
- package/dist/relativeTime.js +0 -13
- package/dist/settings/MoreFromProjectV.jsx +0 -5
- package/dist/settings/ThemeModePicker.jsx +0 -4
- package/dist/settings/projectVMobileApps.js +1 -6
- package/dist/sheetDrag.js +0 -10
- package/dist/swipeRow.js +0 -15
- package/dist/tabBarRoutes.js +0 -4
- package/dist/tabIndicator.js +0 -4
- package/dist/tailwind-preset.cjs +0 -54
- package/dist/tailwind-preset.d.cts +0 -8
- package/dist/theme.jsx +29 -21
- package/dist/themeModeStore.js +0 -5
- package/dist/toastChrome.js +0 -6
- package/dist/toastDrag.js +0 -14
- package/dist/toastStore.js +0 -4
- package/dist/updateCheck.js +0 -7
- package/dist/video/InlineVideo.jsx +0 -2
- package/dist/webview/htmlView.js +0 -5
- package/package.json +3 -3
- package/src/ArtifactList.tsx +0 -2
- package/src/Avatar.tsx +3 -3
- package/src/Badge.tsx +0 -1
- package/src/BottomSheetContainer.tsx +0 -11
- package/src/BulkActionBar.tsx +0 -66
- package/src/Button.tsx +4 -40
- package/src/CaptureButton.tsx +0 -1
- package/src/Card.tsx +3 -15
- package/src/Checkbox.tsx +0 -2
- package/src/ColorSwatches.tsx +0 -9
- package/src/ConfirmDialog.tsx +0 -7
- package/src/DateTimeField.tsx +0 -5
- package/src/Dialog.tsx +0 -27
- package/src/DividedList.tsx +0 -1
- package/src/DropdownMenu.tsx +0 -51
- package/src/EmptyState.tsx +0 -5
- package/src/ExpoWebRoot.tsx +0 -10
- package/src/Field.tsx +0 -14
- package/src/FloatingFAB.tsx +0 -3
- package/src/FloatingSurface.tsx +11 -8
- package/src/FloatingTabBar.tsx +0 -25
- package/src/IconButton.tsx +0 -5
- package/src/Input.tsx +0 -1
- package/src/Label.tsx +0 -1
- package/src/LabeledSwitchRow.tsx +0 -2
- package/src/ListRow.tsx +0 -12
- package/src/LoadingState.tsx +0 -12
- package/src/MenuSheet.tsx +0 -2
- package/src/PageIndicator.tsx +0 -2
- package/src/PageTitle.tsx +0 -15
- package/src/Pager.tsx +0 -9
- package/src/PasswordInput.tsx +0 -24
- package/src/PillTabs.tsx +3 -11
- package/src/PinnedBotTile.tsx +0 -6
- package/src/Progress.tsx +0 -3
- package/src/ReactionRow.tsx +0 -8
- package/src/ScreenContainer.tsx +0 -4
- package/src/SearchInput.tsx +0 -25
- package/src/SectionLabel.tsx +0 -2
- package/src/Select.tsx +0 -6
- package/src/Separator.tsx +0 -2
- package/src/SharedTransition.tsx +0 -7
- package/src/Sheet.tsx +0 -3
- package/src/SheetRow.tsx +0 -12
- package/src/Skeleton.tsx +0 -10
- package/src/Spinner.tsx +0 -6
- package/src/StackPageHeader.tsx +0 -16
- package/src/StatGrid.tsx +0 -1
- package/src/StatusDot.tsx +0 -6
- package/src/SurfaceRow.tsx +0 -12
- package/src/SwipeableRow.tsx +0 -4
- package/src/Switch.tsx +3 -4
- package/src/Tabs.tsx +3 -27
- package/src/Textarea.tsx +0 -2
- package/src/ThemeToggle.tsx +0 -1
- package/src/Toast.tsx +3 -19
- package/src/UpdateChecker.tsx +0 -46
- package/src/ai/activity-question.tsx +0 -8
- package/src/ai/activity-step-detail.tsx +0 -5
- package/src/ai/activity-step-label.ts +0 -5
- package/src/ai/activity-step-types.ts +0 -24
- package/src/ai/activity-step.tsx +0 -4
- package/src/ai/activity-tasks-utils.ts +0 -13
- package/src/ai/activity-timeline.ts +0 -6
- package/src/ai/attachments.tsx +0 -13
- package/src/ai/chain-of-thought.tsx +0 -5
- package/src/ai/chat-jump-rail.tsx +0 -2
- package/src/ai/chat-text.ts +2 -3
- package/src/ai/chat-thread.tsx +0 -9
- package/src/ai/choice-question.tsx +0 -36
- package/src/ai/code-block.tsx +0 -52
- package/src/ai/collapsible.tsx +0 -12
- package/src/ai/conversation-context.ts +0 -14
- package/src/ai/conversation.tsx +0 -58
- package/src/ai/file-chip.tsx +0 -1
- package/src/ai/icon-button.tsx +5 -22
- package/src/ai/index.ts +0 -5
- package/src/ai/message-action-sheet.tsx +0 -8
- package/src/ai/message-context-menu.tsx +0 -22
- package/src/ai/message-quote.tsx +0 -4
- package/src/ai/message.tsx +0 -66
- package/src/ai/prompt-input-menu.tsx +0 -19
- package/src/ai/prompt-input.tsx +1 -98
- package/src/ai/reasoning.tsx +0 -6
- package/src/ai/reply-quote-chip.tsx +0 -5
- package/src/ai/response-text.tsx +0 -8
- package/src/ai/shimmer.tsx +0 -2
- package/src/ai/sources.tsx +0 -3
- package/src/ai/subagent-cards.tsx +0 -13
- package/src/ai/suggestion.tsx +0 -4
- package/src/ai/tool-approval-card.tsx +0 -14
- package/src/ai/trace.tsx +0 -23
- package/src/ai/unified-diff.tsx +0 -16
- package/src/ai/use-streaming-disclosure.ts +0 -4
- package/src/app-root/AuthGroupGate.tsx +0 -8
- package/src/app-root/SsoCallbackScreen.tsx +0 -10
- package/src/app-root/fonts.ts +0 -2
- package/src/auth/AccountScreens.tsx +0 -16
- package/src/auth/AuthProviders.tsx +0 -13
- package/src/auth/AuthScreen.tsx +0 -12
- package/src/auth/GoogleSignInButton.tsx +0 -12
- package/src/auth/SecondFactorScreen.tsx +0 -16
- package/src/auth/SignInScreen.tsx +0 -68
- package/src/auth/authErrors.ts +0 -6
- package/src/auth/clerkCore3.ts +0 -6
- package/src/auth/index.ts +0 -4
- package/src/auth/totp.ts +0 -13
- package/src/brand/AppIcons.tsx +0 -6
- package/src/brand/AppMark.tsx +0 -5
- package/src/brand/AppWordmark.tsx +0 -7
- package/src/brand/GoogleMark.tsx +0 -4
- package/src/brand/ProviderIcon.tsx +0 -6
- package/src/brand/familyApps.ts +0 -2
- package/src/brand/index.ts +0 -3
- package/src/brand/svg.ts +0 -9
- package/src/configureTheme.ts +0 -10
- package/src/controlStyles.ts +0 -12
- package/src/crash/LastCrashDialog.tsx +0 -6
- package/src/crash/lastCrash.ts +0 -21
- package/src/entries/ai.ts +0 -3
- package/src/entries/ambient.ts +0 -2
- package/src/entries/app-root.ts +0 -5
- package/src/entries/auth.ts +0 -4
- package/src/entries/bottom-sheet.ts +0 -2
- package/src/entries/brand.ts +0 -1
- package/src/entries/button.ts +0 -1
- package/src/entries/crash.ts +0 -3
- package/src/entries/date-time.ts +0 -2
- package/src/entries/expo-router.ts +0 -3
- package/src/entries/expo-web-root.ts +0 -2
- package/src/entries/floating.ts +0 -2
- package/src/entries/generative-ui.ts +0 -4
- package/src/entries/gesture-handler.ts +0 -3
- package/src/entries/keyboard-controller.ts +0 -3
- package/src/entries/layout.ts +0 -2
- package/src/entries/markdown.ts +0 -3
- package/src/entries/marketing.ts +0 -1
- package/src/entries/page-title.ts +0 -5
- package/src/entries/password-input.ts +0 -2
- package/src/entries/paste-input.ts +0 -3
- package/src/entries/primitives.ts +0 -6
- package/src/entries/search-input.ts +0 -2
- package/src/entries/tab-bar.ts +0 -2
- package/src/entries/theme.ts +2 -2
- package/src/entries/toast.ts +0 -3
- package/src/entries/video.ts +0 -2
- package/src/entries/webview.ts +0 -2
- package/src/examples/AiChatGallery.tsx +0 -11
- package/src/examples/ParityGallery.tsx +0 -25
- package/src/floating.ts +0 -6
- package/src/generative-ui/GenerativeUiPanel.tsx +0 -15
- package/src/generative-ui/components.tsx +0 -9
- package/src/generative-ui/context.ts +0 -2
- package/src/glass.ts +31 -0
- package/src/glassBlur.tsx +0 -15
- package/src/highlight.ts +0 -20
- package/src/index.ts +2 -2
- package/src/loadingGrid.ts +0 -12
- package/src/markdown/Markdown.tsx +0 -71
- package/src/markdown/MarkdownTable.tsx +0 -23
- package/src/markdown/tableText.ts +0 -3
- package/src/marketing/PricingModal.tsx +0 -13
- package/src/marketing/UpgradeToProCard.tsx +0 -14
- package/src/marketing/pricing.ts +0 -12
- package/src/media/ImageGallery.tsx +0 -18
- package/src/media/MediaCard.tsx +0 -8
- package/src/media/imageZoom.ts +0 -4
- package/src/media/zoom-image-gesture.tsx +0 -9
- package/src/media/zoomImage.ts +0 -5
- package/src/motion.ts +0 -3
- package/src/neutralTheme.ts +0 -3
- package/src/pagerSwipe.ts +0 -13
- package/src/palette.ts +0 -10
- package/src/pressScale.ts +0 -7
- package/src/primitives/button.tsx +0 -4
- package/src/primitives/card.tsx +0 -1
- package/src/primitives/input.tsx +0 -4
- package/src/primitives/keyboard-controller.tsx +0 -25
- package/src/primitives/keyboard-parts.tsx +0 -27
- package/src/primitives/native-only-animated-view.tsx +0 -5
- package/src/primitives/overlay.tsx +0 -25
- package/src/primitives/pager-gesture.tsx +0 -20
- package/src/primitives/paste-input.tsx +0 -4
- package/src/primitives/paste-parts.tsx +0 -1
- package/src/primitives/select.tsx +0 -16
- package/src/primitives/sheet-drag.tsx +0 -19
- package/src/primitives/sheet-gesture.tsx +0 -22
- package/src/primitives/swipe-row-gesture.tsx +0 -33
- package/src/primitives/switch.tsx +0 -4
- package/src/primitives/text.tsx +0 -4
- package/src/primitives/toast-drag-gesture.tsx +0 -13
- package/src/primitives/web-click-guard.ts +0 -2
- package/src/primitives/window-layer.tsx +0 -18
- package/src/push.ts +0 -15
- package/src/relativeTime.ts +0 -21
- package/src/router/RouterStackPageHeader.tsx +0 -1
- package/src/settings/MoreFromProjectV.tsx +0 -8
- package/src/settings/SettingsEmptyState.tsx +0 -2
- package/src/settings/SettingsSection.tsx +0 -3
- package/src/settings/SettingsToggleRow.tsx +0 -4
- package/src/settings/ThemeModePicker.tsx +0 -11
- package/src/settings/projectVMobileApps.ts +0 -8
- package/src/sheetDrag.ts +0 -9
- package/src/swipeRow.ts +0 -23
- package/src/tabBarRoutes.ts +0 -13
- package/src/tabIndicator.ts +0 -5
- package/src/tailwind-preset.cjs +0 -54
- package/src/tailwind-preset.d.cts +0 -8
- package/src/theme.tsx +11 -2
- package/src/themeModeStore.ts +0 -9
- package/src/toastChrome.ts +0 -6
- package/src/toastDrag.ts +0 -13
- package/src/toastStore.ts +0 -7
- package/src/updateCheck.ts +0 -15
- package/src/video/InlineVideo.tsx +0 -5
- package/src/webview/HtmlView.tsx +0 -23
- package/src/webview/HtmlView.web.tsx +0 -1
- package/src/webview/htmlView.ts +0 -5
package/src/ai/shimmer.tsx
CHANGED
|
@@ -22,9 +22,7 @@ export const SHIMMER_LOW_OPACITY = 0.45;
|
|
|
22
22
|
|
|
23
23
|
export type ShimmerProps = {
|
|
24
24
|
children: string;
|
|
25
|
-
/** Seconds for one pass, as on the web. Default 2. */
|
|
26
25
|
duration?: number;
|
|
27
|
-
/** Default `"small"` (14, `text-lg` with larger text). */
|
|
28
26
|
size?: ChatTextKind;
|
|
29
27
|
numberOfLines?: number;
|
|
30
28
|
className?: string;
|
package/src/ai/sources.tsx
CHANGED
|
@@ -61,14 +61,11 @@ export function SourcesContent({ className, ...props }: ViewProps & { className?
|
|
|
61
61
|
|
|
62
62
|
export type SourceProps = {
|
|
63
63
|
href: string;
|
|
64
|
-
/** Shown, and read, in place of the address. */
|
|
65
64
|
title?: string;
|
|
66
|
-
/** Default: `Linking.openURL(href)`, the system browser or the app that owns the link. */
|
|
67
65
|
onPress?: (href: string) => void;
|
|
68
66
|
testID?: string;
|
|
69
67
|
};
|
|
70
68
|
|
|
71
|
-
/** A `text-sm` line with the web `py-2`: 36 high. The slop brings it to 44. */
|
|
72
69
|
const ROW_HEIGHT = 36;
|
|
73
70
|
|
|
74
71
|
/**
|
|
@@ -66,18 +66,12 @@ function StatusPill({ status, testID }: { status: SubagentStatus; testID: string
|
|
|
66
66
|
export type SubagentRunCardProps = {
|
|
67
67
|
title: string;
|
|
68
68
|
status: SubagentStatus;
|
|
69
|
-
/** Whole seconds the run has taken. Shown as "12s" or "1m 5s". */
|
|
70
69
|
elapsedSeconds?: number;
|
|
71
|
-
/** Shows a Cancel button while `status` is `queued` or `running`. */
|
|
72
70
|
onCancel?: () => void;
|
|
73
|
-
/** Muted detail under the title, such as step or progress text. */
|
|
74
71
|
statusLine?: string;
|
|
75
|
-
/** Error text, in the danger colour. */
|
|
76
72
|
error?: string;
|
|
77
|
-
/** Replaces the robot icon. While `queued` or `running` a spinner shows instead. */
|
|
78
73
|
avatar?: ReactNode;
|
|
79
74
|
className?: string;
|
|
80
|
-
/** Default `subagent-run-card`. Parts add `-status`, `-elapsed` and `-cancel`. */
|
|
81
75
|
testID?: string;
|
|
82
76
|
};
|
|
83
77
|
|
|
@@ -166,23 +160,16 @@ export type SubagentHandoff = {
|
|
|
166
160
|
|
|
167
161
|
export type SubagentResultCardProps = {
|
|
168
162
|
title: string;
|
|
169
|
-
/** The short result, always shown. */
|
|
170
163
|
summary: string;
|
|
171
|
-
/** The full result, shown when the card is open. No fold without it. */
|
|
172
164
|
detail?: string;
|
|
173
|
-
/** Shows the warning note that an approval waits in another chat. */
|
|
174
165
|
approvalPending?: boolean;
|
|
175
|
-
/** Name for `Approval pending in {name}'s chat.` Default "the other bot". */
|
|
176
166
|
approvalPendingIn?: string;
|
|
177
|
-
/** Proposed actions, listed under "Proposed actions". */
|
|
178
167
|
handoffs?: readonly SubagentHandoff[];
|
|
179
|
-
/** A leading avatar beside the title. */
|
|
180
168
|
avatar?: ReactNode;
|
|
181
169
|
defaultOpen?: boolean;
|
|
182
170
|
open?: boolean;
|
|
183
171
|
onOpenChange?: (open: boolean) => void;
|
|
184
172
|
className?: string;
|
|
185
|
-
/** Default `subagent-result-card`. Parts add `-trigger` and `-detail`. */
|
|
186
173
|
testID?: string;
|
|
187
174
|
};
|
|
188
175
|
|
package/src/ai/suggestion.tsx
CHANGED
|
@@ -10,10 +10,8 @@ import { chatTextSize } from "./chat-text";
|
|
|
10
10
|
import { usePressed } from "../usePressed";
|
|
11
11
|
|
|
12
12
|
export type SuggestionsProps = {
|
|
13
|
-
/** `horizontal` (default) scrolls one row of chips; `vertical` stacks them full width. */
|
|
14
13
|
orientation?: "horizontal" | "vertical";
|
|
15
14
|
className?: string;
|
|
16
|
-
/** Classes for the horizontal row inside the scroll view, after the web `gap-2 px-1`. */
|
|
17
15
|
contentContainerClassName?: string;
|
|
18
16
|
children?: ReactNode;
|
|
19
17
|
};
|
|
@@ -47,13 +45,11 @@ export function Suggestions({
|
|
|
47
45
|
export type SuggestionProps = {
|
|
48
46
|
suggestion: string;
|
|
49
47
|
onPress?: (suggestion: string) => void;
|
|
50
|
-
/** Replaces the text; the accessibility label stays `suggestion`. */
|
|
51
48
|
children?: string;
|
|
52
49
|
disabled?: boolean;
|
|
53
50
|
testID?: string;
|
|
54
51
|
};
|
|
55
52
|
|
|
56
|
-
/** A `text-sm` line with the web `py-1.5`: 32 high. The slop brings it to 44. */
|
|
57
53
|
const CHIP_HEIGHT = 32;
|
|
58
54
|
|
|
59
55
|
/**
|
|
@@ -39,32 +39,20 @@ export function changedDraftEdits(
|
|
|
39
39
|
export type ToolDecision = "approve" | "deny" | "edit";
|
|
40
40
|
|
|
41
41
|
export type ToolApprovalCardProps = {
|
|
42
|
-
/** The tool the model wants to run. */
|
|
43
42
|
toolName: string;
|
|
44
|
-
/** The arguments, as a short string or an object. Shown cut to `ARGS_MAX_CHARS`. */
|
|
45
43
|
args?: string | Record<string, unknown>;
|
|
46
|
-
/** Called with the choice. */
|
|
47
44
|
onDecide?: (decision: ToolDecision, edits?: DraftEdit[]) => void;
|
|
48
|
-
/** True while the app sends the decision: the buttons are off and the card says so. */
|
|
49
45
|
pending?: boolean;
|
|
50
|
-
/** Turns the buttons off without the pending state. */
|
|
51
46
|
disabled?: boolean;
|
|
52
47
|
approveLabel?: string;
|
|
53
48
|
denyLabel?: string;
|
|
54
|
-
/** The tool server. The meta line reads `via {server}`, else `built-in tool`. */
|
|
55
49
|
server?: string;
|
|
56
|
-
/** Appends "queued while you were away" to the meta line. */
|
|
57
50
|
routineMode?: boolean;
|
|
58
|
-
/** Expiry text the app has formatted. Appends `Expires {expiresLabel}` to the meta line. */
|
|
59
51
|
expiresLabel?: string;
|
|
60
|
-
/** Shows a `Target: {target}` line. */
|
|
61
52
|
target?: string;
|
|
62
|
-
/** Replaces the default meta line. */
|
|
63
53
|
meta?: ReactNode;
|
|
64
|
-
/** Extra content under the meta line (above the target and args). */
|
|
65
54
|
chrome?: ReactNode;
|
|
66
55
|
className?: string;
|
|
67
|
-
/** Default `tool-approval-card`. The buttons add `-approve`, `-deny` and `-edit`. */
|
|
68
56
|
testID?: string;
|
|
69
57
|
};
|
|
70
58
|
|
|
@@ -92,7 +80,6 @@ type BaseProps = ToolApprovalCardProps & {
|
|
|
92
80
|
allowEdit?: boolean;
|
|
93
81
|
editLabel?: string;
|
|
94
82
|
heading: string;
|
|
95
|
-
/** Text between the source and the expiry in the default meta line. */
|
|
96
83
|
metaNote?: string;
|
|
97
84
|
fields?: readonly DraftField[];
|
|
98
85
|
};
|
|
@@ -283,7 +270,6 @@ export function ToolApprovalCard(props: ToolApprovalCardProps) {
|
|
|
283
270
|
|
|
284
271
|
export type ToolDraftCardProps = ToolApprovalCardProps & {
|
|
285
272
|
editLabel?: string;
|
|
286
|
-
/** The draft fields. Shows them as a preview and, under Edit, as inputs. Without them Edit reports `"edit"`. */
|
|
287
273
|
fields?: readonly DraftField[];
|
|
288
274
|
};
|
|
289
275
|
|
package/src/ai/trace.tsx
CHANGED
|
@@ -20,11 +20,6 @@ import {
|
|
|
20
20
|
import { ResponseText } from "./response-text";
|
|
21
21
|
import { Shimmer } from "./shimmer";
|
|
22
22
|
|
|
23
|
-
// One agent step as one line: icon, title, optional faded description and an
|
|
24
|
-
// optional fold. Reasoning, tool calls, grouped calls and to-dos can all
|
|
25
|
-
// render through these parts, as on the web (`trace.tsx`). The web icon
|
|
26
|
-
// crossfade (`iconKey`) is not ported: the icon swaps at once.
|
|
27
|
-
|
|
28
23
|
export type AgentTraceStatus = "running" | "error" | "pending";
|
|
29
24
|
|
|
30
25
|
/** Text and icon colour of a line: muted, or the danger colour for an error (web `text-destructive`). */
|
|
@@ -32,7 +27,6 @@ export function traceLineColor(status: AgentTraceStatus | undefined, scheme: "li
|
|
|
32
27
|
return status === "error" ? palette.danger[scheme] : tokens.color.muted[scheme];
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
// Native text and icons do not inherit a colour, so the line hands its own down.
|
|
36
30
|
const TraceLineColorContext = createContext<string | undefined>(undefined);
|
|
37
31
|
|
|
38
32
|
function useTraceColor() {
|
|
@@ -69,9 +63,7 @@ export function AgentTraceLine({ status, className, style, ...props }: AgentTrac
|
|
|
69
63
|
}
|
|
70
64
|
|
|
71
65
|
export type AgentTraceIconProps = {
|
|
72
|
-
/** A Tabler icon, drawn 16 (20 with larger text) in the line colour. */
|
|
73
66
|
icon?: ComponentType<IconProps>;
|
|
74
|
-
/** Anything else in the 16 box, such as a `Spinner size="sm"`. */
|
|
75
67
|
children?: ReactNode;
|
|
76
68
|
className?: string;
|
|
77
69
|
};
|
|
@@ -95,7 +87,6 @@ export function AgentTraceIcon({ icon: Icon, children, className }: AgentTraceIc
|
|
|
95
87
|
|
|
96
88
|
export type AgentTraceTitleProps = {
|
|
97
89
|
children: string;
|
|
98
|
-
/** Pulse the title while the step runs (`Shimmer`). */
|
|
99
90
|
shimmer?: boolean;
|
|
100
91
|
className?: string;
|
|
101
92
|
};
|
|
@@ -145,18 +136,11 @@ export function AgentTraceCollapsible({ className, ...props }: CollapsibleProps)
|
|
|
145
136
|
}
|
|
146
137
|
|
|
147
138
|
export type AgentTraceCollapsibleTriggerProps = CollapsibleTriggerProps & {
|
|
148
|
-
/**
|
|
149
|
-
* Controls of their own (a pressable `FileChip`), drawn after the line and
|
|
150
|
-
* outside the trigger, as on the web, so each keeps its own press and
|
|
151
|
-
* accessibility label.
|
|
152
|
-
*/
|
|
153
139
|
trailing?: ReactNode;
|
|
154
140
|
};
|
|
155
141
|
|
|
156
|
-
/** No slop: the 28 high line is the whole target, as trace lines stack with no gap. */
|
|
157
142
|
const LINE_SLOP = { top: 0, bottom: 0, left: 0, right: 0 } as const;
|
|
158
143
|
|
|
159
|
-
/** The chevron's slop: 4 back toward the line, 14 on past it (a 34 wide target), none above or below. */
|
|
160
144
|
const CHEVRON_SLOP = { top: 0, bottom: 0, left: 4, right: 14 } as const;
|
|
161
145
|
|
|
162
146
|
/**
|
|
@@ -195,7 +179,6 @@ export function AgentTraceCollapsibleTrigger({
|
|
|
195
179
|
{children}
|
|
196
180
|
</CollapsibleTrigger>
|
|
197
181
|
{trailing}
|
|
198
|
-
{/* The chevron toggles too, as the web overlay makes the whole line press. The trigger already names the fold. */}
|
|
199
182
|
<Pressable
|
|
200
183
|
accessible={false}
|
|
201
184
|
importantForAccessibility="no-hide-descendants"
|
|
@@ -250,19 +233,13 @@ export function AgentTraceCollapsibleContent({
|
|
|
250
233
|
}
|
|
251
234
|
|
|
252
235
|
export type AgentTraceFoldProps = Omit<CollapsibleProps, "children"> & {
|
|
253
|
-
/** The settled turn's steps, shown in an `AgentTrace` when open. */
|
|
254
236
|
children: ReactNode;
|
|
255
237
|
} & (
|
|
256
238
|
| {
|
|
257
|
-
/** How long the turn ran, in seconds. The title reads "Worked for 1m 5s" (`formatElapsed`). */
|
|
258
239
|
seconds: number;
|
|
259
240
|
duration?: never;
|
|
260
241
|
}
|
|
261
242
|
| {
|
|
262
|
-
/**
|
|
263
|
-
* The duration already formatted, as the web `ActivityTasks` `duration`:
|
|
264
|
-
* the title reads "Worked for " and this. For an app's own formatter.
|
|
265
|
-
*/
|
|
266
243
|
duration: string;
|
|
267
244
|
seconds?: never;
|
|
268
245
|
}
|
package/src/ai/unified-diff.tsx
CHANGED
|
@@ -11,11 +11,8 @@ export type UnifiedDiffLine =
|
|
|
11
11
|
| { readonly kind: "hunk"; readonly text: string }
|
|
12
12
|
| {
|
|
13
13
|
readonly kind: "added" | "removed" | "context";
|
|
14
|
-
/** The line's content, without its `+`/`-`/space marker. */
|
|
15
14
|
readonly text: string;
|
|
16
|
-
/** Null for an added line. */
|
|
17
15
|
readonly oldLine: number | null;
|
|
18
|
-
/** Null for a removed line. */
|
|
19
16
|
readonly newLine: number | null;
|
|
20
17
|
};
|
|
21
18
|
|
|
@@ -25,13 +22,11 @@ export type UnifiedDiffLine =
|
|
|
25
22
|
*/
|
|
26
23
|
export const UNIFIED_DIFF = { fontSize: 14, lineHeight: 22, gutterPadding: 8, digitWidth: 8.5 } as const;
|
|
27
24
|
|
|
28
|
-
/** Larger text steps the code up as `chatTextSize("small")` does (`text-lg`), keeping the 22/14 leading. */
|
|
29
25
|
const LARGER_FONT_SIZE = 18;
|
|
30
26
|
|
|
31
27
|
/** Web `bg-emerald-500/10` and `text-emerald-700` (dark `text-emerald-300`): edit and diff added lines. */
|
|
32
28
|
export const EMERALD = { fill: "#10b981", light: "#047857", dark: "#6ee7b7" } as const;
|
|
33
29
|
|
|
34
|
-
/** Web `text-emerald-600` (dark `text-emerald-400`), the `+n` of a diff stat. */
|
|
35
30
|
const ADDED_TEXT = { light: "#059669", dark: "#34d399" } as const;
|
|
36
31
|
|
|
37
32
|
const SIGN = { added: "+", removed: "-", context: " " } as const;
|
|
@@ -40,15 +35,8 @@ const TABULAR: TextStyle = { fontVariant: ["tabular-nums"] };
|
|
|
40
35
|
|
|
41
36
|
export type UnifiedDiffProps = {
|
|
42
37
|
lines: ReadonlyArray<UnifiedDiffLine>;
|
|
43
|
-
/**
|
|
44
|
-
* Makes each code row (not a hunk header) a button: a tap calls this with
|
|
45
|
-
* the row's index in `lines`. The code is then not selectable, so a tap
|
|
46
|
-
* always lands.
|
|
47
|
-
*/
|
|
48
38
|
onLinePress?: (index: number) => void;
|
|
49
|
-
/** What a row's button does, for a screen reader (`accessibilityHint`). */
|
|
50
39
|
linePressHint?: string;
|
|
51
|
-
/** Indexes in `lines` of the rows to mark, such as those with a comment: their gutter fills. */
|
|
52
40
|
markedLines?: ReadonlySet<number>;
|
|
53
41
|
className?: string;
|
|
54
42
|
};
|
|
@@ -134,9 +122,6 @@ export function UnifiedDiff({ lines, onLinePress, linePressHint, markedLines, cl
|
|
|
134
122
|
accessibilityRole="button"
|
|
135
123
|
accessibilityLabel={`Line ${number ?? ""}`}
|
|
136
124
|
accessibilityHint={linePressHint}
|
|
137
|
-
// No slop: rows tile the diff edge to edge, so any slop would take
|
|
138
|
-
// the next line's taps. Each row is a full-width 22 high target,
|
|
139
|
-
// as dense as the code it holds.
|
|
140
125
|
hitSlop={0}
|
|
141
126
|
onPress={() => onLinePress(index)}
|
|
142
127
|
className="flex-row active:opacity-60"
|
|
@@ -154,7 +139,6 @@ export function UnifiedDiff({ lines, onLinePress, linePressHint, markedLines, cl
|
|
|
154
139
|
export type DiffStatProps = {
|
|
155
140
|
additions: number;
|
|
156
141
|
deletions: number;
|
|
157
|
-
/** Drop a side that is zero, so a pure addition reads `+2`, not `+2 −0`. */
|
|
158
142
|
hideZero?: boolean;
|
|
159
143
|
className?: string;
|
|
160
144
|
};
|
|
@@ -17,8 +17,6 @@ export function useStreamingDisclosure(isStreaming: boolean): {
|
|
|
17
17
|
const [wasStreaming, setWasStreaming] = useState(isStreaming);
|
|
18
18
|
const [closeDue, setCloseDue] = useState(false);
|
|
19
19
|
|
|
20
|
-
// Adjusting state while rendering, as on the web: no extra commit with the
|
|
21
|
-
// old open state.
|
|
22
20
|
if (isStreaming !== wasStreaming) {
|
|
23
21
|
setWasStreaming(isStreaming);
|
|
24
22
|
if (isStreaming) {
|
|
@@ -29,8 +27,6 @@ export function useStreamingDisclosure(isStreaming: boolean): {
|
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
|
|
32
|
-
// The close is a delayed reaction to the stream stopping, not to a press:
|
|
33
|
-
// only a timer can express "one second later".
|
|
34
30
|
useEffect(() => {
|
|
35
31
|
if (!closeDue) return;
|
|
36
32
|
const timer = setTimeout(() => {
|
|
@@ -3,21 +3,13 @@ import { Redirect, type Href } from "expo-router";
|
|
|
3
3
|
import type { ReactNode } from "react";
|
|
4
4
|
|
|
5
5
|
export type AuthGroupGateProps = {
|
|
6
|
-
/** The auth stack, shown when nothing redirects. */
|
|
7
6
|
children: ReactNode;
|
|
8
|
-
/** Wait for Clerk to load before anything else. Default `true`. */
|
|
9
7
|
waitForLoaded?: boolean;
|
|
10
|
-
/** Shown while waiting. Default: nothing. */
|
|
11
8
|
loading?: ReactNode;
|
|
12
|
-
/** Passed to `useAuth`. Unset keeps Clerk's own default. */
|
|
13
9
|
treatPendingAsSignedOut?: boolean;
|
|
14
|
-
/** Where a signed-in user goes. Default `/`. */
|
|
15
10
|
signedInHref?: Href;
|
|
16
|
-
/** `Redirect` `withAnchor`, for apps that open a tab group under the target. */
|
|
17
11
|
withAnchor?: boolean;
|
|
18
|
-
/** Leave signed-in users on the auth screens, for UI preview builds. */
|
|
19
12
|
skipSignedInRedirect?: boolean;
|
|
20
|
-
/** Where a signed-out user goes instead of the auth screens, for UI preview builds. */
|
|
21
13
|
previewHref?: Href;
|
|
22
14
|
};
|
|
23
15
|
|
|
@@ -6,22 +6,12 @@ import { Button } from "../Button";
|
|
|
6
6
|
import { CenteredSpinner } from "../Spinner";
|
|
7
7
|
|
|
8
8
|
export type SsoCallbackScreenProps = {
|
|
9
|
-
/** Where a signed-in user goes. Default `/`. */
|
|
10
9
|
signedInHref?: Href;
|
|
11
|
-
/** Where a signed-out user goes, or where the back button goes. Default `/sign-in`. */
|
|
12
10
|
signedOutHref?: Href;
|
|
13
|
-
/** `Redirect` `withAnchor` for the signed-in redirect. */
|
|
14
11
|
withAnchor?: boolean;
|
|
15
|
-
/** Passed to `useAuth`. Unset keeps Clerk's own default. */
|
|
16
12
|
treatPendingAsSignedOut?: boolean;
|
|
17
|
-
/** The waiting UI. Default: a centred spinner labelled "Signing in". */
|
|
18
13
|
loading?: ReactNode;
|
|
19
|
-
/**
|
|
20
|
-
* Label of a ghost back button. When set, the screen stays on the waiting UI for a
|
|
21
|
-
* signed-out user and the button goes to `signedOutHref`. Unset: it redirects there.
|
|
22
|
-
*/
|
|
23
14
|
backLabel?: string;
|
|
24
|
-
/** Class of the view around `loading` and the back button. */
|
|
25
15
|
className?: string;
|
|
26
16
|
};
|
|
27
17
|
|
package/src/app-root/fonts.ts
CHANGED
|
@@ -14,9 +14,7 @@ import { useEffect } from "react";
|
|
|
14
14
|
export type FontMap = Record<string, number>;
|
|
15
15
|
|
|
16
16
|
export type InstrumentSansOptions = {
|
|
17
|
-
/** Also load the four italic weights. Default `false` (upright only). */
|
|
18
17
|
italics?: boolean;
|
|
19
|
-
/** More fonts to load with it, for example Michroma. */
|
|
20
18
|
extra?: FontMap;
|
|
21
19
|
};
|
|
22
20
|
|
|
@@ -40,24 +40,16 @@ export const ACCOUNT_MESSAGES = {
|
|
|
40
40
|
type AccountScreenBase = {
|
|
41
41
|
title?: string;
|
|
42
42
|
subtitle?: string;
|
|
43
|
-
/** Above the title. App brand chrome goes here. */
|
|
44
43
|
header?: ReactNode;
|
|
45
|
-
/** Below the form. */
|
|
46
44
|
footer?: ReactNode;
|
|
47
|
-
/** Shows a "Cancel" button that calls it. No button without it. */
|
|
48
45
|
onCancel?: () => void;
|
|
49
|
-
/** Time for the call, in milliseconds. A longer call fails with code `auth_timeout`. Default 20000. */
|
|
50
46
|
stageTimeoutMs?: number;
|
|
51
47
|
};
|
|
52
48
|
|
|
53
49
|
export type ChangePasswordScreenProps = AccountScreenBase & {
|
|
54
|
-
/** Rejects a shorter new password before sending it. Default: no check. */
|
|
55
50
|
minPasswordLength?: number;
|
|
56
|
-
/** Ends the user's other sessions after the change. Default `true`. */
|
|
57
51
|
signOutOfOtherSessions?: boolean;
|
|
58
|
-
/** Called after the password changed. Default: `router.back()`. */
|
|
59
52
|
onSuccess?: () => void;
|
|
60
|
-
/** Prefix for every `testID`. Default `"change-password"`. */
|
|
61
53
|
testIDPrefix?: string;
|
|
62
54
|
};
|
|
63
55
|
|
|
@@ -89,7 +81,6 @@ export function ChangePasswordScreen({
|
|
|
89
81
|
const nextField = useRef<ComponentRef<typeof TextInput>>(null);
|
|
90
82
|
const confirmField = useRef<ComponentRef<typeof TextInput>>(null);
|
|
91
83
|
const id = (name: string) => `${testIDPrefix}-${name}`;
|
|
92
|
-
// Until the user loads, show the current-password field: most accounts have one.
|
|
93
84
|
const hasPassword = user ? user.passwordEnabled : true;
|
|
94
85
|
|
|
95
86
|
const submit = async () => {
|
|
@@ -103,8 +94,6 @@ export function ChangePasswordScreen({
|
|
|
103
94
|
if (next !== confirm) return setError(ACCOUNT_MESSAGES.passwordMismatch);
|
|
104
95
|
setSubmitting(true);
|
|
105
96
|
setError("");
|
|
106
|
-
// React Compiler memoises a component only when its `try` has no branch and
|
|
107
|
-
// no `finally`, so the branches sit before and after it.
|
|
108
97
|
const params = hasPassword
|
|
109
98
|
? { newPassword: next, signOutOfOtherSessions, currentPassword: current }
|
|
110
99
|
: { newPassword: next, signOutOfOtherSessions };
|
|
@@ -192,13 +181,9 @@ export function ChangePasswordScreen({
|
|
|
192
181
|
}
|
|
193
182
|
|
|
194
183
|
export type DeleteAccountScreenProps = AccountScreenBase & {
|
|
195
|
-
/** The word the user types to confirm. Compared without case. Default `"DELETE"`. */
|
|
196
184
|
confirmWord?: string;
|
|
197
|
-
/** Called after the account is deleted, in place of `router.replace`. */
|
|
198
185
|
onDeleted?: () => void;
|
|
199
|
-
/** Where to go after the account is deleted. Default `"/"`. */
|
|
200
186
|
afterDeleteHref?: Href;
|
|
201
|
-
/** Prefix for every `testID`. Default `"delete-account"`. */
|
|
202
187
|
testIDPrefix?: string;
|
|
203
188
|
};
|
|
204
189
|
|
|
@@ -234,7 +219,6 @@ export function DeleteAccountScreen({
|
|
|
234
219
|
if (!isLoaded || !user) return setError(ACCOUNT_MESSAGES.notReady);
|
|
235
220
|
setSubmitting(true);
|
|
236
221
|
setError("");
|
|
237
|
-
// No branch inside the `try`: see `ChangePasswordScreen`.
|
|
238
222
|
let failed = false;
|
|
239
223
|
let failure: unknown;
|
|
240
224
|
try {
|
|
@@ -5,24 +5,11 @@ import { ConvexProviderWithClerk } from "convex/react-clerk";
|
|
|
5
5
|
|
|
6
6
|
export type AuthProvidersProps = {
|
|
7
7
|
children: ReactNode;
|
|
8
|
-
/**
|
|
9
|
-
* The Clerk publishable key. The app reads it from its own config; this component does not check it.
|
|
10
|
-
* `@clerk/expo` needs it: pass it unless `clerk` is `false`.
|
|
11
|
-
*/
|
|
12
8
|
publishableKey?: string;
|
|
13
|
-
/** `tokenCache` from `@clerk/expo/token-cache`, so the session survives a restart. */
|
|
14
9
|
tokenCache?: TokenCache;
|
|
15
|
-
/** A Convex client. Without one, the children sit under Clerk only (vmem). */
|
|
16
10
|
convex?: ConvexReactClient | null;
|
|
17
|
-
/** `useAuth` from `@clerk/expo`, for `ConvexProviderWithClerk`. Default: the one this package imports. */
|
|
18
11
|
useAuth?: typeof useClerkAuth;
|
|
19
|
-
/** Wrap the children in `ClerkLoaded`, so they wait for the session. Default `true`. */
|
|
20
12
|
loaded?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Default `true`. `false` drops Clerk: the children sit under a plain
|
|
23
|
-
* `ConvexProvider` (or nothing without `convex`), as the web
|
|
24
|
-
* `ConvexClerkProvider` does for UI preview builds.
|
|
25
|
-
*/
|
|
26
13
|
clerk?: boolean;
|
|
27
14
|
};
|
|
28
15
|
|
package/src/auth/AuthScreen.tsx
CHANGED
|
@@ -12,30 +12,20 @@ export type AuthScreenProps = {
|
|
|
12
12
|
title: string;
|
|
13
13
|
subtitle?: string;
|
|
14
14
|
children: ReactNode;
|
|
15
|
-
/** Above the title, such as an app mark. App brand chrome goes here. */
|
|
16
15
|
header?: ReactNode;
|
|
17
|
-
/** Below the form, such as the "Don't have an account?" row. */
|
|
18
16
|
footer?: ReactNode;
|
|
19
17
|
testID?: string;
|
|
20
18
|
className?: string;
|
|
21
|
-
/**
|
|
22
|
-
* Default `"default"`: the centred column. `"hero"`: a coloured band with the
|
|
23
|
-
* header, title and subtitle, over a rounded sheet that holds the form.
|
|
24
|
-
*/
|
|
25
19
|
variant?: "default" | "hero";
|
|
26
|
-
/** The hero band and screen colour. Only used with `variant="hero"`. Default `"#db2777"`. */
|
|
27
20
|
heroColor?: string;
|
|
28
|
-
/** The hero title and subtitle colour. Only used with `variant="hero"`. Default `"#ffffff"`. */
|
|
29
21
|
heroForeground?: string;
|
|
30
22
|
};
|
|
31
23
|
|
|
32
24
|
const DEFAULT_HERO_COLOR = "#db2777";
|
|
33
25
|
const DEFAULT_HERO_FOREGROUND = "#ffffff";
|
|
34
26
|
|
|
35
|
-
/** Space under the form while the keyboard is open, on top of its height. */
|
|
36
27
|
const KEYBOARD_EXTRA = 24;
|
|
37
28
|
|
|
38
|
-
/** The height of the open soft keyboard, or 0. Edge-to-edge Android ignores `adjustResize`, so the screen pads itself. */
|
|
39
29
|
function useKeyboardHeight(): number {
|
|
40
30
|
const [height, setHeight] = useState(0);
|
|
41
31
|
useEffect(() => {
|
|
@@ -92,7 +82,6 @@ export function AuthScreen({
|
|
|
92
82
|
}
|
|
93
83
|
return (
|
|
94
84
|
<KeyboardAvoidingView
|
|
95
|
-
// Padding on both platforms, as OverlayModal and PromptInput: Android `height` does nothing edge-to-edge.
|
|
96
85
|
behavior="padding"
|
|
97
86
|
className="flex-1"
|
|
98
87
|
style={{ backgroundColor: tokens.color.background[scheme] }}
|
|
@@ -134,7 +123,6 @@ type HeroAuthScreenProps = Omit<AuthScreenProps, "variant" | "heroColor" | "hero
|
|
|
134
123
|
heroForeground: string;
|
|
135
124
|
};
|
|
136
125
|
|
|
137
|
-
/** The `variant="hero"` frame. Separate so only the hero reads the safe-area insets. */
|
|
138
126
|
function HeroAuthScreen({
|
|
139
127
|
title,
|
|
140
128
|
subtitle,
|
|
@@ -9,29 +9,19 @@ import { Button, type ButtonProps } from "../Button";
|
|
|
9
9
|
import { toast } from "../toastStore";
|
|
10
10
|
import { authErrorMessage } from "./authErrors";
|
|
11
11
|
|
|
12
|
-
// Completes the Google browser session when the app reopens on the redirect.
|
|
13
12
|
WebBrowser.maybeCompleteAuthSession();
|
|
14
13
|
|
|
15
14
|
export const GOOGLE_ERROR_MESSAGE = "Could not continue with Google";
|
|
16
15
|
|
|
17
16
|
export type AuthNavigationOptions = {
|
|
18
|
-
/** Where to go after a session starts. Default `"/"`. */
|
|
19
17
|
afterAuthHref?: Href;
|
|
20
|
-
/**
|
|
21
|
-
* Passed to `router.replace`, such as `{ withAnchor: true }`. Typed from
|
|
22
|
-
* `useRouter`, as expo-router 57 exports no `Router` type.
|
|
23
|
-
*/
|
|
24
18
|
replaceOptions?: Parameters<ReturnType<typeof useRouter>["replace"]>[1];
|
|
25
|
-
/** Called after a session starts, in place of `router.replace`. */
|
|
26
19
|
onSuccess?: () => void;
|
|
27
20
|
};
|
|
28
21
|
|
|
29
22
|
export type GoogleSignInOptions = AuthNavigationOptions & {
|
|
30
|
-
/** The app URL scheme, such as `"vibot"`, for the redirect `scheme://sso-callback`. */
|
|
31
23
|
scheme: string;
|
|
32
|
-
/** Default `"sso-callback"`. */
|
|
33
24
|
redirectPath?: string;
|
|
34
|
-
/** Called with a message for the user. Default: an error toast. */
|
|
35
25
|
onError?: (message: string) => void;
|
|
36
26
|
};
|
|
37
27
|
|
|
@@ -66,7 +56,6 @@ export function useGoogleSignIn({
|
|
|
66
56
|
strategy: "oauth_google",
|
|
67
57
|
redirectUrl: AuthSession.makeRedirectUri({ scheme, path: redirectPath }),
|
|
68
58
|
});
|
|
69
|
-
// No session: the user closed the browser, or more steps are needed.
|
|
70
59
|
if (createdSessionId && setActive) {
|
|
71
60
|
await setActive({ session: createdSessionId });
|
|
72
61
|
if (onSuccess) onSuccess();
|
|
@@ -85,7 +74,6 @@ export function useGoogleSignIn({
|
|
|
85
74
|
|
|
86
75
|
export type GoogleSignInButtonProps = GoogleSignInOptions &
|
|
87
76
|
Omit<ButtonProps, "onPress" | "children" | "leftIcon" | "loading"> & {
|
|
88
|
-
/** Default "Continue with Google". */
|
|
89
77
|
label?: string;
|
|
90
78
|
};
|
|
91
79
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
// Clerk-free: a one-time code step. The caller owns the verification call and
|
|
2
|
-
// its errors (`useSecondFactor` does both for Clerk).
|
|
3
1
|
import { useState, type ReactNode } from "react";
|
|
4
2
|
import { Button } from "../Button";
|
|
5
3
|
import { Input } from "../Input";
|
|
@@ -8,33 +6,19 @@ import { AuthScreen, FieldError, type AuthScreenProps } from "./AuthScreen";
|
|
|
8
6
|
export type SecondFactorScreenProps = {
|
|
9
7
|
title: string;
|
|
10
8
|
description?: string;
|
|
11
|
-
/** Digits in the code. Default 6. */
|
|
12
9
|
codeLength?: number;
|
|
13
|
-
/** Called with the full code. A rejected promise is the caller's to handle. */
|
|
14
10
|
onSubmit: (code: string) => Promise<void> | void;
|
|
15
|
-
/** Inline error under the field, such as "Incorrect code". */
|
|
16
11
|
error?: string;
|
|
17
|
-
/** Shows the Verify spinner and blocks a second submit. */
|
|
18
12
|
loading?: boolean;
|
|
19
|
-
/** Shows a ghost back button when set. */
|
|
20
13
|
onBack?: () => void;
|
|
21
|
-
/** Default "Back". */
|
|
22
14
|
backLabel?: string;
|
|
23
|
-
/** Above the title. App brand chrome goes here. */
|
|
24
15
|
header?: ReactNode;
|
|
25
|
-
/** Prefix for every `testID`. Default "second-factor". */
|
|
26
16
|
testIDPrefix?: string;
|
|
27
|
-
/** Below the buttons, such as a "Use a backup code" switch. Passed to `AuthScreen`. */
|
|
28
17
|
footer?: ReactNode;
|
|
29
|
-
/** Default `true`: digits only, number pad. `false` takes any characters (backup codes). */
|
|
30
18
|
digitsOnly?: boolean;
|
|
31
|
-
/** Placeholder when `digitsOnly` is `false`. Default "Code". */
|
|
32
19
|
placeholder?: string;
|
|
33
|
-
/** Passed to `AuthScreen`. Default `"default"`. */
|
|
34
20
|
variant?: AuthScreenProps["variant"];
|
|
35
|
-
/** Passed to `AuthScreen`. Used with `variant="hero"`. */
|
|
36
21
|
heroColor?: string;
|
|
37
|
-
/** Passed to `AuthScreen`. Used with `variant="hero"`. */
|
|
38
22
|
heroForeground?: string;
|
|
39
23
|
};
|
|
40
24
|
|