@vvedantb/native-ui 0.37.2 → 0.39.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/README.md +8 -7
- 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 +0 -1
- 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 +0 -8
- 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 +0 -27
- 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/app-root/AuthGroupGate.jsx +65 -0
- package/dist/app-root/SsoCallbackScreen.jsx +97 -0
- package/dist/app-root/fonts.js +88 -0
- package/dist/app-root/index.js +3 -0
- package/dist/auth/AuthScreen.jsx +250 -77
- package/dist/auth/GoogleSignInButton.jsx +0 -3
- package/dist/auth/SecondFactorScreen.jsx +18 -14
- package/dist/auth/SignInScreen.jsx +40 -34
- 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/LastCrashDialog.jsx +56 -0
- package/dist/crash/lastCrash.js +192 -0
- package/dist/entries/ai.js +0 -3
- package/dist/entries/ambient.js +0 -2
- package/dist/entries/app-root.js +1 -0
- 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 +2 -0
- 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 +4 -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 +4 -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 +158 -0
- package/dist/pagerSwipe.js +0 -16
- package/dist/palette.js +0 -10
- package/dist/primitives/button.jsx +0 -5
- package/dist/primitives/icon.jsx +0 -4
- 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 -10
- 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 +2 -9
- 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 +62 -0
- package/dist/themeModes.js +9 -0
- 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 +47 -19
- 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 +0 -1
- 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 +0 -17
- 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 +0 -97
- 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 +38 -0
- package/src/app-root/SsoCallbackScreen.tsx +52 -0
- package/src/app-root/fonts.ts +53 -0
- package/src/app-root/index.ts +6 -0
- package/src/auth/AccountScreens.tsx +0 -16
- package/src/auth/AuthProviders.tsx +0 -13
- package/src/auth/AuthScreen.tsx +95 -6
- package/src/auth/GoogleSignInButton.tsx +0 -12
- package/src/auth/SecondFactorScreen.tsx +17 -15
- package/src/auth/SignInScreen.tsx +103 -105
- 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 +36 -0
- package/src/crash/lastCrash.ts +218 -0
- package/src/entries/ai.ts +0 -3
- package/src/entries/ambient.ts +0 -2
- package/src/entries/app-root.ts +1 -0
- 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 +13 -0
- 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 +8 -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 +1 -21
- package/src/index.ts +7 -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 +127 -0
- 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/icon.tsx +0 -2
- 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 -18
- 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 +2 -16
- 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 +85 -0
- package/src/themeModes.ts +10 -0
- 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/types/prism-react-renderer.d.ts +22 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useAuth } from "@clerk/expo";
|
|
2
|
+
import { Redirect, useRouter, type Href } from "expo-router";
|
|
3
|
+
import type { ReactNode } from "react";
|
|
4
|
+
import { View } from "react-native";
|
|
5
|
+
import { Button } from "../Button";
|
|
6
|
+
import { CenteredSpinner } from "../Spinner";
|
|
7
|
+
|
|
8
|
+
export type SsoCallbackScreenProps = {
|
|
9
|
+
signedInHref?: Href;
|
|
10
|
+
signedOutHref?: Href;
|
|
11
|
+
withAnchor?: boolean;
|
|
12
|
+
treatPendingAsSignedOut?: boolean;
|
|
13
|
+
loading?: ReactNode;
|
|
14
|
+
backLabel?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const DEFAULT_LOADING = <CenteredSpinner label="Signing in" />;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The `sso-callback` route of the Google sign-in redirect. `useSSO` completes the
|
|
22
|
+
* session; this screen only waits for it, then opens the app.
|
|
23
|
+
*/
|
|
24
|
+
export function SsoCallbackScreen({
|
|
25
|
+
signedInHref = "/",
|
|
26
|
+
signedOutHref = "/sign-in",
|
|
27
|
+
withAnchor,
|
|
28
|
+
treatPendingAsSignedOut,
|
|
29
|
+
loading = DEFAULT_LOADING,
|
|
30
|
+
backLabel,
|
|
31
|
+
className = "flex-1 items-center justify-center gap-6 px-6",
|
|
32
|
+
}: SsoCallbackScreenProps) {
|
|
33
|
+
const { isLoaded, isSignedIn } = useAuth(
|
|
34
|
+
treatPendingAsSignedOut === undefined ? undefined : { treatPendingAsSignedOut },
|
|
35
|
+
);
|
|
36
|
+
const router = useRouter();
|
|
37
|
+
|
|
38
|
+
if (isLoaded && isSignedIn) return <Redirect href={signedInHref} withAnchor={withAnchor} />;
|
|
39
|
+
|
|
40
|
+
if (backLabel === undefined) {
|
|
41
|
+
return isLoaded ? <Redirect href={signedOutHref} /> : loading;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return (
|
|
45
|
+
<View className={className}>
|
|
46
|
+
{loading}
|
|
47
|
+
<Button variant="ghost" fullWidth={false} onPress={() => router.replace(signedOutHref)}>
|
|
48
|
+
{backLabel}
|
|
49
|
+
</Button>
|
|
50
|
+
</View>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { InstrumentSans_400Regular } from "@expo-google-fonts/instrument-sans/400Regular";
|
|
2
|
+
import { InstrumentSans_500Medium } from "@expo-google-fonts/instrument-sans/500Medium";
|
|
3
|
+
import { InstrumentSans_600SemiBold } from "@expo-google-fonts/instrument-sans/600SemiBold";
|
|
4
|
+
import { InstrumentSans_700Bold } from "@expo-google-fonts/instrument-sans/700Bold";
|
|
5
|
+
import { InstrumentSans_400Regular_Italic } from "@expo-google-fonts/instrument-sans/400Regular_Italic";
|
|
6
|
+
import { InstrumentSans_500Medium_Italic } from "@expo-google-fonts/instrument-sans/500Medium_Italic";
|
|
7
|
+
import { InstrumentSans_600SemiBold_Italic } from "@expo-google-fonts/instrument-sans/600SemiBold_Italic";
|
|
8
|
+
import { InstrumentSans_700Bold_Italic } from "@expo-google-fonts/instrument-sans/700Bold_Italic";
|
|
9
|
+
import { useFonts } from "expo-font";
|
|
10
|
+
import * as SplashScreen from "expo-splash-screen";
|
|
11
|
+
import { useEffect } from "react";
|
|
12
|
+
|
|
13
|
+
/** The font sources `useFonts` takes: family name to module. */
|
|
14
|
+
export type FontMap = Record<string, number>;
|
|
15
|
+
|
|
16
|
+
export type InstrumentSansOptions = {
|
|
17
|
+
italics?: boolean;
|
|
18
|
+
extra?: FontMap;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const UPRIGHT: FontMap = {
|
|
22
|
+
InstrumentSans_400Regular,
|
|
23
|
+
InstrumentSans_500Medium,
|
|
24
|
+
InstrumentSans_600SemiBold,
|
|
25
|
+
InstrumentSans_700Bold,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const ITALIC: FontMap = {
|
|
29
|
+
InstrumentSans_400Regular_Italic,
|
|
30
|
+
InstrumentSans_500Medium_Italic,
|
|
31
|
+
InstrumentSans_600SemiBold_Italic,
|
|
32
|
+
InstrumentSans_700Bold_Italic,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/** The Instrument Sans fonts the `font-instrument-sans*` classes use, plus any `extra`. */
|
|
36
|
+
export function instrumentSansFontMap({ italics = false, extra }: InstrumentSansOptions = {}): FontMap {
|
|
37
|
+
return { ...extra, ...UPRIGHT, ...(italics ? ITALIC : undefined) };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** `[loaded, error]` as `useFonts` returns them, for the Instrument Sans map. */
|
|
41
|
+
export function useInstrumentSansFonts(options: InstrumentSansOptions = {}) {
|
|
42
|
+
return useFonts(instrumentSansFontMap(options));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Hides the native splash once `ready` is true. Call `SplashScreen.preventAutoHideAsync()`
|
|
47
|
+
* at module load in the app, so the call site keeps the timing. A failed hide is ignored.
|
|
48
|
+
*/
|
|
49
|
+
export function useHideSplashWhenReady(ready: boolean) {
|
|
50
|
+
useEffect(() => {
|
|
51
|
+
if (ready) void SplashScreen.hideAsync().catch(() => {});
|
|
52
|
+
}, [ready]);
|
|
53
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { instrumentSansFontMap, useInstrumentSansFonts, useHideSplashWhenReady } from "./fonts";
|
|
2
|
+
export type { FontMap, InstrumentSansOptions } from "./fonts";
|
|
3
|
+
export { AuthGroupGate } from "./AuthGroupGate";
|
|
4
|
+
export type { AuthGroupGateProps } from "./AuthGroupGate";
|
|
5
|
+
export { SsoCallbackScreen } from "./SsoCallbackScreen";
|
|
6
|
+
export type { SsoCallbackScreenProps } from "./SsoCallbackScreen";
|
|
@@ -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
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useEffect, useState, type ReactNode } from "react";
|
|
2
2
|
import { Keyboard, KeyboardAvoidingView, ScrollView, StyleSheet, Text, View } from "react-native";
|
|
3
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
3
4
|
import { cn } from "../cn";
|
|
4
5
|
import { textStyle, typeStyle } from "../controlStyles";
|
|
6
|
+
import { floatingShadow } from "../floating";
|
|
5
7
|
import { palette } from "../palette";
|
|
6
8
|
import { tokens } from "../tokens";
|
|
7
9
|
import { useScheme } from "../useScheme";
|
|
@@ -10,18 +12,20 @@ export type AuthScreenProps = {
|
|
|
10
12
|
title: string;
|
|
11
13
|
subtitle?: string;
|
|
12
14
|
children: ReactNode;
|
|
13
|
-
/** Above the title, such as an app mark. App brand chrome goes here. */
|
|
14
15
|
header?: ReactNode;
|
|
15
|
-
/** Below the form, such as the "Don't have an account?" row. */
|
|
16
16
|
footer?: ReactNode;
|
|
17
17
|
testID?: string;
|
|
18
18
|
className?: string;
|
|
19
|
+
variant?: "default" | "hero";
|
|
20
|
+
heroColor?: string;
|
|
21
|
+
heroForeground?: string;
|
|
19
22
|
};
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
const DEFAULT_HERO_COLOR = "#db2777";
|
|
25
|
+
const DEFAULT_HERO_FOREGROUND = "#ffffff";
|
|
26
|
+
|
|
22
27
|
const KEYBOARD_EXTRA = 24;
|
|
23
28
|
|
|
24
|
-
/** The height of the open soft keyboard, or 0. Edge-to-edge Android ignores `adjustResize`, so the screen pads itself. */
|
|
25
29
|
function useKeyboardHeight(): number {
|
|
26
30
|
const [height, setHeight] = useState(0);
|
|
27
31
|
useEffect(() => {
|
|
@@ -45,13 +49,39 @@ function useKeyboardHeight(): number {
|
|
|
45
49
|
* the scroll content gains the keyboard height as bottom space, so the focused
|
|
46
50
|
* field and the submit button scroll above the keyboard.
|
|
47
51
|
*/
|
|
48
|
-
export function AuthScreen({
|
|
52
|
+
export function AuthScreen({
|
|
53
|
+
title,
|
|
54
|
+
subtitle,
|
|
55
|
+
children,
|
|
56
|
+
header,
|
|
57
|
+
footer,
|
|
58
|
+
testID,
|
|
59
|
+
className,
|
|
60
|
+
variant = "default",
|
|
61
|
+
heroColor,
|
|
62
|
+
heroForeground,
|
|
63
|
+
}: AuthScreenProps) {
|
|
49
64
|
const scheme = useScheme();
|
|
50
65
|
const keyboardHeight = useKeyboardHeight();
|
|
51
66
|
const keyboardOpen = keyboardHeight > 0;
|
|
67
|
+
if (variant === "hero") {
|
|
68
|
+
return (
|
|
69
|
+
<HeroAuthScreen
|
|
70
|
+
title={title}
|
|
71
|
+
subtitle={subtitle}
|
|
72
|
+
header={header}
|
|
73
|
+
footer={footer}
|
|
74
|
+
testID={testID}
|
|
75
|
+
className={className}
|
|
76
|
+
heroColor={heroColor ?? DEFAULT_HERO_COLOR}
|
|
77
|
+
heroForeground={heroForeground ?? DEFAULT_HERO_FOREGROUND}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</HeroAuthScreen>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
52
83
|
return (
|
|
53
84
|
<KeyboardAvoidingView
|
|
54
|
-
// Padding on both platforms, as OverlayModal and PromptInput: Android `height` does nothing edge-to-edge.
|
|
55
85
|
behavior="padding"
|
|
56
86
|
className="flex-1"
|
|
57
87
|
style={{ backgroundColor: tokens.color.background[scheme] }}
|
|
@@ -88,6 +118,65 @@ export function AuthScreen({ title, subtitle, children, header, footer, testID,
|
|
|
88
118
|
);
|
|
89
119
|
}
|
|
90
120
|
|
|
121
|
+
type HeroAuthScreenProps = Omit<AuthScreenProps, "variant" | "heroColor" | "heroForeground"> & {
|
|
122
|
+
heroColor: string;
|
|
123
|
+
heroForeground: string;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
function HeroAuthScreen({
|
|
127
|
+
title,
|
|
128
|
+
subtitle,
|
|
129
|
+
children,
|
|
130
|
+
header,
|
|
131
|
+
footer,
|
|
132
|
+
testID,
|
|
133
|
+
className,
|
|
134
|
+
heroColor,
|
|
135
|
+
heroForeground,
|
|
136
|
+
}: HeroAuthScreenProps) {
|
|
137
|
+
const scheme = useScheme();
|
|
138
|
+
const insets = useSafeAreaInsets();
|
|
139
|
+
return (
|
|
140
|
+
<KeyboardAvoidingView behavior="padding" className="flex-1" style={{ backgroundColor: heroColor }}>
|
|
141
|
+
<ScrollView
|
|
142
|
+
testID={testID}
|
|
143
|
+
className="flex-1"
|
|
144
|
+
contentContainerClassName="grow"
|
|
145
|
+
keyboardShouldPersistTaps="handled"
|
|
146
|
+
keyboardDismissMode="on-drag"
|
|
147
|
+
>
|
|
148
|
+
<View className="px-6 pb-6" style={{ paddingTop: insets.top + 24 }}>
|
|
149
|
+
{header}
|
|
150
|
+
<Text
|
|
151
|
+
accessibilityRole="header"
|
|
152
|
+
className="mt-10 mb-1 text-4xl font-instrument-sans-medium"
|
|
153
|
+
style={{ color: heroForeground }}
|
|
154
|
+
>
|
|
155
|
+
{title}
|
|
156
|
+
</Text>
|
|
157
|
+
{subtitle ? (
|
|
158
|
+
<Text className="text-lg font-instrument-sans-medium" style={{ color: heroForeground }}>
|
|
159
|
+
{subtitle}
|
|
160
|
+
</Text>
|
|
161
|
+
) : null}
|
|
162
|
+
</View>
|
|
163
|
+
<View
|
|
164
|
+
className={cn("grow rounded-t-[32px] px-6 pt-8", className)}
|
|
165
|
+
style={[
|
|
166
|
+
{ backgroundColor: tokens.color.surface[scheme], paddingBottom: insets.bottom + 24 },
|
|
167
|
+
floatingShadow,
|
|
168
|
+
]}
|
|
169
|
+
>
|
|
170
|
+
<View className="gap-4">{children}</View>
|
|
171
|
+
{footer ? (
|
|
172
|
+
<View className="mt-6 flex-row flex-wrap items-center justify-center gap-1">{footer}</View>
|
|
173
|
+
) : null}
|
|
174
|
+
</View>
|
|
175
|
+
</ScrollView>
|
|
176
|
+
</KeyboardAvoidingView>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
91
180
|
/** A separator, "or", a separator: between Google and the email fields. */
|
|
92
181
|
export function OrDivider({ label = "or" }: { label?: string }) {
|
|
93
182
|
const scheme = useScheme();
|
|
@@ -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,35 +1,25 @@
|
|
|
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";
|
|
6
|
-
import { AuthScreen, FieldError } from "./AuthScreen";
|
|
4
|
+
import { AuthScreen, FieldError, type AuthScreenProps } from "./AuthScreen";
|
|
7
5
|
|
|
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;
|
|
20
|
+
variant?: AuthScreenProps["variant"];
|
|
21
|
+
heroColor?: string;
|
|
22
|
+
heroForeground?: string;
|
|
33
23
|
};
|
|
34
24
|
|
|
35
25
|
/** A one-time code step: digits only, a Verify button, an inline error and a back link. */
|
|
@@ -47,6 +37,9 @@ export function SecondFactorScreen({
|
|
|
47
37
|
footer,
|
|
48
38
|
digitsOnly = true,
|
|
49
39
|
placeholder,
|
|
40
|
+
variant,
|
|
41
|
+
heroColor,
|
|
42
|
+
heroForeground,
|
|
50
43
|
}: SecondFactorScreenProps) {
|
|
51
44
|
const [code, setCode] = useState("");
|
|
52
45
|
const ready = code.length === codeLength && !loading;
|
|
@@ -56,7 +49,16 @@ export function SecondFactorScreen({
|
|
|
56
49
|
};
|
|
57
50
|
|
|
58
51
|
return (
|
|
59
|
-
<AuthScreen
|
|
52
|
+
<AuthScreen
|
|
53
|
+
testID={`${testIDPrefix}-screen`}
|
|
54
|
+
title={title}
|
|
55
|
+
subtitle={description}
|
|
56
|
+
header={header}
|
|
57
|
+
footer={footer}
|
|
58
|
+
variant={variant}
|
|
59
|
+
heroColor={heroColor}
|
|
60
|
+
heroForeground={heroForeground}
|
|
61
|
+
>
|
|
60
62
|
<Input
|
|
61
63
|
testID={`${testIDPrefix}-code`}
|
|
62
64
|
accessibilityLabel="Verification code"
|