@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/dist/toastDrag.js
CHANGED
|
@@ -1,23 +1,9 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* The rules of a toast's drag to dismiss, as plain numbers, so they stay
|
|
5
|
-
* testable apart from the gesture. A toast enters down from the top edge, so
|
|
6
|
-
* it leaves the same way: up. `dy` is the drag's travel in points (up
|
|
7
|
-
* negative) and `vy` the finger's speed in points per second (the Gesture
|
|
8
|
-
* Handler unit). Each rule is a worklet, so the drag runs it on the UI thread.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
3
|
/** Vertical travel (pt) before a drag takes the toast: a tap still presses it. */
|
|
12
4
|
export const TOAST_DRAG_ACTIVE_OFFSET_Y = 8;
|
|
13
|
-
|
|
14
|
-
/** A flick up at this speed (pt/s) dismisses the toast, however short the drag. */
|
|
15
5
|
const FLICK_VELOCITY = 500;
|
|
16
|
-
|
|
17
|
-
/** How far ahead (s) the release velocity carries the toast when deciding to dismiss it. */
|
|
18
6
|
const PROJECTION_S = 0.2;
|
|
19
|
-
|
|
20
|
-
/** How far a downward pull may move the toast: it is already as low as it goes. */
|
|
21
7
|
const DOWN_REACH = 24;
|
|
22
8
|
|
|
23
9
|
/**
|
package/dist/toastStore.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// Module-level toast queue behind `toast()` and `<Toaster />`. No React Native
|
|
2
|
-
// imports, so it runs anywhere (tests, non-component code).
|
|
3
|
-
|
|
4
1
|
/** At most this many toasts show; the oldest drop first. */
|
|
5
2
|
export const MAX_TOASTS = 3;
|
|
6
3
|
export const DEFAULT_TOAST_DURATION = 4000;
|
|
@@ -46,7 +43,6 @@ export const toast = Object.assign((title, options) => show("default", title, op
|
|
|
46
43
|
warning: (title, options) => show("warning", title, options),
|
|
47
44
|
info: (title, options) => show("info", title, options),
|
|
48
45
|
loading: (title, options) => show("loading", title, options),
|
|
49
|
-
/** Closes one toast, or every toast without an id. */
|
|
50
46
|
dismiss(id) {
|
|
51
47
|
toasts = id === undefined ? [] : toasts.filter(toast => toast.id !== id);
|
|
52
48
|
emit();
|
package/dist/updateCheck.js
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
// The update check behind `UpdateChecker`: for an app that ships its Android
|
|
2
|
-
// APK as GitHub releases tagged `<tagPrefix><version>`, with no store and no
|
|
3
|
-
// over-the-air updates. Plain functions, no React and no native module.
|
|
4
|
-
|
|
5
1
|
/** A newer version to offer. `url` is what Download opens: the APK itself, else its release page. */
|
|
6
2
|
|
|
7
3
|
/** The fields of a GitHub release the check reads (`GET /repos/{owner}/{repo}/releases`). */
|
|
8
4
|
|
|
9
|
-
/** `[major, minor, patch]` of "1.2.3", or null. */
|
|
10
5
|
function parseVersion(version) {
|
|
11
6
|
const match = /^(\d+)\.(\d+)\.(\d+)$/.exec(version);
|
|
12
7
|
return match ? [Number(match[1]), Number(match[2]), Number(match[3])] : null;
|
|
13
8
|
}
|
|
14
|
-
|
|
15
|
-
/** Positive when `a` is newer than `b`. */
|
|
16
9
|
function compareParts(a, b) {
|
|
17
10
|
return a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
|
|
18
11
|
}
|
package/dist/webview/htmlView.js
CHANGED
package/package.json
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/native-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.39.0",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
|
|
5
|
+
"description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root, the app root shell helpers and Clerk + Convex auth screens.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"publishConfig": {
|
|
8
|
-
"access": "public"
|
|
9
|
-
"provenance": true
|
|
8
|
+
"access": "public"
|
|
10
9
|
},
|
|
11
10
|
"repository": {
|
|
12
11
|
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/vvedantb/
|
|
12
|
+
"url": "git+https://github.com/vvedantb/v.git",
|
|
14
13
|
"directory": "packages/native-ui"
|
|
15
14
|
},
|
|
16
15
|
"exports": {
|
|
@@ -124,6 +123,11 @@
|
|
|
124
123
|
"source": "./src/entries/date-time.ts",
|
|
125
124
|
"default": "./dist/entries/date-time.js"
|
|
126
125
|
},
|
|
126
|
+
"./crash": {
|
|
127
|
+
"types": "./src/entries/crash.ts",
|
|
128
|
+
"source": "./src/entries/crash.ts",
|
|
129
|
+
"default": "./dist/entries/crash.js"
|
|
130
|
+
},
|
|
127
131
|
"./ai": {
|
|
128
132
|
"types": "./src/entries/ai.ts",
|
|
129
133
|
"source": "./src/entries/ai.ts",
|
|
@@ -174,6 +178,11 @@
|
|
|
174
178
|
"source": "./src/entries/expo-web-root.ts",
|
|
175
179
|
"default": "./dist/entries/expo-web-root.js"
|
|
176
180
|
},
|
|
181
|
+
"./app-root": {
|
|
182
|
+
"types": "./src/entries/app-root.ts",
|
|
183
|
+
"source": "./src/entries/app-root.ts",
|
|
184
|
+
"default": "./dist/entries/app-root.js"
|
|
185
|
+
},
|
|
177
186
|
"./tailwind-preset": {
|
|
178
187
|
"types": "./src/tailwind-preset.d.cts",
|
|
179
188
|
"require": "./src/tailwind-preset.cjs",
|
|
@@ -185,12 +194,14 @@
|
|
|
185
194
|
"files": [
|
|
186
195
|
"dist",
|
|
187
196
|
"src",
|
|
197
|
+
"types/prism-react-renderer.d.ts",
|
|
188
198
|
"LICENSE"
|
|
189
199
|
],
|
|
190
200
|
"sideEffects": false,
|
|
191
201
|
"peerDependencies": {
|
|
192
202
|
"expo-paste-input": ">=0.2.0",
|
|
193
203
|
"@clerk/expo": ">=4.16.0",
|
|
204
|
+
"@expo-google-fonts/instrument-sans": "*",
|
|
194
205
|
"@expo/vector-icons": "*",
|
|
195
206
|
"@json-render/core": ">=0.21.0",
|
|
196
207
|
"@json-render/react-native": ">=0.21.0",
|
|
@@ -199,8 +210,8 @@
|
|
|
199
210
|
"@rn-primitives/slot": "*",
|
|
200
211
|
"@rn-primitives/switch": "*",
|
|
201
212
|
"@swmansion/react-native-bottom-sheet": ">=1.1.0",
|
|
202
|
-
"@tabler/icons-react-native": "
|
|
203
|
-
"@vvedantb/server": ">=0.
|
|
213
|
+
"@tabler/icons-react-native": "^3.52.0",
|
|
214
|
+
"@vvedantb/server": ">=0.19.0",
|
|
204
215
|
"class-variance-authority": ">=0.7.0",
|
|
205
216
|
"clsx": ">=2.0.0",
|
|
206
217
|
"convex": "*",
|
|
@@ -209,13 +220,15 @@
|
|
|
209
220
|
"expo-blur": "*",
|
|
210
221
|
"expo-constants": "*",
|
|
211
222
|
"expo-device": "*",
|
|
223
|
+
"expo-font": "*",
|
|
212
224
|
"expo-haptics": "*",
|
|
213
225
|
"expo-linear-gradient": "*",
|
|
214
226
|
"expo-notifications": "*",
|
|
215
227
|
"expo-router": "*",
|
|
228
|
+
"expo-secure-store": "*",
|
|
229
|
+
"expo-splash-screen": "*",
|
|
216
230
|
"expo-video": "*",
|
|
217
231
|
"expo-web-browser": "*",
|
|
218
|
-
"lucide-react-native": "*",
|
|
219
232
|
"nativewind": ">=4.0.0",
|
|
220
233
|
"prism-react-renderer": ">=2.0.0",
|
|
221
234
|
"react": ">=19.0.0",
|
|
@@ -228,9 +241,18 @@
|
|
|
228
241
|
"react-native-screens": "*",
|
|
229
242
|
"react-native-svg": "*",
|
|
230
243
|
"react-native-webview": "*",
|
|
231
|
-
"tailwind-merge": ">=
|
|
244
|
+
"tailwind-merge": ">=3.0.0"
|
|
232
245
|
},
|
|
233
246
|
"peerDependenciesMeta": {
|
|
247
|
+
"@expo-google-fonts/instrument-sans": {
|
|
248
|
+
"optional": true
|
|
249
|
+
},
|
|
250
|
+
"expo-font": {
|
|
251
|
+
"optional": true
|
|
252
|
+
},
|
|
253
|
+
"expo-splash-screen": {
|
|
254
|
+
"optional": true
|
|
255
|
+
},
|
|
234
256
|
"expo-paste-input": {
|
|
235
257
|
"optional": true
|
|
236
258
|
},
|
|
@@ -282,6 +304,9 @@
|
|
|
282
304
|
"expo-router": {
|
|
283
305
|
"optional": true
|
|
284
306
|
},
|
|
307
|
+
"expo-secure-store": {
|
|
308
|
+
"optional": true
|
|
309
|
+
},
|
|
285
310
|
"expo-video": {
|
|
286
311
|
"optional": true
|
|
287
312
|
},
|
|
@@ -308,35 +333,38 @@
|
|
|
308
333
|
}
|
|
309
334
|
},
|
|
310
335
|
"devDependencies": {
|
|
311
|
-
"@babel/core": "
|
|
312
|
-
"@clerk/expo": "4.17.
|
|
336
|
+
"@babel/core": "7.29.13",
|
|
337
|
+
"@clerk/expo": "4.17.4",
|
|
338
|
+
"@expo-google-fonts/instrument-sans": "^0.4.2",
|
|
313
339
|
"@react-native-community/datetimepicker": "9.2.1",
|
|
314
|
-
"@types/react": "
|
|
340
|
+
"@types/react": "19.3.0",
|
|
315
341
|
"expo": "~58.0.26",
|
|
316
342
|
"expo-auth-session": "~58.0.19",
|
|
317
343
|
"expo-blur": "~58.0.6",
|
|
318
344
|
"expo-constants": "~58.0.16",
|
|
319
345
|
"expo-device": "~58.0.5",
|
|
346
|
+
"expo-font": "~58.0.12",
|
|
320
347
|
"expo-haptics": "~58.0.8",
|
|
321
348
|
"expo-linear-gradient": "~58.0.4",
|
|
322
349
|
"expo-notifications": "~58.1.9",
|
|
323
350
|
"expo-router": "~58.0.32",
|
|
351
|
+
"expo-splash-screen": "~58.0.14",
|
|
324
352
|
"expo-video": "~58.0.14",
|
|
325
353
|
"expo-web-browser": "~58.1.0",
|
|
326
|
-
"happy-dom": "
|
|
327
|
-
"react": "
|
|
354
|
+
"happy-dom": "21.0.4",
|
|
355
|
+
"react": "19.3.0",
|
|
328
356
|
"react-native": "0.88.1",
|
|
329
|
-
"react-native-gesture-handler": "
|
|
357
|
+
"react-native-gesture-handler": "3.3.0",
|
|
330
358
|
"react-native-keyboard-controller": "1.22.7",
|
|
331
359
|
"react-native-reanimated": "4.8.0",
|
|
332
|
-
"react-native-safe-area-context": "
|
|
333
|
-
"react-native-screens": "
|
|
360
|
+
"react-native-safe-area-context": "5.11.1",
|
|
361
|
+
"react-native-screens": "4.30.1",
|
|
334
362
|
"react-native-svg": "15.16.0",
|
|
335
363
|
"react-native-webview": "14.0.1",
|
|
336
364
|
"react-native-worklets": "0.14.0",
|
|
337
365
|
"typescript": "7.0.2",
|
|
338
|
-
"vitest": "
|
|
339
|
-
"@vvedantb/server": "0.
|
|
366
|
+
"vitest": "5.1.1",
|
|
367
|
+
"@vvedantb/server": "0.19.0"
|
|
340
368
|
},
|
|
341
369
|
"scripts": {
|
|
342
370
|
"build": "node scripts/build-dist.mjs && node scripts/check-exports.mjs",
|
package/src/ArtifactList.tsx
CHANGED
|
@@ -7,9 +7,7 @@ export type ArtifactRow = { id: string; title: string; description?: string };
|
|
|
7
7
|
|
|
8
8
|
export type ArtifactListProps = {
|
|
9
9
|
rows: ArtifactRow[];
|
|
10
|
-
/** Called with the `id` of the pressed row. */
|
|
11
10
|
onOpen: (id: string) => void;
|
|
12
|
-
/** Shown when `rows` is empty, such as an `EmptyState`. Nothing without it. */
|
|
13
11
|
empty?: ReactNode;
|
|
14
12
|
className?: string;
|
|
15
13
|
testID?: string;
|
package/src/Avatar.tsx
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
} from "react-native";
|
|
17
17
|
import { cn } from "./cn";
|
|
18
18
|
import { typeStyle } from "./controlStyles";
|
|
19
|
+
import { useGlass } from "./glass";
|
|
19
20
|
import { palette } from "./palette";
|
|
20
21
|
import { tokens } from "./tokens";
|
|
21
22
|
import { useScheme } from "./useScheme";
|
|
@@ -35,7 +36,6 @@ function useAvatar(part: string) {
|
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
export type AvatarProps = ViewProps & {
|
|
38
|
-
/** Diameter in points. Default 40 (the web `h-10 w-10`). */
|
|
39
39
|
size?: number;
|
|
40
40
|
className?: string;
|
|
41
41
|
};
|
|
@@ -43,6 +43,7 @@ export type AvatarProps = ViewProps & {
|
|
|
43
43
|
/** Round frame for `AvatarImage` and `AvatarFallback`, as the web `Avatar`. The fallback shows until the image loads, and stays if it fails. */
|
|
44
44
|
export function Avatar({ size = 40, className, style, children, ...props }: AvatarProps) {
|
|
45
45
|
const scheme = useScheme();
|
|
46
|
+
const glass = useGlass("small");
|
|
46
47
|
const [status, setStatus] = useState<ImageStatus>("idle");
|
|
47
48
|
return (
|
|
48
49
|
<AvatarContext.Provider value={{ size, status, setStatus }}>
|
|
@@ -56,6 +57,7 @@ export function Avatar({ size = 40, className, style, children, ...props }: Avat
|
|
|
56
57
|
borderColor: tokens.color.border[scheme],
|
|
57
58
|
backgroundColor: tokens.color.surfaceSecondary[scheme],
|
|
58
59
|
},
|
|
60
|
+
glass,
|
|
59
61
|
style,
|
|
60
62
|
]}
|
|
61
63
|
{...props}
|
|
@@ -72,7 +74,6 @@ export type AvatarImageProps = Omit<ImageProps, "style"> & {
|
|
|
72
74
|
|
|
73
75
|
export function AvatarImage({ onLoad, onError, className, ...props }: AvatarImageProps) {
|
|
74
76
|
const { status, setStatus } = useAvatar("AvatarImage");
|
|
75
|
-
// A new source gets a fresh try: back to the fallback until it loads.
|
|
76
77
|
const sourceKey = JSON.stringify(props.source);
|
|
77
78
|
const previousSource = useRef(sourceKey);
|
|
78
79
|
useEffect(() => {
|
|
@@ -100,7 +101,6 @@ export function AvatarImage({ onLoad, onError, className, ...props }: AvatarImag
|
|
|
100
101
|
}
|
|
101
102
|
|
|
102
103
|
export type AvatarFallbackProps = ViewProps & {
|
|
103
|
-
/** Usually initials (see `initials()`). A string is centred in Instrument Sans at 40% of the avatar size. */
|
|
104
104
|
children?: ReactNode;
|
|
105
105
|
className?: string;
|
|
106
106
|
textClassName?: string;
|
package/src/Badge.tsx
CHANGED
|
@@ -13,12 +13,8 @@ import { useScheme } from "./useScheme";
|
|
|
13
13
|
|
|
14
14
|
const SHEET_RADIUS = 20;
|
|
15
15
|
|
|
16
|
-
// A single open detent at 40% by default. A caller can pass several detents for
|
|
17
|
-
// multi-detent sizing. The closed detent (0) is added by the component.
|
|
18
16
|
const DEFAULT_DETENTS: readonly ModalDetent[] = ["40%"];
|
|
19
17
|
|
|
20
|
-
// A dimming scrim. The library scales this alpha to 0 at the closed detent and to
|
|
21
|
-
// full at an open one.
|
|
22
18
|
const SCRIM_COLOR = "rgba(0, 0, 0, 0.5)";
|
|
23
19
|
|
|
24
20
|
/**
|
|
@@ -46,24 +42,19 @@ export function BottomSheetContainer({
|
|
|
46
42
|
title: string;
|
|
47
43
|
children: React.ReactNode;
|
|
48
44
|
closeTestID?: string;
|
|
49
|
-
/** Open detents, shortest first. The closed detent is added automatically. */
|
|
50
45
|
detents?: readonly ModalDetent[];
|
|
51
46
|
}) {
|
|
52
47
|
const largerText = useLargerText();
|
|
53
48
|
const scheme = useScheme();
|
|
54
49
|
const isDark = scheme === "dark";
|
|
55
50
|
|
|
56
|
-
// The library sheet is controlled by a detent index. The first detent is the
|
|
57
|
-
// closed state (0); the open detents follow.
|
|
58
51
|
const detentList = useMemo<ModalDetent[]>(() => [0, ...detents], [detents]);
|
|
59
52
|
const [index, setIndex] = useState(0);
|
|
60
53
|
|
|
61
|
-
// Keep the index in step with `visible`: open to the first detent, close to 0.
|
|
62
54
|
useEffect(() => {
|
|
63
55
|
setIndex((current) => (visible ? (current === 0 ? 1 : current) : 0));
|
|
64
56
|
}, [visible]);
|
|
65
57
|
|
|
66
|
-
// A user-driven drag to the closed detent reports here; tell the parent.
|
|
67
58
|
const handleIndexChange = useCallback(
|
|
68
59
|
(next: number) => {
|
|
69
60
|
setIndex(next);
|
|
@@ -72,7 +63,6 @@ export function BottomSheetContainer({
|
|
|
72
63
|
[onClose],
|
|
73
64
|
);
|
|
74
65
|
|
|
75
|
-
// A scrim tap or system Back asks the sheet to close; close it and tell the parent.
|
|
76
66
|
const handleCloseRequest = useCallback(() => {
|
|
77
67
|
setIndex(0);
|
|
78
68
|
onClose();
|
|
@@ -88,7 +78,6 @@ export function BottomSheetContainer({
|
|
|
88
78
|
<ModalBottomSheet
|
|
89
79
|
index={index}
|
|
90
80
|
detents={detentList}
|
|
91
|
-
// Unmount the content once the sheet settles closed.
|
|
92
81
|
lazy
|
|
93
82
|
windowOverlay
|
|
94
83
|
scrimColor={SCRIM_COLOR}
|
package/src/BulkActionBar.tsx
CHANGED
|
@@ -20,20 +20,11 @@ import { NativeOnlyAnimatedView } from "./primitives/native-only-animated-view";
|
|
|
20
20
|
*/
|
|
21
21
|
export interface BulkBarAction {
|
|
22
22
|
key: string;
|
|
23
|
-
/** Full label: the More menu item and the accessible name. */
|
|
24
23
|
label: string;
|
|
25
|
-
/**
|
|
26
|
-
* Shorter label shown in the bar on wide screens, and under the icon with
|
|
27
|
-
* `placement="tabBar"` (defaults to `label`).
|
|
28
|
-
*/
|
|
29
24
|
shortLabel?: string;
|
|
30
|
-
/** A Tabler icon, drawn at 17 in the button colour. */
|
|
31
25
|
icon: ComponentType<IconProps>;
|
|
32
|
-
/** Label and icon in the danger colour. */
|
|
33
26
|
destructive?: boolean;
|
|
34
|
-
/** The web Alt-to-skip hint. No effect on a phone (no Alt key). */
|
|
35
27
|
showSkipHint?: boolean;
|
|
36
|
-
/** Native only: turns this action off even with a selection. */
|
|
37
28
|
disabled?: boolean;
|
|
38
29
|
onClick: () => void;
|
|
39
30
|
}
|
|
@@ -46,38 +37,11 @@ export interface BulkActionBarProps {
|
|
|
46
37
|
onSelectAll: () => void;
|
|
47
38
|
onClearSelection: () => void;
|
|
48
39
|
primaryActions: ReadonlyArray<BulkBarAction>;
|
|
49
|
-
/** Behind a More (dots) button, in a `DropdownMenu`. */
|
|
50
40
|
moreActions?: ReadonlyArray<BulkBarAction>;
|
|
51
|
-
/** On the right, after a divider. */
|
|
52
41
|
destructiveAction?: BulkBarAction;
|
|
53
|
-
/** The web motion key. Here the bar's `testID`. */
|
|
54
42
|
barKey?: string;
|
|
55
|
-
/**
|
|
56
|
-
* Space under the bar, in points, before its 12 gap. Default: the bottom
|
|
57
|
-
* safe-area inset. Above a `FloatingTabBar`, pass
|
|
58
|
-
* `tabBarReserve(largerText, insets.bottom)`. Not used with
|
|
59
|
-
* `placement="tabBar"`.
|
|
60
|
-
*/
|
|
61
43
|
bottomOffset?: number;
|
|
62
|
-
/**
|
|
63
|
-
* Native only: keep Cancel selection (X) and its divider outside the
|
|
64
|
-
* sideways scroll, at the bar's right end, so it shows even when the bar
|
|
65
|
-
* is wider than the screen. The rest of the bar still scrolls. Default
|
|
66
|
-
* `false`: the X scrolls with the actions, as the web.
|
|
67
|
-
*/
|
|
68
44
|
pinCancel?: boolean;
|
|
69
|
-
/**
|
|
70
|
-
* Native only. `"float"` (default): the web bar, floating 12 above
|
|
71
|
-
* `bottomOffset`. `"tabBar"`: the phone contextual bar, in the slot and
|
|
72
|
-
* shape of `FloatingTabBar` (hide the tab bar while selecting, with
|
|
73
|
-
* `tabBarStyle: { display: "none" }` on the screen). It shows up and
|
|
74
|
-
* leaves at once, so the two bars swap with no gap. Each action is its
|
|
75
|
-
* icon over its `shortLabel` (12, or 14 with larger text) in a box 48 high
|
|
76
|
-
* (56 with larger text) that shares out the spare width. There is no count
|
|
77
|
-
* chip: the screen header shows the count, as Android's contextual action
|
|
78
|
-
* bar, and no dividers, as the tab bar. Cancel selection (X) is pinned, as
|
|
79
|
-
* with `pinCancel`.
|
|
80
|
-
*/
|
|
81
45
|
placement?: BulkBarPlacement;
|
|
82
46
|
}
|
|
83
47
|
|
|
@@ -86,12 +50,6 @@ export type BulkBarPlacement = "float" | "tabBar";
|
|
|
86
50
|
/** The web `sm` breakpoint: below it, bar buttons are icon-only and "selected" is hidden. */
|
|
87
51
|
export const BULK_BAR_LABEL_MIN_WIDTH = 640;
|
|
88
52
|
|
|
89
|
-
/**
|
|
90
|
-
* Web `h-9` buttons with a 17 icon and `text-sm`; with larger text 48 high, a
|
|
91
|
-
* 22 icon and `text-lg`. In the tab bar slot: 48 high with a 20 icon over a
|
|
92
|
-
* `text-xs` label; with larger text 56, a 24 icon and `text-sm`. `caption` is
|
|
93
|
-
* the count chip, or the label under a docked icon.
|
|
94
|
-
*/
|
|
95
53
|
function barMetrics(largerText: boolean, docked: boolean) {
|
|
96
54
|
if (docked) {
|
|
97
55
|
return largerText
|
|
@@ -103,8 +61,6 @@ function barMetrics(largerText: boolean, docked: boolean) {
|
|
|
103
61
|
: { height: 36, icon: 17, text: sizeStyle("text-sm"), caption: sizeStyle("text-xs") };
|
|
104
62
|
}
|
|
105
63
|
|
|
106
|
-
// Docked at the bottom: it rises into place and sinks back out, the exit 20%
|
|
107
|
-
// quicker.
|
|
108
64
|
const BAR_ENTER = FadeInDown.duration(150).easing(EASE_OUT);
|
|
109
65
|
const BAR_EXIT = FadeOutDown.duration(120).easing(EASE_OUT);
|
|
110
66
|
|
|
@@ -141,15 +97,11 @@ export function BulkActionBar({
|
|
|
141
97
|
if (!isSelecting) return null;
|
|
142
98
|
const docked = placement === "tabBar";
|
|
143
99
|
const metrics = barMetrics(largerText, docked);
|
|
144
|
-
// Docked has no X to pin: the header holds it.
|
|
145
100
|
const pinned = pinCancel && !docked;
|
|
146
|
-
// Docked, every action shows its label (under the icon).
|
|
147
101
|
const labelled = docked || width >= BULK_BAR_LABEL_MIN_WIDTH;
|
|
148
102
|
const hasSelection = selectedCount > 0;
|
|
149
103
|
const allSelected = totalCount > 0 && selectedCount >= totalCount;
|
|
150
104
|
const muted = tokens.color.muted[scheme];
|
|
151
|
-
// Docked, the screen's header carries the close X (Android's contextual
|
|
152
|
-
// action bar), so the bar has none: one exit, and room for every label.
|
|
153
105
|
const cancel = docked ? null : (
|
|
154
106
|
<>
|
|
155
107
|
<BarDivider />
|
|
@@ -163,7 +115,6 @@ export function BulkActionBar({
|
|
|
163
115
|
<NativeOnlyAnimatedView
|
|
164
116
|
testID={barKey}
|
|
165
117
|
pointerEvents="box-none"
|
|
166
|
-
// Docked, the bar swaps with the tab bar at once.
|
|
167
118
|
entering={docked ? undefined : BAR_ENTER}
|
|
168
119
|
exiting={docked ? undefined : BAR_EXIT}
|
|
169
120
|
style={
|
|
@@ -183,16 +134,13 @@ export function BulkActionBar({
|
|
|
183
134
|
radius={docked ? FLOATING_PILL_RADIUS : tokens.radius.lg}
|
|
184
135
|
style={docked ? undefined : { maxWidth: width - 32 }}
|
|
185
136
|
>
|
|
186
|
-
{/* Docked: as high as the tab bar it stands in for. */}
|
|
187
137
|
<View style={{ flexDirection: "row", alignItems: "center", height: docked ? tabBarHeight(largerText) : undefined }}>
|
|
188
138
|
<ScrollView
|
|
189
139
|
horizontal
|
|
190
140
|
bounces={false}
|
|
191
141
|
showsHorizontalScrollIndicator={false}
|
|
192
|
-
// Pinned: the scroll gives up width first, and the X part keeps the right padding.
|
|
193
142
|
style={pinned || docked ? { flexShrink: 1 } : undefined}
|
|
194
143
|
contentContainerStyle={{
|
|
195
|
-
// Docked, the actions grow to fill the bar, and it scrolls only when they do not fit.
|
|
196
144
|
...(docked ? { flexGrow: 1 } : null),
|
|
197
145
|
flexDirection: "row",
|
|
198
146
|
alignItems: "center",
|
|
@@ -281,8 +229,6 @@ export function BulkActionBar({
|
|
|
281
229
|
{pinned ? null : cancel}
|
|
282
230
|
</ScrollView>
|
|
283
231
|
{pinned ? (
|
|
284
|
-
// The scroll's 4 gap before the divider, then the bar's end padding.
|
|
285
|
-
// Docked, as the tab bar: no dividers and no gaps, the boxes' own padding apart.
|
|
286
232
|
<View style={{ flexDirection: "row", alignItems: "center", gap: 4, paddingLeft: docked ? 0 : 4, paddingRight: docked ? 8 : 10 }}>
|
|
287
233
|
{cancel}
|
|
288
234
|
</View>
|
|
@@ -293,12 +239,6 @@ export function BulkActionBar({
|
|
|
293
239
|
);
|
|
294
240
|
}
|
|
295
241
|
|
|
296
|
-
/**
|
|
297
|
-
* A bar button box: the web `h-9 rounded-lg`, at least 44 wide and slopped to
|
|
298
|
-
* 44 high, `surface-secondary` while pressed (a 10% danger tint for a
|
|
299
|
-
* destructive one), faded to 30% when off. Docked: a pill (as the tab bar's
|
|
300
|
-
* active pill), at least 48 wide.
|
|
301
|
-
*/
|
|
302
242
|
function barButtonStyle(
|
|
303
243
|
height: number,
|
|
304
244
|
paddingX: number,
|
|
@@ -337,7 +277,6 @@ function BarPressable({
|
|
|
337
277
|
height: number;
|
|
338
278
|
paddingX: number;
|
|
339
279
|
docked: boolean;
|
|
340
|
-
/** Take a share of the bar's spare width (a docked action). */
|
|
341
280
|
grow?: boolean;
|
|
342
281
|
label?: string;
|
|
343
282
|
disabled?: boolean;
|
|
@@ -364,10 +303,6 @@ function BarPressable({
|
|
|
364
303
|
);
|
|
365
304
|
}
|
|
366
305
|
|
|
367
|
-
/**
|
|
368
|
-
* One action: the icon, and on wide screens the short label beside it
|
|
369
|
-
* (`text-sm` medium). Docked, the short label sits under the icon (`caption`).
|
|
370
|
-
*/
|
|
371
306
|
function BarButton({
|
|
372
307
|
action,
|
|
373
308
|
disabled,
|
|
@@ -425,7 +360,6 @@ function BarButton({
|
|
|
425
360
|
);
|
|
426
361
|
}
|
|
427
362
|
|
|
428
|
-
/** The web vertical `Separator`: `mx-1.5 h-5 bg-border`. */
|
|
429
363
|
function BarDivider() {
|
|
430
364
|
const scheme = useScheme();
|
|
431
365
|
return (
|
package/src/Button.tsx
CHANGED
|
@@ -8,15 +8,14 @@ import { cn } from "./cn";
|
|
|
8
8
|
import { buttonColors, sizeStyle, typeStyle, type ButtonVariant } from "./controlStyles";
|
|
9
9
|
import { useDialogLayout } from "./dialogLayout";
|
|
10
10
|
import { floatingShadow } from "./floating";
|
|
11
|
+
import { useGlass } from "./glass";
|
|
11
12
|
import { Spinner } from "./Spinner";
|
|
12
13
|
import { useLargerText } from "./theme";
|
|
13
14
|
import { tokens } from "./tokens";
|
|
14
15
|
import { useScheme } from "./useScheme";
|
|
15
16
|
|
|
16
|
-
/** `sm`, `default` (or `md`) and `lg` are the web names for `small`, `medium` and `large`. `icon` is a square button. */
|
|
17
17
|
type ButtonSize = "small" | "medium" | "large" | "sm" | "md" | "default" | "lg" | "icon";
|
|
18
18
|
|
|
19
|
-
/** The web `shape`. `"pill"` (default) is fully round; `"rounded"` is radius 16, the look before 0.6.0. */
|
|
20
19
|
type ButtonShape = "pill" | "rounded";
|
|
21
20
|
|
|
22
21
|
interface ButtonProps extends Omit<
|
|
@@ -27,27 +26,13 @@ interface ButtonProps extends Omit<
|
|
|
27
26
|
variant?: ButtonVariant;
|
|
28
27
|
icon?: keyof typeof MaterialIcons.glyphMap;
|
|
29
28
|
leftIcon?: React.ReactNode;
|
|
30
|
-
/** Web name for `leftIcon`. `leftIcon` wins when both are set. */
|
|
31
29
|
startContent?: React.ReactNode;
|
|
32
|
-
/** Rendered after the label. */
|
|
33
30
|
endContent?: React.ReactNode;
|
|
34
31
|
loading?: boolean;
|
|
35
32
|
size?: ButtonSize;
|
|
36
|
-
/**
|
|
37
|
-
* Default `"pill"`: fully round at every size and variant, so `icon` is a
|
|
38
|
-
* circle (web `rounded-full`). `"rounded"`: radius 16 at every size, the
|
|
39
|
-
* look before 0.6.0 (web `shape="rounded"`, `rounded-lg`). A `style`
|
|
40
|
-
* radius wins over either.
|
|
41
|
-
*/
|
|
42
33
|
shape?: ButtonShape;
|
|
43
|
-
/**
|
|
44
|
-
* Default `true`. In the stacked footer of a compact dialog the button fills
|
|
45
|
-
* the width whatever this says, as on the web.
|
|
46
|
-
*/
|
|
47
34
|
fullWidth?: boolean;
|
|
48
|
-
/** Label, or other content. Give a button with no text child an `accessibilityLabel`. */
|
|
49
35
|
children?: React.ReactNode;
|
|
50
|
-
/** `"shadow"` adds the floating shadow to `primary` and `default`. Default `"flat"`: the web button has none. */
|
|
51
36
|
shadowType?: "flat" | "shadow";
|
|
52
37
|
className?: string;
|
|
53
38
|
}
|
|
@@ -63,12 +48,6 @@ const SIZE_ALIAS = {
|
|
|
63
48
|
icon: "icon",
|
|
64
49
|
} as const;
|
|
65
50
|
|
|
66
|
-
// `regular` is the web `Button` (`default` h-10 px-4, `lg` h-11 px-6, `icon`
|
|
67
|
-
// h-10 w-10), except `sm`: the web h-8 `text-xs` is a desktop size, so here it
|
|
68
|
-
// is 36 high with a 14 label (`text-sm`). `larger` is the larger-text step-up from
|
|
69
|
-
// 0.3.2. Labelled sizes are minimum heights (`h-auto` drops the primitive's
|
|
70
|
-
// `h-10`), so a large Dynamic Type size grows the button instead of clipping
|
|
71
|
-
// the label.
|
|
72
51
|
const HEIGHT = {
|
|
73
52
|
regular: {
|
|
74
53
|
small: "h-auto min-h-9 px-3",
|
|
@@ -84,34 +63,21 @@ const HEIGHT = {
|
|
|
84
63
|
},
|
|
85
64
|
};
|
|
86
65
|
|
|
87
|
-
// Each class is also set as a style (`sizeStyle`): web `text-sm` is 14 / 20.
|
|
88
66
|
const TEXT = {
|
|
89
67
|
regular: { small: "text-sm", medium: "text-sm", large: "text-sm", icon: "text-sm" },
|
|
90
68
|
larger: { small: "text-base", medium: "text-xl", large: "text-2xl", icon: "text-base" },
|
|
91
69
|
} as const;
|
|
92
70
|
|
|
93
|
-
// The web sizes are under the 44 pt touch target; the slop brings each to 44
|
|
94
|
-
// or more. `small` (32) slops only above and below: small buttons sit 4 apart
|
|
95
|
-
// in a row (Cancel and Delete), and side slop would let one steal the other's
|
|
96
|
-
// taps. The larger sizes are 56 or more and need none.
|
|
97
71
|
const HIT_SLOP = {
|
|
98
72
|
regular: { small: { top: 6, bottom: 6, left: 0, right: 0 }, medium: 4, large: 2, icon: 4 },
|
|
99
73
|
larger: { small: undefined, medium: undefined, large: undefined, icon: undefined },
|
|
100
74
|
};
|
|
101
75
|
|
|
102
|
-
// The web `shape` (from @vvedantb/ui 0.31.0). `pill` is `rounded-full`:
|
|
103
|
-
// `tokens.radius.pill` (999), far more than half the tallest minimum height
|
|
104
|
-
// (72), so the ends are half circles. `rounded` is `rounded-lg` (`--radius`, 16). The web
|
|
105
|
-
// `rounded` is `rounded-md` on `xs` and `icon-xs`, sizes native does not have,
|
|
106
|
-
// so here it is 16 at every size. Styles, because apps' NativeWind themes set
|
|
107
|
-
// their own `rounded-lg`.
|
|
108
76
|
const RADIUS: Record<ButtonShape, number> = {
|
|
109
77
|
pill: tokens.radius.pill,
|
|
110
78
|
rounded: tokens.radius.lg,
|
|
111
79
|
};
|
|
112
80
|
|
|
113
|
-
// Colours come from `buttonColors` as styles, except `tinted` (a legacy
|
|
114
|
-
// alias), which keeps the pink classes that `outline` used before 0.3.0.
|
|
115
81
|
const VARIANT_CLASS: Partial<Record<ButtonVariant, string>> = {
|
|
116
82
|
link: "h-auto border-0 px-0",
|
|
117
83
|
tinted: "border-0 bg-pink-50 dark:bg-pink-900/20",
|
|
@@ -168,16 +134,17 @@ export const Button = React.forwardRef<React.ElementRef<typeof PrimitiveButton>,
|
|
|
168
134
|
const contentColor = colors?.color ?? PINK_600;
|
|
169
135
|
const elevate =
|
|
170
136
|
shadowType === "shadow" && (variant === "primary" || variant === "default");
|
|
137
|
+
const glass = useGlass("control");
|
|
138
|
+
const filled = variant === "primary" || variant === "default" || variant === "secondary";
|
|
171
139
|
const baseStyle = [
|
|
172
140
|
{ borderRadius: RADIUS[shape] },
|
|
173
141
|
elevate ? floatingShadow : null,
|
|
142
|
+
filled ? glass : null,
|
|
174
143
|
colors
|
|
175
144
|
? { backgroundColor: colors.backgroundColor, borderColor: colors.borderColor }
|
|
176
145
|
: null,
|
|
177
146
|
];
|
|
178
147
|
const callerStyle = props.style;
|
|
179
|
-
// As on the web, `loading` swaps the start content for the 16 ring (`h-4
|
|
180
|
-
// w-4`, Spinner `sm`) and keeps the label.
|
|
181
148
|
const start = loading ? (
|
|
182
149
|
<Spinner size="sm" color={contentColor} decorative />
|
|
183
150
|
) : (
|
|
@@ -199,10 +166,7 @@ export const Button = React.forwardRef<React.ElementRef<typeof PrimitiveButton>,
|
|
|
199
166
|
className={cn(
|
|
200
167
|
"relative border",
|
|
201
168
|
HEIGHT[scale][resolvedSize],
|
|
202
|
-
// Column flex children stretch by default (React Native Web too), so
|
|
203
|
-
// a button that is not full width must opt out with `self-start`.
|
|
204
169
|
resolvedSize !== "icon" && (fullWidth || dialog.stacked ? "w-full" : "self-start"),
|
|
205
|
-
// The web compact dialog: labelled buttons at least 44 high (`min-h-11`).
|
|
206
170
|
dialog.compact && scale === "regular" && resolvedSize !== "icon" && "min-h-11",
|
|
207
171
|
VARIANT_CLASS[variant],
|
|
208
172
|
className,
|