@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
package/src/Sheet.tsx
CHANGED
|
@@ -38,11 +38,8 @@ export function SheetClose(props: OverlayPressableProps) {
|
|
|
38
38
|
|
|
39
39
|
export type SheetContentProps = ViewProps & {
|
|
40
40
|
className?: string;
|
|
41
|
-
/** Close on a backdrop tap. Default `true`. */
|
|
42
41
|
dismissible?: boolean;
|
|
43
|
-
/** Grab handle above the content. Default `true`. */
|
|
44
42
|
showHandle?: boolean;
|
|
45
|
-
/** Called once the sheet is on screen: focus its field here, as `DialogContent`'s `onShow`. */
|
|
46
43
|
onShow?: () => void;
|
|
47
44
|
};
|
|
48
45
|
|
package/src/SheetRow.tsx
CHANGED
|
@@ -10,25 +10,13 @@ import { useScheme } from "./useScheme";
|
|
|
10
10
|
import { usePressed } from "./usePressed";
|
|
11
11
|
|
|
12
12
|
export type SheetRowProps = {
|
|
13
|
-
/** A Tabler icon at the start. */
|
|
14
13
|
icon?: ComponentType<IconProps>;
|
|
15
|
-
/** At the start in place of `icon`: a mark that is not a Tabler icon, such as `ProviderIcon`. */
|
|
16
14
|
leading?: ReactNode;
|
|
17
15
|
title: string;
|
|
18
|
-
/** Muted line under the title, also the accessibility hint. */
|
|
19
16
|
detail?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Makes the row one choice of a picker: `true` draws a check at the end.
|
|
22
|
-
* Set (`true` or `false`) on every row of the picker, so assistive tech
|
|
23
|
-
* reads each as a `radio` (a `checkbox` with `multiple`) with `checked`.
|
|
24
|
-
* Leave it out on an action row.
|
|
25
|
-
*/
|
|
26
17
|
active?: boolean;
|
|
27
|
-
/** A picker where several rows can be on at once (or a single on/off row): `checkbox`, not `radio`. */
|
|
28
18
|
multiple?: boolean;
|
|
29
|
-
/** A destructive action: title and icon in `palette.danger`. */
|
|
30
19
|
danger?: boolean;
|
|
31
|
-
/** The web `text-warning` item (such as Archive): title and icon in `palette.warning`. */
|
|
32
20
|
warning?: boolean;
|
|
33
21
|
disabled?: boolean;
|
|
34
22
|
onPress?: () => void;
|
package/src/Skeleton.tsx
CHANGED
|
@@ -67,19 +67,13 @@ export function CardSkeleton() {
|
|
|
67
67
|
);
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
/** Title widths, row by row, so a list of placeholders does not read as one block. */
|
|
71
70
|
const TITLE_WIDTHS: readonly `${number}%`[] = ["72%", "54%", "84%", "62%", "46%", "78%"];
|
|
72
71
|
|
|
73
72
|
export type SkeletonRowProps = {
|
|
74
|
-
/** The row's place in its list: the title width varies with it. */
|
|
75
73
|
index?: number;
|
|
76
|
-
/** A round mark before the text, this wide (a status dot, an avatar). */
|
|
77
74
|
leading?: number;
|
|
78
|
-
/** A title only, or a title over a shorter detail line. */
|
|
79
75
|
lines?: 1 | 2;
|
|
80
|
-
/** A short block at the end, where the real row shows its age. Default on. */
|
|
81
76
|
trailing?: boolean;
|
|
82
|
-
/** The real row's height, so nothing moves when it loads. Default 56. */
|
|
83
77
|
minHeight?: number;
|
|
84
78
|
className?: string;
|
|
85
79
|
};
|
|
@@ -103,13 +97,9 @@ export function SkeletonRow({ index = 0, leading, lines = 1, trailing = true, mi
|
|
|
103
97
|
}
|
|
104
98
|
|
|
105
99
|
export type SkeletonListProps = {
|
|
106
|
-
/** What is loading, for assistive tech ("Loading sessions"). */
|
|
107
100
|
label: string;
|
|
108
|
-
/** Rows to draw. Default 6. */
|
|
109
101
|
count?: number;
|
|
110
|
-
/** A `ListDivider` between rows, as a `DividedList`. Default on. */
|
|
111
102
|
divided?: boolean;
|
|
112
|
-
/** One placeholder row, such as a `SkeletonRow` with this `index`. */
|
|
113
103
|
renderRow: (index: number) => ReactNode;
|
|
114
104
|
className?: string;
|
|
115
105
|
};
|
package/src/Spinner.tsx
CHANGED
|
@@ -10,19 +10,13 @@ import { tokens } from "./tokens";
|
|
|
10
10
|
import { useScheme } from "./useScheme";
|
|
11
11
|
|
|
12
12
|
export type SpinnerProps = Omit<ActivityIndicatorProps, "size" | "color"> & {
|
|
13
|
-
/** `sm` is 16, the web `sm` and the `Button` loading ring. `md` is the small system spinner (20), `lg` the large one. `default` is an alias of `md`. A number sets the size on Android; iOS picks small below 30. Default `"md"`. */
|
|
14
13
|
size?: "sm" | "md" | "default" | "lg" | number;
|
|
15
|
-
/** `"muted"` (default) uses the muted text colour, `"inherit"` the foreground. Native has no `currentColor`. */
|
|
16
14
|
tone?: "muted" | "inherit";
|
|
17
|
-
/** Overrides `tone`. */
|
|
18
15
|
color?: string;
|
|
19
|
-
/** Hide from assistive tech, for example inside a labelled button. Default `false`. */
|
|
20
16
|
decorative?: boolean;
|
|
21
17
|
};
|
|
22
18
|
|
|
23
|
-
/** The system `"small"` spinner box on iOS, Android and React Native Web. */
|
|
24
19
|
const SYSTEM_SMALL = 20;
|
|
25
|
-
/** Web `size-4`. No platform has a 16 spinner, so `sm` is the small one scaled down in a 16 box. */
|
|
26
20
|
const SM = 16;
|
|
27
21
|
|
|
28
22
|
function systemSize(size: NonNullable<SpinnerProps["size"]>) {
|
package/src/StackPageHeader.tsx
CHANGED
|
@@ -11,28 +11,13 @@ import { tokens } from "./tokens";
|
|
|
11
11
|
import { useScheme } from "./useScheme";
|
|
12
12
|
|
|
13
13
|
export type StackPageHeaderProps = {
|
|
14
|
-
/** The accessible name of the header, and the centre text when `centre` is not set. */
|
|
15
14
|
title: string;
|
|
16
|
-
/**
|
|
17
|
-
* Custom content for the centre, such as a 20 px avatar beside a name. It
|
|
18
|
-
* replaces the `PageTitle`. `title` stays the accessible name. Wrap long
|
|
19
|
-
* text in a `PageTitle` (or `Text` with `numberOfLines`) so it can truncate:
|
|
20
|
-
* the centre shrinks (`min-w-0`) and clips what does not fit.
|
|
21
|
-
*/
|
|
22
15
|
centre?: ReactNode;
|
|
23
|
-
/** Muted line under the title, up to two lines. */
|
|
24
16
|
description?: string;
|
|
25
|
-
/** Shows a back `HeaderIconButton` at the start that calls this. No button without it. */
|
|
26
17
|
onBack?: () => void;
|
|
27
|
-
/** Names the back button. Default "Back". */
|
|
28
18
|
backLabel?: string;
|
|
29
|
-
/** Actions at the end, such as a `HeaderIconButton`. */
|
|
30
19
|
headerRight?: ReactNode;
|
|
31
20
|
backTestID?: string;
|
|
32
|
-
/**
|
|
33
|
-
* Pad the top by the safe-area inset. Default `true`. Pass `false` under a
|
|
34
|
-
* native header or inside a view that already pads the inset.
|
|
35
|
-
*/
|
|
36
21
|
safeTop?: boolean;
|
|
37
22
|
testID?: string;
|
|
38
23
|
className?: string;
|
|
@@ -66,7 +51,6 @@ export function StackPageHeader({
|
|
|
66
51
|
const largerText = useLargerText();
|
|
67
52
|
const [rightWidth, setRightWidth] = useState(0);
|
|
68
53
|
const top = safeTop ? insets.top : 0;
|
|
69
|
-
// `HeaderIconButton` is 48 across (56 with larger text).
|
|
70
54
|
const backWidth = onBack ? (largerText ? 56 : 48) : 0;
|
|
71
55
|
const side = { minWidth: Math.max(backWidth, headerRight != null ? rightWidth : 0) };
|
|
72
56
|
const descriptionSize = largerText ? "text-base" : "text-sm";
|
package/src/StatGrid.tsx
CHANGED
package/src/StatusDot.tsx
CHANGED
|
@@ -21,16 +21,10 @@ export type StatusTone =
|
|
|
21
21
|
|
|
22
22
|
export type StatusDotProps = ViewProps & {
|
|
23
23
|
tone: StatusTone;
|
|
24
|
-
/** `"sm"` (6) or `"md"` (8). Default `"sm"`. */
|
|
25
24
|
size?: "sm" | "md";
|
|
26
25
|
className?: string;
|
|
27
26
|
};
|
|
28
27
|
|
|
29
|
-
/**
|
|
30
|
-
* The `info` blue: Tailwind `blue-500` in light and the lighter `blue-400` in
|
|
31
|
-
* dark. Local to the dot: `tokens.css` has no `--info`, so it is not a
|
|
32
|
-
* `palette` key.
|
|
33
|
-
*/
|
|
34
28
|
const INFO = { light: "#3b82f6", dark: "#60a5fa" } as const;
|
|
35
29
|
|
|
36
30
|
function toneColor(tone: StatusTone, scheme: "light" | "dark") {
|
package/src/SurfaceRow.tsx
CHANGED
|
@@ -13,26 +13,14 @@ export const SURFACE_ROW = {
|
|
|
13
13
|
|
|
14
14
|
export type SurfaceRowProps = {
|
|
15
15
|
children: ReactNode;
|
|
16
|
-
/** Colour of the stripe down the leading edge: the row's status. Omit for a row with no status. */
|
|
17
16
|
accentColor?: string;
|
|
18
|
-
/** Fill. Default `tokens.color.surface`, the web `bg-card`. */
|
|
19
17
|
backgroundColor?: string;
|
|
20
|
-
/** A 1 wide hairline in this colour, such as an error row's tinted border. */
|
|
21
18
|
borderColor?: string;
|
|
22
|
-
/** Names the row for VoiceOver and TalkBack; the row is one button. */
|
|
23
19
|
accessibilityLabel: string;
|
|
24
|
-
/** Read after the label, such as the status and age. */
|
|
25
20
|
accessibilityHint?: string;
|
|
26
21
|
onPress: () => void;
|
|
27
|
-
/**
|
|
28
|
-
* A long press, such as the row menu (the web right-click), with a light
|
|
29
|
-
* haptic as it fires. VoiceOver and TalkBack reach it as the `longpress`
|
|
30
|
-
* action, named by `longPressLabel`.
|
|
31
|
-
*/
|
|
32
22
|
onLongPress?: () => void;
|
|
33
|
-
/** The spoken name of the long-press action. Default "More actions". */
|
|
34
23
|
longPressLabel?: string;
|
|
35
|
-
/** Classes on the body, in place of the web row inset `p-2.5 pl-3`. */
|
|
36
24
|
className?: string;
|
|
37
25
|
testID?: string;
|
|
38
26
|
};
|
package/src/SwipeableRow.tsx
CHANGED
|
@@ -2,13 +2,9 @@ import { createContext, useContext, type ComponentType, type ReactNode } from "r
|
|
|
2
2
|
import type { SwipeAction } from "./swipeRow";
|
|
3
3
|
|
|
4
4
|
export type SwipeableRowProps = {
|
|
5
|
-
/** Revealed at the left by a swipe right. The first one commits on a full swipe and sits at the screen edge. */
|
|
6
5
|
leadingActions?: readonly SwipeAction[];
|
|
7
|
-
/** Revealed at the right by a swipe left. The first one commits on a full swipe and sits at the screen edge. */
|
|
8
6
|
trailingActions?: readonly SwipeAction[];
|
|
9
|
-
/** `false` (such as in select mode) leaves the row still under the finger. */
|
|
10
7
|
enabled?: boolean;
|
|
11
|
-
/** The row's fill while it moves, so the actions behind do not show through. Default the screen background. */
|
|
12
8
|
backgroundColor?: string;
|
|
13
9
|
children: ReactNode;
|
|
14
10
|
};
|
package/src/Switch.tsx
CHANGED
|
@@ -3,6 +3,7 @@ import { Switch as PrimitiveSwitch } from "./primitives/switch";
|
|
|
3
3
|
import { cn } from "./cn";
|
|
4
4
|
import { selectionHaptic } from "./haptics";
|
|
5
5
|
import { switchColors, switchSize, touchSlop, type SwitchSize } from "./controlStyles";
|
|
6
|
+
import { useGlass } from "./glass";
|
|
6
7
|
import { useLargerText } from "./theme";
|
|
7
8
|
import { useScheme } from "./useScheme";
|
|
8
9
|
|
|
@@ -14,10 +15,8 @@ type SwitchProps = Omit<
|
|
|
14
15
|
checked?: boolean;
|
|
15
16
|
onValueChange?: (value: boolean) => void;
|
|
16
17
|
onCheckedChange?: (value: boolean) => void;
|
|
17
|
-
/** Track fill when on or off, in place of the `palette` colours. */
|
|
18
18
|
onColor?: string;
|
|
19
19
|
offColor?: string;
|
|
20
|
-
/** `sm` (default) is the web `Switch`, 36 × 20; `md` is 40 × 24 with a 20 thumb. */
|
|
21
20
|
size?: SwitchSize;
|
|
22
21
|
};
|
|
23
22
|
|
|
@@ -27,6 +26,7 @@ const Switch = React.forwardRef<
|
|
|
27
26
|
>(({ value, checked, onValueChange, onCheckedChange, onColor, offColor, size: sizeName, ...props }, ref) => {
|
|
28
27
|
const resolvedValue = checked ?? value ?? false;
|
|
29
28
|
const colors = switchColors(resolvedValue, useScheme());
|
|
29
|
+
const glass = useGlass("small");
|
|
30
30
|
const trackColor = resolvedValue ? onColor : offColor;
|
|
31
31
|
const size = switchSize(useLargerText(), sizeName);
|
|
32
32
|
|
|
@@ -41,14 +41,13 @@ const Switch = React.forwardRef<
|
|
|
41
41
|
ref={ref}
|
|
42
42
|
checked={resolvedValue}
|
|
43
43
|
onCheckedChange={handleCheckedChange}
|
|
44
|
-
// The web size on screen, a 44 target to touch.
|
|
45
44
|
hitSlop={touchSlop(size.width, size.height)}
|
|
46
45
|
accessibilityRole="switch"
|
|
47
46
|
className={cn(size.track, "justify-center")}
|
|
48
47
|
trackStyle={
|
|
49
48
|
trackColor ? { backgroundColor: trackColor, borderColor: trackColor } : colors.track
|
|
50
49
|
}
|
|
51
|
-
thumbStyle={colors.thumb}
|
|
50
|
+
thumbStyle={[colors.thumb, glass]}
|
|
52
51
|
thumbClassName={cn(size.thumb, resolvedValue ? size.on : size.off)}
|
|
53
52
|
{...props}
|
|
54
53
|
accessibilityState={{
|
package/src/Tabs.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
import { selectionHaptic } from "./haptics";
|
|
16
16
|
import { useControllableState } from "./primitives/use-controllable-state";
|
|
17
17
|
import { useTabIndicator, useTabLabelStyle } from "./tabIndicator";
|
|
18
|
+
import { useGlass } from "./glass";
|
|
18
19
|
import { useLargerText } from "./theme";
|
|
19
20
|
import { useScheme } from "./useScheme";
|
|
20
21
|
|
|
@@ -33,7 +34,6 @@ const TabsListContext = createContext<{
|
|
|
33
34
|
indicator?: ReturnType<typeof useTabIndicator>;
|
|
34
35
|
}>({ variant: "pills", size: "default" });
|
|
35
36
|
|
|
36
|
-
/** A trigger's place in its list, for the linked indicator and label colour. */
|
|
37
37
|
const TabIndexContext = createContext(0);
|
|
38
38
|
|
|
39
39
|
function useTabs(part: string) {
|
|
@@ -43,9 +43,7 @@ function useTabs(part: string) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
export type TabsProps = ViewProps & {
|
|
46
|
-
/** Active tab when the parent controls it. */
|
|
47
46
|
value?: string;
|
|
48
|
-
/** Initial tab when `value` is not set. */
|
|
49
47
|
defaultValue?: string;
|
|
50
48
|
onValueChange?: (value: string) => void;
|
|
51
49
|
className?: string;
|
|
@@ -73,14 +71,7 @@ export function Tabs({
|
|
|
73
71
|
|
|
74
72
|
export type TabsListProps = ViewProps & {
|
|
75
73
|
variant?: TabsListVariant;
|
|
76
|
-
/** `sm` makes the triggers smaller. */
|
|
77
74
|
size?: TabsSize;
|
|
78
|
-
/**
|
|
79
|
-
* Where a linked `Pager` is, in pages: the first trigger is page 0. With it,
|
|
80
|
-
* as in `PillTabs`, the selected fill is one indicator that slides with the
|
|
81
|
-
* pages and each label blends to the selected colour with it. The triggers
|
|
82
|
-
* are the list's direct children, in page order.
|
|
83
|
-
*/
|
|
84
75
|
progress?: SharedValue<number>;
|
|
85
76
|
className?: string;
|
|
86
77
|
};
|
|
@@ -95,6 +86,7 @@ export function TabsList({
|
|
|
95
86
|
...props
|
|
96
87
|
}: TabsListProps) {
|
|
97
88
|
const scheme = useScheme();
|
|
89
|
+
const glass = useGlass("control");
|
|
98
90
|
const triggers = Children.toArray(children);
|
|
99
91
|
const indicator = useTabIndicator(progress, triggers.length);
|
|
100
92
|
return (
|
|
@@ -103,10 +95,6 @@ export function TabsList({
|
|
|
103
95
|
accessibilityRole="tablist"
|
|
104
96
|
className={cn(
|
|
105
97
|
"flex-row",
|
|
106
|
-
// The web lists: `segmented` and `pills` are `inline-flex` (as wide
|
|
107
|
-
// as their tabs), `soft` a full-width row of centred, wrapping pills.
|
|
108
|
-
// Pills wrap rather than run off a phone screen, except under a
|
|
109
|
-
// linked indicator, which slides along one line.
|
|
110
98
|
variant === "segmented"
|
|
111
99
|
? "max-w-full gap-[3px] self-start rounded-full p-[3px]"
|
|
112
100
|
: variant === "soft"
|
|
@@ -120,12 +108,12 @@ export function TabsList({
|
|
|
120
108
|
{...props}
|
|
121
109
|
>
|
|
122
110
|
{indicator.measured ? (
|
|
123
|
-
// The selected fill under the triggers, as `PillTabs`.
|
|
124
111
|
<Animated.View
|
|
125
112
|
pointerEvents="none"
|
|
126
113
|
style={[
|
|
127
114
|
{ position: "absolute", left: 0, borderRadius: 9999 },
|
|
128
115
|
{ backgroundColor: tabColors(variant, true, scheme).backgroundColor },
|
|
116
|
+
glass,
|
|
129
117
|
indicator.style,
|
|
130
118
|
]}
|
|
131
119
|
/>
|
|
@@ -145,11 +133,6 @@ export type TabsTriggerProps = {
|
|
|
145
133
|
children: ReactNode;
|
|
146
134
|
disabled?: boolean;
|
|
147
135
|
className?: string;
|
|
148
|
-
/**
|
|
149
|
-
* The trigger height on screen, for an app whose web call site sizes its
|
|
150
|
-
* list (a `h-8` list with `p-1` has 24-high triggers). Default: the web
|
|
151
|
-
* `.t-tab` 30, or the larger-text size. The hit slop still reaches 44.
|
|
152
|
-
*/
|
|
153
136
|
minHeight?: number;
|
|
154
137
|
testID?: string;
|
|
155
138
|
accessibilityLabel?: string;
|
|
@@ -170,8 +153,6 @@ export function TabsTrigger({
|
|
|
170
153
|
const largerText = useLargerText();
|
|
171
154
|
const scheme = useScheme();
|
|
172
155
|
const selected = current === value;
|
|
173
|
-
// Fill and label are styles from `tabColors`: apps' `bg-secondary` and
|
|
174
|
-
// `bg-surface` can stay light in dark mode, under a light label.
|
|
175
156
|
const colors = tabColors(variant, selected, scheme);
|
|
176
157
|
const labelStyle = useTabLabelStyle(
|
|
177
158
|
progress,
|
|
@@ -181,7 +162,6 @@ export function TabsTrigger({
|
|
|
181
162
|
);
|
|
182
163
|
const trigger = tabTriggerSize(variant, size, largerText);
|
|
183
164
|
const height = minHeight ?? trigger.minHeight;
|
|
184
|
-
// The web `.t-tab` is `font-medium`; the soft trigger is regular.
|
|
185
165
|
const medium = variant !== "soft";
|
|
186
166
|
|
|
187
167
|
return (
|
|
@@ -192,7 +172,6 @@ export function TabsTrigger({
|
|
|
192
172
|
accessibilityLabel ?? (typeof children === "string" ? children : undefined)
|
|
193
173
|
}
|
|
194
174
|
accessibilityState={{ selected, disabled: Boolean(disabled) }}
|
|
195
|
-
// The trigger height on screen (the web 30 by default), a 44 target to touch.
|
|
196
175
|
hitSlop={touchSlop(MIN_TOUCH_TARGET, height)}
|
|
197
176
|
disabled={disabled}
|
|
198
177
|
onPress={() => {
|
|
@@ -207,9 +186,6 @@ export function TabsTrigger({
|
|
|
207
186
|
disabled ? "opacity-50" : "active:opacity-70",
|
|
208
187
|
className,
|
|
209
188
|
)}
|
|
210
|
-
// A plain object: NativeWind puts the class styles and `style` in an
|
|
211
|
-
// array, where a `({ pressed }) => ...` style is dropped.
|
|
212
|
-
// When linked and measured, the list's indicator draws the selected fill.
|
|
213
189
|
style={{ backgroundColor: indicator?.measured ? "transparent" : colors.backgroundColor, minHeight: height }}
|
|
214
190
|
onLayout={progress ? indicator?.onLayout(index) : undefined}
|
|
215
191
|
>
|
package/src/Textarea.tsx
CHANGED
|
@@ -10,7 +10,6 @@ type TextareaProps = React.ComponentPropsWithoutRef<typeof PrimitiveInput> & {
|
|
|
10
10
|
className?: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
/** Multiline `Input`: same fill, border, radius and type. Grows from 4 lines. */
|
|
14
13
|
const Textarea = React.forwardRef<
|
|
15
14
|
React.ElementRef<typeof PrimitiveInput>,
|
|
16
15
|
TextareaProps
|
|
@@ -25,7 +24,6 @@ const Textarea = React.forwardRef<
|
|
|
25
24
|
textAlignVertical="top"
|
|
26
25
|
placeholderTextColor={placeholderTextColor ?? palette.fieldPlaceholder[scheme]}
|
|
27
26
|
className={cn(
|
|
28
|
-
// The web textarea: min-h-20 px-3.5 py-2.5, 16 px type.
|
|
29
27
|
"min-h-20 border px-3.5 py-2.5 text-base font-instrument-sans",
|
|
30
28
|
largerText && "min-h-32 px-4 py-3 text-xl font-instrument-sans-medium",
|
|
31
29
|
className,
|
package/src/ThemeToggle.tsx
CHANGED
|
@@ -9,7 +9,6 @@ export type ThemeToggleProps = {
|
|
|
9
9
|
testID?: string;
|
|
10
10
|
};
|
|
11
11
|
|
|
12
|
-
/** Logged when NativeWind's `setColorScheme` throws. */
|
|
13
12
|
const DARK_MODE_CLASS_HINT =
|
|
14
13
|
'ThemeToggle could not set the colour scheme. NativeWind throws while Tailwind darkMode is "media" (the default): set darkMode: "class" in tailwind.config.js. See the @vvedantb/native-ui README, Theme.';
|
|
15
14
|
|
package/src/Toast.tsx
CHANGED
|
@@ -24,20 +24,17 @@ import {
|
|
|
24
24
|
toastSurfaceStyle,
|
|
25
25
|
} from "./toastChrome";
|
|
26
26
|
import { tokens } from "./tokens";
|
|
27
|
+
import { useGlass } from "./glass";
|
|
27
28
|
import { useLargerText } from "./theme";
|
|
28
29
|
import { useScheme } from "./useScheme";
|
|
29
30
|
import { NativeOnlyAnimatedView } from "./primitives/native-only-animated-view";
|
|
30
31
|
import { ToastDragContext } from "./toastDrag";
|
|
31
32
|
import { getToasts, subscribeToasts, toast, type ToastItem } from "./toastStore";
|
|
32
33
|
|
|
33
|
-
// On iOS the overlay draws above RN `Modal`s, so toasts show over dialogs (as
|
|
34
|
-
// sonner does on the web). On Android a `Modal` still covers them.
|
|
35
34
|
const FullWindowOverlay = Platform.OS === "ios" ? RNFullWindowOverlay : Fragment;
|
|
36
35
|
|
|
37
36
|
const toastShadow = toastShadowStyle(Platform.OS);
|
|
38
37
|
|
|
39
|
-
// Down from the top edge and back up the way it came, the exit 20% quicker:
|
|
40
|
-
// the reader is done with it.
|
|
41
38
|
const TOAST_ENTER = FadeInUp.duration(200).easing(EASE_OUT);
|
|
42
39
|
const TOAST_EXIT = FadeOutUp.duration(160).easing(EASE_OUT);
|
|
43
40
|
|
|
@@ -70,7 +67,6 @@ export function Toaster({ offset = 8 }: { offset?: number }) {
|
|
|
70
67
|
);
|
|
71
68
|
}
|
|
72
69
|
|
|
73
|
-
/** The web filled 24 icons (`toastChrome`), or a spinner while loading. */
|
|
74
70
|
function ToastIcon({ item }: { item: ToastItem }) {
|
|
75
71
|
const scheme = useScheme();
|
|
76
72
|
if (item.variant === "loading") {
|
|
@@ -91,13 +87,7 @@ function ToastIcon({ item }: { item: ToastItem }) {
|
|
|
91
87
|
);
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
/**
|
|
95
|
-
* Closes `item` after its `duration`, counting only while it is not `held`:
|
|
96
|
-
* a finger on the toast pauses the time left, and lifting it resumes. A
|
|
97
|
-
* toast replaced in place (same id, new item) starts its own time afresh.
|
|
98
|
-
*/
|
|
99
90
|
function useToastTimer(item: ToastItem, held: boolean) {
|
|
100
|
-
// The time left, and the item it counts for. Only the effect reads and writes it.
|
|
101
91
|
const left = useRef({ item, ms: item.duration });
|
|
102
92
|
useEffect(() => {
|
|
103
93
|
if (left.current.item !== item) left.current = { item, ms: item.duration };
|
|
@@ -114,13 +104,11 @@ function useToastTimer(item: ToastItem, held: boolean) {
|
|
|
114
104
|
function ToastCard({ item }: { item: ToastItem }) {
|
|
115
105
|
const largerText = useLargerText();
|
|
116
106
|
const scheme = useScheme();
|
|
117
|
-
|
|
107
|
+
const glass = useGlass("surface");
|
|
118
108
|
const Drag = useContext(ToastDragContext);
|
|
119
109
|
const [held, setHeld] = useState(false);
|
|
120
110
|
useToastTimer(item, held);
|
|
121
111
|
|
|
122
|
-
// A success or error toast reports an operation the user started: one
|
|
123
|
-
// notification haptic as it shows (or turns from loading into a result).
|
|
124
112
|
useEffect(() => {
|
|
125
113
|
if (item.variant === "success" || item.variant === "error") notificationHaptic(item.variant);
|
|
126
114
|
}, [item.id, item.variant]);
|
|
@@ -132,12 +120,9 @@ function ToastCard({ item }: { item: ToastItem }) {
|
|
|
132
120
|
}, [item.title, item.description]);
|
|
133
121
|
|
|
134
122
|
const surface = (
|
|
135
|
-
|
|
136
|
-
<View style={[toastSurfaceStyle(scheme), toastShadow]}>
|
|
123
|
+
<View style={[toastSurfaceStyle(scheme), toastShadow, glass]}>
|
|
137
124
|
<Pressable
|
|
138
125
|
testID={`toast-${item.id}`}
|
|
139
|
-
// With an action, the text and the action button stay separate
|
|
140
|
-
// elements for VoiceOver and TalkBack instead of one grouped button.
|
|
141
126
|
accessible={!item.action}
|
|
142
127
|
accessibilityRole="button"
|
|
143
128
|
accessibilityHint="Closes the message"
|
|
@@ -146,7 +131,6 @@ function ToastCard({ item }: { item: ToastItem }) {
|
|
|
146
131
|
>
|
|
147
132
|
<ToastIcon item={item} />
|
|
148
133
|
<View className="min-w-0 flex-1">
|
|
149
|
-
{/* Web `text-sm font-medium leading-snug` (14 / 19.25, 500); `text-lg` with larger text. */}
|
|
150
134
|
<Text
|
|
151
135
|
className={cn(
|
|
152
136
|
"font-instrument-sans-medium",
|
package/src/UpdateChecker.tsx
CHANGED
|
@@ -24,42 +24,22 @@ export const V_STORE_UPDATES_URL = "vstore://updates";
|
|
|
24
24
|
type UpdateText = ReactNode | ((update: AvailableUpdate) => ReactNode);
|
|
25
25
|
|
|
26
26
|
export type UpdatePromptProps = {
|
|
27
|
-
/** The update to offer. The prompt is open while this is set. */
|
|
28
27
|
update: AvailableUpdate | null;
|
|
29
|
-
/** The app's display name, used in the default description. */
|
|
30
28
|
appName: string;
|
|
31
|
-
/** Default "Update available". */
|
|
32
29
|
title?: ReactNode;
|
|
33
|
-
/** Default "`<appName> <version>` is ready to install.". A function receives the update. */
|
|
34
30
|
description?: UpdateText;
|
|
35
|
-
/** Default "Later". */
|
|
36
31
|
laterLabel?: ReactNode;
|
|
37
|
-
/** Default "Download". */
|
|
38
32
|
downloadLabel?: ReactNode;
|
|
39
|
-
/** Default "Install from V Store". */
|
|
40
33
|
vStoreLabel?: ReactNode;
|
|
41
|
-
/** Shown once V Store could not be opened. Default "V Store is not installed on this device.". */
|
|
42
34
|
vStoreMissingText?: ReactNode;
|
|
43
|
-
/** Show Download, which opens `update.url` (the APK or its release page). Default `true`. */
|
|
44
35
|
showDownload?: boolean;
|
|
45
|
-
/** Show "Install from V Store", which only opens V Store. Default `true`. */
|
|
46
36
|
showVStore?: boolean;
|
|
47
|
-
/**
|
|
48
|
-
* The link that opens V Store. Default `V_STORE_UPDATES_URL`, its Updates
|
|
49
|
-
* tab. Pass the app's own page there when the app knows its link.
|
|
50
|
-
*/
|
|
51
37
|
vStoreUrl?: string;
|
|
52
|
-
/** Later, Android back and the VoiceOver escape. */
|
|
53
38
|
onLater?: (update: AvailableUpdate) => void;
|
|
54
|
-
/** After Download opened `update.url`. Close the prompt here. */
|
|
55
39
|
onDownload?: (update: AvailableUpdate) => void;
|
|
56
|
-
/** After V Store opened. Close the prompt here. */
|
|
57
40
|
onOpenVStore?: (update: AvailableUpdate) => void;
|
|
58
|
-
/** V Store could not be opened (not installed). The prompt stays open, without the V Store button. */
|
|
59
41
|
onVStoreMissing?: (update: AvailableUpdate) => void;
|
|
60
|
-
/** Opens a link. Default `Linking.openURL`, which rejects when no app handles it. */
|
|
61
42
|
openUrl?: (url: string) => Promise<unknown>;
|
|
62
|
-
/** The buttons get `<testID>-later`, `-download` and `-vstore`; the notice `-vstore-missing`. */
|
|
63
43
|
testID?: string;
|
|
64
44
|
};
|
|
65
45
|
|
|
@@ -98,9 +78,7 @@ export function UpdatePrompt({
|
|
|
98
78
|
openUrl = Linking.openURL,
|
|
99
79
|
testID,
|
|
100
80
|
}: UpdatePromptProps) {
|
|
101
|
-
// The version V Store failed to open for, so the next version asks afresh.
|
|
102
81
|
const [missingFor, setMissingFor] = useState<string | null>(null);
|
|
103
|
-
// The last update, so the text stays while the dialog closes.
|
|
104
82
|
const [shown, setShown] = useState(update);
|
|
105
83
|
if (update && update !== shown) setShown(update);
|
|
106
84
|
|
|
@@ -133,7 +111,6 @@ export function UpdatePrompt({
|
|
|
133
111
|
) : null}
|
|
134
112
|
</AlertDialogHeader>
|
|
135
113
|
<AlertDialogFooter>
|
|
136
|
-
{/* Closes the dialog, and so calls `onLater`. */}
|
|
137
114
|
<AlertDialogCancel size="lg" testID={testID ? `${testID}-later` : undefined}>
|
|
138
115
|
{laterLabel}
|
|
139
116
|
</AlertDialogCancel>
|
|
@@ -162,7 +139,6 @@ export function UpdatePrompt({
|
|
|
162
139
|
testID={testID ? `${testID}-download` : undefined}
|
|
163
140
|
onPress={() => {
|
|
164
141
|
if (!update) return;
|
|
165
|
-
// A link that does not open leaves nothing to do here.
|
|
166
142
|
openUrl(update.url).catch(() => undefined);
|
|
167
143
|
onDownload?.(update);
|
|
168
144
|
}}
|
|
@@ -182,7 +158,6 @@ export type UpdateDismissStorage = {
|
|
|
182
158
|
setItem: (key: string, value: string) => Promise<unknown> | unknown;
|
|
183
159
|
};
|
|
184
160
|
|
|
185
|
-
/** The version Later hid. An unreadable store means nothing was dismissed. */
|
|
186
161
|
async function readDismissed(storage: UpdateDismissStorage, key: string): Promise<string | null> {
|
|
187
162
|
try {
|
|
188
163
|
return await storage.getItem(key);
|
|
@@ -195,29 +170,12 @@ export type UpdateCheckerProps = Omit<
|
|
|
195
170
|
UpdatePromptProps,
|
|
196
171
|
"update" | "onLater" | "onDownload" | "onOpenVStore"
|
|
197
172
|
> & {
|
|
198
|
-
/**
|
|
199
|
-
* The installed version, "1.2.3". `null` or `undefined` skips the check, for
|
|
200
|
-
* a local or preview build that has no release to compare with.
|
|
201
|
-
*/
|
|
202
173
|
currentVersion: string | null | undefined;
|
|
203
|
-
/** GitHub releases to read: the repository and the tag prefix before the version. Public repositories only. */
|
|
204
174
|
source?: GitHubReleaseSource;
|
|
205
|
-
/**
|
|
206
|
-
* Ask V Store for the newest version, used instead of `source`. It works
|
|
207
|
-
* for a private repository too. Without `vStore.downloadUrl`, Download is
|
|
208
|
-
* hidden unless `showDownload` says otherwise.
|
|
209
|
-
*/
|
|
210
175
|
vStore?: VStoreSource;
|
|
211
|
-
/** Your own check, used instead of `source` and `vStore`. Returns the update to offer, or null. */
|
|
212
176
|
check?: (currentVersion: string) => Promise<AvailableUpdate | null>;
|
|
213
|
-
/** `false` skips the check. Default `true`. */
|
|
214
177
|
enabled?: boolean;
|
|
215
|
-
/**
|
|
216
|
-
* Remembers the version "Later" hid, so it is not offered again until a
|
|
217
|
-
* newer one is out. Without it, Later hides the prompt until the next start.
|
|
218
|
-
*/
|
|
219
178
|
storage?: UpdateDismissStorage;
|
|
220
|
-
/** Key in `storage`. Default `"updateDismissed"`. */
|
|
221
179
|
storageKey?: string;
|
|
222
180
|
onLater?: (update: AvailableUpdate) => void;
|
|
223
181
|
onDownload?: (update: AvailableUpdate) => void;
|
|
@@ -251,7 +209,6 @@ export function UpdateChecker({
|
|
|
251
209
|
...prompt
|
|
252
210
|
}: UpdateCheckerProps) {
|
|
253
211
|
const [update, setUpdate] = useState<AvailableUpdate | null>(null);
|
|
254
|
-
// The latest callbacks, so a new function each render does not check again.
|
|
255
212
|
const latest = useRef({ check, vStore, storage, storageKey });
|
|
256
213
|
useEffect(() => {
|
|
257
214
|
latest.current = { check, vStore, storage, storageKey };
|
|
@@ -262,7 +219,6 @@ export function UpdateChecker({
|
|
|
262
219
|
const hasCheck = check !== undefined;
|
|
263
220
|
const vStorePackage = vStore?.packageName;
|
|
264
221
|
const vStoreSite = vStore?.siteUrl;
|
|
265
|
-
// Without a download link, the update's link is the one that opens V Store.
|
|
266
222
|
const vStoreUrl = prompt.vStoreUrl ?? V_STORE_UPDATES_URL;
|
|
267
223
|
useEffect(() => {
|
|
268
224
|
if (!enabled || !currentVersion) return;
|
|
@@ -280,7 +236,6 @@ export function UpdateChecker({
|
|
|
280
236
|
const dismissed = store ? await readDismissed(store, key) : null;
|
|
281
237
|
if (!cancelled && dismissed !== found.version) setUpdate(found);
|
|
282
238
|
};
|
|
283
|
-
// A failed check must never get in the way of the app.
|
|
284
239
|
run().catch(() => undefined);
|
|
285
240
|
return () => {
|
|
286
241
|
cancelled = true;
|
|
@@ -296,7 +251,6 @@ export function UpdateChecker({
|
|
|
296
251
|
setUpdate(null);
|
|
297
252
|
const { storage: store, storageKey: key } = latest.current;
|
|
298
253
|
if (store) {
|
|
299
|
-
// A failed write only means the prompt returns at the next start.
|
|
300
254
|
Promise.resolve()
|
|
301
255
|
.then(() => store.setItem(key, current.version))
|
|
302
256
|
.catch(() => undefined);
|
|
@@ -31,9 +31,7 @@ export function freeTextAnswer(answer: string | undefined, chosen: readonly stri
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export type ActivityQuestionCardProps = {
|
|
34
|
-
/** The prompt's questions, as the agent asked them. */
|
|
35
34
|
questions: ActivityQuestion[];
|
|
36
|
-
/** The answers, keyed by question text (`ChoiceQuestion`'s `onSubmit` shape). */
|
|
37
35
|
answers?: Record<string, string>;
|
|
38
36
|
};
|
|
39
37
|
|
|
@@ -103,11 +101,6 @@ export function ActivityQuestionCard({ questions, answers }: ActivityQuestionCar
|
|
|
103
101
|
);
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
/**
|
|
107
|
-
* One option as recorded (web `OptionRow`): a 20 rounded mark (the letter, a
|
|
108
|
-
* check when picked, a pencil for "Other"), the label and its description.
|
|
109
|
-
* Picked: the row on the tertiary fill, the mark on primary, the label medium.
|
|
110
|
-
*/
|
|
111
104
|
function RecordRow({
|
|
112
105
|
mark,
|
|
113
106
|
label,
|
|
@@ -144,7 +137,6 @@ function RecordRow({
|
|
|
144
137
|
width: markSize,
|
|
145
138
|
height: markSize,
|
|
146
139
|
marginTop: 2,
|
|
147
|
-
// A small rounded square, as the web `rounded-md` mark.
|
|
148
140
|
borderRadius: 6,
|
|
149
141
|
alignItems: "center",
|
|
150
142
|
justifyContent: "center",
|
|
@@ -13,21 +13,16 @@ import { CodeBlock } from "./code-block";
|
|
|
13
13
|
export type ActivityStepDetailStep = {
|
|
14
14
|
type: string;
|
|
15
15
|
detail?: string;
|
|
16
|
-
/** Bash command, fuller than `detail`. */
|
|
17
16
|
command?: string;
|
|
18
17
|
output?: { text: string; exitCode?: number; truncated?: boolean };
|
|
19
18
|
edits?: ReadonlyArray<{ oldText: string; newText: string }>;
|
|
20
|
-
/** A written file's preview. */
|
|
21
19
|
contentPreview?: string;
|
|
22
|
-
/** The transcript copy dropped the output, edits or preview; the full step is still loading. */
|
|
23
20
|
hasHiddenDetail?: boolean;
|
|
24
21
|
};
|
|
25
22
|
|
|
26
23
|
export type ActivityStepDetailProps = {
|
|
27
24
|
step: ActivityStepDetailStep;
|
|
28
|
-
/** Copy button on the transcript and preview blocks (native-ui adds no clipboard). */
|
|
29
25
|
onCopy?: (text: string) => void | Promise<void>;
|
|
30
|
-
/** Default "Loading output...". */
|
|
31
26
|
loadingLabel?: string;
|
|
32
27
|
};
|
|
33
28
|
|