@vvedantb/native-ui 0.38.0 → 0.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Avatar.jsx +22 -19
- package/dist/BottomSheetContainer.jsx +0 -6
- package/dist/BulkActionBar.jsx +0 -24
- package/dist/Button.jsx +92 -116
- package/dist/Card.jsx +56 -50
- package/dist/ColorSwatches.jsx +0 -6
- package/dist/Dialog.jsx +0 -12
- package/dist/DropdownMenu.jsx +0 -10
- package/dist/EmptyState.jsx +0 -3
- package/dist/ExpoWebRoot.jsx +0 -6
- package/dist/Field.jsx +0 -17
- package/dist/FloatingSurface.jsx +95 -80
- package/dist/FloatingTabBar.jsx +0 -23
- package/dist/IconButton.jsx +0 -1
- package/dist/LoadingState.jsx +0 -6
- package/dist/PasswordInput.jsx +0 -15
- package/dist/PillTabs.jsx +39 -36
- package/dist/SearchInput.jsx +0 -13
- package/dist/SectionLabel.jsx +0 -1
- package/dist/SharedTransition.jsx +0 -3
- package/dist/Skeleton.jsx +0 -2
- package/dist/Spinner.jsx +0 -2
- package/dist/StatusDot.jsx +0 -5
- package/dist/Switch.jsx +32 -22
- package/dist/Tabs.jsx +27 -26
- package/dist/Textarea.jsx +0 -1
- package/dist/ThemeToggle.jsx +0 -1
- package/dist/Toast.jsx +80 -91
- package/dist/UpdateChecker.jsx +0 -1
- package/dist/ai/activity-question.jsx +0 -6
- package/dist/ai/activity-step-label.js +0 -6
- package/dist/ai/activity-step-types.js +0 -4
- package/dist/ai/activity-tasks-utils.js +0 -17
- package/dist/ai/activity-timeline.js +0 -8
- package/dist/ai/attachments.jsx +0 -2
- package/dist/ai/chain-of-thought.jsx +0 -3
- package/dist/ai/chat-text.js +2 -3
- package/dist/ai/chat-thread.jsx +0 -1
- package/dist/ai/choice-question.jsx +0 -10
- package/dist/ai/code-block.jsx +0 -31
- package/dist/ai/collapsible.jsx +0 -14
- package/dist/ai/conversation-context.js +0 -3
- package/dist/ai/conversation.jsx +2 -48
- package/dist/ai/file-chip.jsx +0 -2
- package/dist/ai/icon-button.jsx +10 -18
- package/dist/ai/index.js +0 -5
- package/dist/ai/message-context-menu.jsx +0 -7
- package/dist/ai/message.jsx +0 -21
- package/dist/ai/prompt-input-menu.jsx +0 -3
- package/dist/ai/prompt-input.jsx +2 -29
- package/dist/ai/response-text.jsx +0 -6
- package/dist/ai/sources.jsx +0 -1
- package/dist/ai/suggestion.jsx +0 -1
- package/dist/ai/trace.jsx +0 -11
- package/dist/ai/unified-diff.jsx +0 -4
- package/dist/auth/AuthScreen.jsx +0 -5
- package/dist/auth/GoogleSignInButton.jsx +0 -3
- package/dist/auth/SecondFactorScreen.jsx +0 -2
- package/dist/auth/SignInScreen.jsx +0 -17
- package/dist/auth/authErrors.js +0 -4
- package/dist/auth/clerkCore3.js +0 -7
- package/dist/auth/index.js +0 -4
- package/dist/auth/totp.js +0 -2
- package/dist/brand/GoogleMark.jsx +0 -1
- package/dist/brand/ProviderIcon.jsx +0 -2
- package/dist/brand/index.js +0 -3
- package/dist/brand/svg.js +0 -6
- package/dist/configureTheme.js +0 -9
- package/dist/controlStyles.js +0 -14
- package/dist/crash/lastCrash.js +3 -24
- package/dist/entries/ai.js +0 -3
- package/dist/entries/ambient.js +0 -2
- package/dist/entries/app-root.js +0 -5
- package/dist/entries/auth.js +0 -4
- package/dist/entries/bottom-sheet.js +0 -2
- package/dist/entries/brand.js +0 -1
- package/dist/entries/button.js +0 -1
- package/dist/entries/crash.js +0 -3
- package/dist/entries/date-time.js +0 -2
- package/dist/entries/expo-router.js +0 -3
- package/dist/entries/expo-web-root.js +0 -2
- package/dist/entries/floating.js +0 -2
- package/dist/entries/generative-ui.js +0 -4
- package/dist/entries/gesture-handler.js +0 -3
- package/dist/entries/keyboard-controller.js +0 -3
- package/dist/entries/layout.js +0 -2
- package/dist/entries/markdown.js +0 -3
- package/dist/entries/marketing.js +0 -1
- package/dist/entries/page-title.js +0 -5
- package/dist/entries/password-input.js +0 -2
- package/dist/entries/paste-input.js +0 -3
- package/dist/entries/primitives.js +0 -6
- package/dist/entries/search-input.js +0 -2
- package/dist/entries/tab-bar.js +0 -2
- package/dist/entries/theme.js +1 -2
- package/dist/entries/toast.js +0 -3
- package/dist/entries/video.js +0 -2
- package/dist/entries/webview.js +0 -2
- package/dist/examples/AiChatGallery.jsx +0 -11
- package/dist/examples/ParityGallery.jsx +0 -12
- package/dist/floating.js +0 -8
- package/dist/generative-ui/GenerativeUiPanel.jsx +0 -2
- package/dist/generative-ui/components.jsx +0 -8
- package/dist/glass.js +55 -0
- package/dist/glassBlur.jsx +0 -12
- package/dist/highlight.js +0 -26
- package/dist/index.js +1 -2
- package/dist/loadingGrid.js +0 -13
- package/dist/markdown/Markdown.jsx +0 -59
- package/dist/markdown/MarkdownTable.jsx +0 -18
- package/dist/markdown/tableText.js +0 -5
- package/dist/marketing/UpgradeToProCard.jsx +0 -5
- package/dist/marketing/pricing.js +0 -3
- package/dist/media/ImageGallery.jsx +0 -16
- package/dist/media/imageZoom.js +0 -4
- package/dist/media/zoom-image-gesture.jsx +0 -8
- package/dist/media/zoomImage.js +0 -3
- package/dist/motion.js +0 -3
- package/dist/neutralTheme.js +0 -5
- package/dist/pagerSwipe.js +0 -16
- package/dist/palette.js +0 -10
- package/dist/primitives/button.jsx +0 -5
- package/dist/primitives/keyboard-controller.jsx +0 -27
- package/dist/primitives/native-only-animated-view.jsx +0 -5
- package/dist/primitives/overlay.jsx +0 -2
- package/dist/primitives/pager-gesture.jsx +3 -29
- package/dist/primitives/paste-input.jsx +0 -5
- package/dist/primitives/select.jsx +0 -8
- package/dist/primitives/sheet-drag.jsx +0 -3
- package/dist/primitives/sheet-gesture.jsx +0 -8
- package/dist/primitives/swipe-row-gesture.jsx +3 -45
- package/dist/primitives/text.jsx +0 -5
- package/dist/primitives/toast-drag-gesture.jsx +4 -24
- package/dist/primitives/web-click-guard.js +0 -3
- package/dist/primitives/window-layer.jsx +0 -14
- package/dist/push.js +0 -6
- package/dist/relativeTime.js +0 -13
- package/dist/settings/MoreFromProjectV.jsx +0 -5
- package/dist/settings/ThemeModePicker.jsx +0 -4
- package/dist/settings/projectVMobileApps.js +1 -6
- package/dist/sheetDrag.js +0 -10
- package/dist/swipeRow.js +0 -15
- package/dist/tabBarRoutes.js +0 -4
- package/dist/tabIndicator.js +0 -4
- package/dist/tailwind-preset.cjs +0 -54
- package/dist/tailwind-preset.d.cts +0 -8
- package/dist/theme.jsx +29 -21
- package/dist/themeModeStore.js +0 -5
- package/dist/toastChrome.js +0 -6
- package/dist/toastDrag.js +0 -14
- package/dist/toastStore.js +0 -4
- package/dist/updateCheck.js +0 -7
- package/dist/video/InlineVideo.jsx +0 -2
- package/dist/webview/htmlView.js +0 -5
- package/package.json +3 -3
- package/src/ArtifactList.tsx +0 -2
- package/src/Avatar.tsx +3 -3
- package/src/Badge.tsx +0 -1
- package/src/BottomSheetContainer.tsx +0 -11
- package/src/BulkActionBar.tsx +0 -66
- package/src/Button.tsx +4 -40
- package/src/CaptureButton.tsx +0 -1
- package/src/Card.tsx +3 -15
- package/src/Checkbox.tsx +0 -2
- package/src/ColorSwatches.tsx +0 -9
- package/src/ConfirmDialog.tsx +0 -7
- package/src/DateTimeField.tsx +0 -5
- package/src/Dialog.tsx +0 -27
- package/src/DividedList.tsx +0 -1
- package/src/DropdownMenu.tsx +0 -51
- package/src/EmptyState.tsx +0 -5
- package/src/ExpoWebRoot.tsx +0 -10
- package/src/Field.tsx +0 -14
- package/src/FloatingFAB.tsx +0 -3
- package/src/FloatingSurface.tsx +11 -8
- package/src/FloatingTabBar.tsx +0 -25
- package/src/IconButton.tsx +0 -5
- package/src/Input.tsx +0 -1
- package/src/Label.tsx +0 -1
- package/src/LabeledSwitchRow.tsx +0 -2
- package/src/ListRow.tsx +0 -12
- package/src/LoadingState.tsx +0 -12
- package/src/MenuSheet.tsx +0 -2
- package/src/PageIndicator.tsx +0 -2
- package/src/PageTitle.tsx +0 -15
- package/src/Pager.tsx +0 -9
- package/src/PasswordInput.tsx +0 -24
- package/src/PillTabs.tsx +3 -11
- package/src/PinnedBotTile.tsx +0 -6
- package/src/Progress.tsx +0 -3
- package/src/ReactionRow.tsx +0 -8
- package/src/ScreenContainer.tsx +0 -4
- package/src/SearchInput.tsx +0 -25
- package/src/SectionLabel.tsx +0 -2
- package/src/Select.tsx +0 -6
- package/src/Separator.tsx +0 -2
- package/src/SharedTransition.tsx +0 -7
- package/src/Sheet.tsx +0 -3
- package/src/SheetRow.tsx +0 -12
- package/src/Skeleton.tsx +0 -10
- package/src/Spinner.tsx +0 -6
- package/src/StackPageHeader.tsx +0 -16
- package/src/StatGrid.tsx +0 -1
- package/src/StatusDot.tsx +0 -6
- package/src/SurfaceRow.tsx +0 -12
- package/src/SwipeableRow.tsx +0 -4
- package/src/Switch.tsx +3 -4
- package/src/Tabs.tsx +3 -27
- package/src/Textarea.tsx +0 -2
- package/src/ThemeToggle.tsx +0 -1
- package/src/Toast.tsx +3 -19
- package/src/UpdateChecker.tsx +0 -46
- package/src/ai/activity-question.tsx +0 -8
- package/src/ai/activity-step-detail.tsx +0 -5
- package/src/ai/activity-step-label.ts +0 -5
- package/src/ai/activity-step-types.ts +0 -24
- package/src/ai/activity-step.tsx +0 -4
- package/src/ai/activity-tasks-utils.ts +0 -13
- package/src/ai/activity-timeline.ts +0 -6
- package/src/ai/attachments.tsx +0 -13
- package/src/ai/chain-of-thought.tsx +0 -5
- package/src/ai/chat-jump-rail.tsx +0 -2
- package/src/ai/chat-text.ts +2 -3
- package/src/ai/chat-thread.tsx +0 -9
- package/src/ai/choice-question.tsx +0 -36
- package/src/ai/code-block.tsx +0 -52
- package/src/ai/collapsible.tsx +0 -12
- package/src/ai/conversation-context.ts +0 -14
- package/src/ai/conversation.tsx +0 -58
- package/src/ai/file-chip.tsx +0 -1
- package/src/ai/icon-button.tsx +5 -22
- package/src/ai/index.ts +0 -5
- package/src/ai/message-action-sheet.tsx +0 -8
- package/src/ai/message-context-menu.tsx +0 -22
- package/src/ai/message-quote.tsx +0 -4
- package/src/ai/message.tsx +0 -66
- package/src/ai/prompt-input-menu.tsx +0 -19
- package/src/ai/prompt-input.tsx +1 -98
- package/src/ai/reasoning.tsx +0 -6
- package/src/ai/reply-quote-chip.tsx +0 -5
- package/src/ai/response-text.tsx +0 -8
- package/src/ai/shimmer.tsx +0 -2
- package/src/ai/sources.tsx +0 -3
- package/src/ai/subagent-cards.tsx +0 -13
- package/src/ai/suggestion.tsx +0 -4
- package/src/ai/tool-approval-card.tsx +0 -14
- package/src/ai/trace.tsx +0 -23
- package/src/ai/unified-diff.tsx +0 -16
- package/src/ai/use-streaming-disclosure.ts +0 -4
- package/src/app-root/AuthGroupGate.tsx +0 -8
- package/src/app-root/SsoCallbackScreen.tsx +0 -10
- package/src/app-root/fonts.ts +0 -2
- package/src/auth/AccountScreens.tsx +0 -16
- package/src/auth/AuthProviders.tsx +0 -13
- package/src/auth/AuthScreen.tsx +0 -12
- package/src/auth/GoogleSignInButton.tsx +0 -12
- package/src/auth/SecondFactorScreen.tsx +0 -16
- package/src/auth/SignInScreen.tsx +0 -68
- package/src/auth/authErrors.ts +0 -6
- package/src/auth/clerkCore3.ts +0 -6
- package/src/auth/index.ts +0 -4
- package/src/auth/totp.ts +0 -13
- package/src/brand/AppIcons.tsx +0 -6
- package/src/brand/AppMark.tsx +0 -5
- package/src/brand/AppWordmark.tsx +0 -7
- package/src/brand/GoogleMark.tsx +0 -4
- package/src/brand/ProviderIcon.tsx +0 -6
- package/src/brand/familyApps.ts +0 -2
- package/src/brand/index.ts +0 -3
- package/src/brand/svg.ts +0 -9
- package/src/configureTheme.ts +0 -10
- package/src/controlStyles.ts +0 -12
- package/src/crash/LastCrashDialog.tsx +0 -6
- package/src/crash/lastCrash.ts +0 -21
- package/src/entries/ai.ts +0 -3
- package/src/entries/ambient.ts +0 -2
- package/src/entries/app-root.ts +0 -5
- package/src/entries/auth.ts +0 -4
- package/src/entries/bottom-sheet.ts +0 -2
- package/src/entries/brand.ts +0 -1
- package/src/entries/button.ts +0 -1
- package/src/entries/crash.ts +0 -3
- package/src/entries/date-time.ts +0 -2
- package/src/entries/expo-router.ts +0 -3
- package/src/entries/expo-web-root.ts +0 -2
- package/src/entries/floating.ts +0 -2
- package/src/entries/generative-ui.ts +0 -4
- package/src/entries/gesture-handler.ts +0 -3
- package/src/entries/keyboard-controller.ts +0 -3
- package/src/entries/layout.ts +0 -2
- package/src/entries/markdown.ts +0 -3
- package/src/entries/marketing.ts +0 -1
- package/src/entries/page-title.ts +0 -5
- package/src/entries/password-input.ts +0 -2
- package/src/entries/paste-input.ts +0 -3
- package/src/entries/primitives.ts +0 -6
- package/src/entries/search-input.ts +0 -2
- package/src/entries/tab-bar.ts +0 -2
- package/src/entries/theme.ts +2 -2
- package/src/entries/toast.ts +0 -3
- package/src/entries/video.ts +0 -2
- package/src/entries/webview.ts +0 -2
- package/src/examples/AiChatGallery.tsx +0 -11
- package/src/examples/ParityGallery.tsx +0 -25
- package/src/floating.ts +0 -6
- package/src/generative-ui/GenerativeUiPanel.tsx +0 -15
- package/src/generative-ui/components.tsx +0 -9
- package/src/generative-ui/context.ts +0 -2
- package/src/glass.ts +31 -0
- package/src/glassBlur.tsx +0 -15
- package/src/highlight.ts +0 -20
- package/src/index.ts +2 -2
- package/src/loadingGrid.ts +0 -12
- package/src/markdown/Markdown.tsx +0 -71
- package/src/markdown/MarkdownTable.tsx +0 -23
- package/src/markdown/tableText.ts +0 -3
- package/src/marketing/PricingModal.tsx +0 -13
- package/src/marketing/UpgradeToProCard.tsx +0 -14
- package/src/marketing/pricing.ts +0 -12
- package/src/media/ImageGallery.tsx +0 -18
- package/src/media/MediaCard.tsx +0 -8
- package/src/media/imageZoom.ts +0 -4
- package/src/media/zoom-image-gesture.tsx +0 -9
- package/src/media/zoomImage.ts +0 -5
- package/src/motion.ts +0 -3
- package/src/neutralTheme.ts +0 -3
- package/src/pagerSwipe.ts +0 -13
- package/src/palette.ts +0 -10
- package/src/pressScale.ts +0 -7
- package/src/primitives/button.tsx +0 -4
- package/src/primitives/card.tsx +0 -1
- package/src/primitives/input.tsx +0 -4
- package/src/primitives/keyboard-controller.tsx +0 -25
- package/src/primitives/keyboard-parts.tsx +0 -27
- package/src/primitives/native-only-animated-view.tsx +0 -5
- package/src/primitives/overlay.tsx +0 -25
- package/src/primitives/pager-gesture.tsx +0 -20
- package/src/primitives/paste-input.tsx +0 -4
- package/src/primitives/paste-parts.tsx +0 -1
- package/src/primitives/select.tsx +0 -16
- package/src/primitives/sheet-drag.tsx +0 -19
- package/src/primitives/sheet-gesture.tsx +0 -22
- package/src/primitives/swipe-row-gesture.tsx +0 -33
- package/src/primitives/switch.tsx +0 -4
- package/src/primitives/text.tsx +0 -4
- package/src/primitives/toast-drag-gesture.tsx +0 -13
- package/src/primitives/web-click-guard.ts +0 -2
- package/src/primitives/window-layer.tsx +0 -18
- package/src/push.ts +0 -15
- package/src/relativeTime.ts +0 -21
- package/src/router/RouterStackPageHeader.tsx +0 -1
- package/src/settings/MoreFromProjectV.tsx +0 -8
- package/src/settings/SettingsEmptyState.tsx +0 -2
- package/src/settings/SettingsSection.tsx +0 -3
- package/src/settings/SettingsToggleRow.tsx +0 -4
- package/src/settings/ThemeModePicker.tsx +0 -11
- package/src/settings/projectVMobileApps.ts +0 -8
- package/src/sheetDrag.ts +0 -9
- package/src/swipeRow.ts +0 -23
- package/src/tabBarRoutes.ts +0 -13
- package/src/tabIndicator.ts +0 -5
- package/src/tailwind-preset.cjs +0 -54
- package/src/tailwind-preset.d.cts +0 -8
- package/src/theme.tsx +11 -2
- package/src/themeModeStore.ts +0 -9
- package/src/toastChrome.ts +0 -6
- package/src/toastDrag.ts +0 -13
- package/src/toastStore.ts +0 -7
- package/src/updateCheck.ts +0 -15
- package/src/video/InlineVideo.tsx +0 -5
- package/src/webview/HtmlView.tsx +0 -23
- package/src/webview/HtmlView.web.tsx +0 -1
- package/src/webview/htmlView.ts +0 -5
package/src/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,
|
package/src/CaptureButton.tsx
CHANGED
package/src/Card.tsx
CHANGED
|
@@ -9,26 +9,19 @@ import {
|
|
|
9
9
|
} from "./primitives/card";
|
|
10
10
|
import { cn } from "./cn";
|
|
11
11
|
import { cardStyle, sizeStyle, textStyle, typeStyle } from "./controlStyles";
|
|
12
|
+
import { useGlass } from "./glass";
|
|
12
13
|
import { useAccentColor, useLargerText } from "./theme";
|
|
13
14
|
import { useScheme } from "./useScheme";
|
|
14
15
|
|
|
15
16
|
export type CardProps = {
|
|
16
17
|
children: ReactNode;
|
|
17
18
|
title?: string;
|
|
18
|
-
/** Muted line under the title (the web `CardDescription`). */
|
|
19
19
|
description?: string;
|
|
20
20
|
action?: ReactNode;
|
|
21
21
|
leftIcon?: ComponentType<IconProps>;
|
|
22
|
-
/** Classes on the card surface. */
|
|
23
22
|
className?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Makes the whole card a button that fades while pressed (from 0.5.0). It is
|
|
26
|
-
* then one element for VoiceOver and TalkBack, so put no other control in it.
|
|
27
|
-
*/
|
|
28
23
|
onPress?: () => void;
|
|
29
|
-
/** Names the pressable card. Default `title`; pass one when there is no title. */
|
|
30
24
|
accessibilityLabel?: string;
|
|
31
|
-
/** On the button when there is `onPress`, otherwise on the card surface. */
|
|
32
25
|
testID?: string;
|
|
33
26
|
};
|
|
34
27
|
|
|
@@ -46,15 +39,14 @@ export function Card({
|
|
|
46
39
|
const largerText = useLargerText();
|
|
47
40
|
const accentColor = useAccentColor();
|
|
48
41
|
const scheme = useScheme();
|
|
42
|
+
const glass = useGlass("surface");
|
|
49
43
|
const hasHeader = Boolean(title || action);
|
|
50
44
|
const titleSize = largerText ? "text-2xl" : "text-base";
|
|
51
|
-
// The web card: a flat `surfaceCard` fill at radius 16, with no border, no
|
|
52
|
-
// shadow and no blur. Dialogs, sheets and toasts float, as on the web.
|
|
53
45
|
const card = (
|
|
54
46
|
<PrimitiveCard
|
|
55
47
|
testID={onPress ? undefined : testID}
|
|
56
48
|
className={cn("gap-4 overflow-hidden border-0 py-4", className)}
|
|
57
|
-
style={cardStyle(scheme)}
|
|
49
|
+
style={[cardStyle(scheme), glass]}
|
|
58
50
|
>
|
|
59
51
|
{hasHeader && (
|
|
60
52
|
<PrimitiveCardHeader className="px-4 py-0">
|
|
@@ -100,10 +92,6 @@ export function Card({
|
|
|
100
92
|
);
|
|
101
93
|
}
|
|
102
94
|
|
|
103
|
-
// Parts for composing a card body with the web part names. They sit inside
|
|
104
|
-
// `Card`'s padded content, so they add no side padding of their own. Text
|
|
105
|
-
// colours are styles that follow the colour scheme; recolour with `style`.
|
|
106
|
-
|
|
107
95
|
type PartProps = ViewProps & { className?: string };
|
|
108
96
|
type TextPartProps = TextProps & { className?: string };
|
|
109
97
|
|
package/src/Checkbox.tsx
CHANGED
|
@@ -8,10 +8,8 @@ import { useLargerText } from "./theme";
|
|
|
8
8
|
import { useScheme } from "./useScheme";
|
|
9
9
|
|
|
10
10
|
export type CheckboxProps = Omit<PressableProps, "onPress" | "children"> & {
|
|
11
|
-
/** `"indeterminate"` shows a dash; a press then checks it. */
|
|
12
11
|
checked: boolean | "indeterminate";
|
|
13
12
|
onCheckedChange?: (checked: boolean) => void;
|
|
14
|
-
/** Shown while checked. Default a check icon (a dash when indeterminate). */
|
|
15
13
|
icon?: ReactNode;
|
|
16
14
|
className?: string;
|
|
17
15
|
};
|
package/src/ColorSwatches.tsx
CHANGED
|
@@ -12,28 +12,21 @@ import { useScheme } from "./useScheme";
|
|
|
12
12
|
export type ColorSwatchesSize = "sm" | "md" | "lg";
|
|
13
13
|
|
|
14
14
|
export type ColorSwatchesProps = {
|
|
15
|
-
/** The selected colour: one of `colors`, compared without case. */
|
|
16
15
|
value: string;
|
|
17
16
|
onChange: (color: string) => void;
|
|
18
|
-
/** `#rgb` or `#rrggbb` colours. */
|
|
19
17
|
colors: string[];
|
|
20
|
-
/** Swatch diameter: `sm` 24, `md` 32, `lg` 40. Default `md`. */
|
|
21
18
|
size?: ColorSwatchesSize;
|
|
22
|
-
/** Per-swatch accessibility labels; falls back to the colour string */
|
|
23
19
|
labels?: string[];
|
|
24
|
-
/** Names the group, such as "Accent colour". */
|
|
25
20
|
accessibilityLabel?: string;
|
|
26
21
|
testID?: string;
|
|
27
22
|
disabled?: boolean;
|
|
28
23
|
};
|
|
29
24
|
|
|
30
|
-
/** Swatch diameters, one step up with larger text. */
|
|
31
25
|
const DIAMETER = {
|
|
32
26
|
regular: { sm: 24, md: 32, lg: 40 },
|
|
33
27
|
larger: { sm: 32, md: 40, lg: 48 },
|
|
34
28
|
} as const;
|
|
35
29
|
|
|
36
|
-
/** Selection ring width and the gap between the ring and the swatch. */
|
|
37
30
|
const RING = 2;
|
|
38
31
|
const RING_GAP = 2;
|
|
39
32
|
|
|
@@ -53,7 +46,6 @@ export function swatchCheckColor(color: string): string | null {
|
|
|
53
46
|
};
|
|
54
47
|
const luminance =
|
|
55
48
|
0.2126 * linear((n >> 16) & 255) + 0.7152 * linear((n >> 8) & 255) + 0.0722 * linear(n & 255);
|
|
56
|
-
// Contrast with white is 1.05 / (L + 0.05); with black, (L + 0.05) / 0.05.
|
|
57
49
|
return 1.05 / (luminance + 0.05) >= (luminance + 0.05) / 0.05 ? tokens.color.white : tokens.color.black;
|
|
58
50
|
}
|
|
59
51
|
|
|
@@ -113,7 +105,6 @@ export function ColorSwatches({
|
|
|
113
105
|
);
|
|
114
106
|
}
|
|
115
107
|
|
|
116
|
-
/** One swatch: a radio that scales a little on press. The slop does not scale. */
|
|
117
108
|
function Swatch({
|
|
118
109
|
testID,
|
|
119
110
|
label,
|
package/src/ConfirmDialog.tsx
CHANGED
|
@@ -18,16 +18,12 @@ export type ConfirmDialogProps = {
|
|
|
18
18
|
onOpenChange?: (open: boolean) => void;
|
|
19
19
|
title: ReactNode;
|
|
20
20
|
description?: ReactNode;
|
|
21
|
-
/** Default "Cancel". */
|
|
22
21
|
cancelLabel?: ReactNode;
|
|
23
|
-
/** Default "Confirm". */
|
|
24
22
|
confirmLabel?: ReactNode;
|
|
25
23
|
onCancel?: () => void;
|
|
26
24
|
onConfirm?: () => void;
|
|
27
|
-
/** `"destructive"` paints the confirm button red. Default `"default"`. */
|
|
28
25
|
variant?: "default" | "destructive";
|
|
29
26
|
confirmDisabled?: boolean;
|
|
30
|
-
/** Usually an `AlertDialogTrigger`. */
|
|
31
27
|
children?: ReactNode;
|
|
32
28
|
testID?: string;
|
|
33
29
|
};
|
|
@@ -72,17 +68,14 @@ export function ConfirmDialog({
|
|
|
72
68
|
) : null}
|
|
73
69
|
</AlertDialogHeader>
|
|
74
70
|
<AlertDialogFooter>
|
|
75
|
-
{/* Closes the dialog, and so calls `onCancel`. */}
|
|
76
71
|
<AlertDialogCancel testID={testID ? `${testID}-cancel` : undefined}>{cancelLabel}</AlertDialogCancel>
|
|
77
72
|
<AlertDialogAction
|
|
78
73
|
testID={testID ? `${testID}-confirm` : undefined}
|
|
79
74
|
variant={variant}
|
|
80
75
|
disabled={confirmDisabled}
|
|
81
76
|
onPress={() => {
|
|
82
|
-
// A destructive confirm lands with a medium haptic.
|
|
83
77
|
if (variant === "destructive") impactHaptic("medium");
|
|
84
78
|
onConfirm?.();
|
|
85
|
-
// Past the dialog's own close, so a confirm is not a cancel.
|
|
86
79
|
setOpen(false);
|
|
87
80
|
}}
|
|
88
81
|
>
|
package/src/DateTimeField.tsx
CHANGED
|
@@ -15,17 +15,12 @@ type PickerMode = "date" | "time";
|
|
|
15
15
|
type PickerButton = { mode: PickerMode; label: string };
|
|
16
16
|
|
|
17
17
|
export type DateTimeFieldProps = {
|
|
18
|
-
/** `null` shows `placeholder` until a date is picked (from 0.5.0). */
|
|
19
18
|
value: Date | null;
|
|
20
19
|
onChange: (value: Date) => void;
|
|
21
|
-
/** Date and time buttons (default), the time button only, or the date button only. */
|
|
22
20
|
mode?: "datetime" | "time" | "date";
|
|
23
21
|
maximumDate?: Date;
|
|
24
|
-
/** Shown on each button while `value` is `null`. Default "Select date" or "Select time". */
|
|
25
22
|
placeholder?: string;
|
|
26
|
-
/** Shows a clear button while `value` is set. It calls this; `onChange` is not called. */
|
|
27
23
|
onClear?: () => void;
|
|
28
|
-
/** Names the clear button. Default "Clear time" in `time` mode, "Clear date" otherwise. */
|
|
29
24
|
clearLabel?: string;
|
|
30
25
|
testID?: string;
|
|
31
26
|
};
|
package/src/Dialog.tsx
CHANGED
|
@@ -46,31 +46,15 @@ export function DialogClose(props: OverlayPressableProps) {
|
|
|
46
46
|
|
|
47
47
|
export type DialogContentProps = ViewProps & {
|
|
48
48
|
className?: string;
|
|
49
|
-
/** Hide the close button in the top-right corner. Default `false`. */
|
|
50
49
|
hideCloseButton?: boolean;
|
|
51
|
-
/** Close on a backdrop tap. Default `true`. `AlertDialogContent` sets `false`. */
|
|
52
50
|
dismissible?: boolean;
|
|
53
|
-
/**
|
|
54
|
-
* A bottom sheet in a compact window (639 wide or less, or 500 high or less),
|
|
55
|
-
* as the web `viewportAware`. Default `true`. `false` keeps the centred panel
|
|
56
|
-
* at every size.
|
|
57
|
-
*/
|
|
58
51
|
viewportAware?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Called once the dialog is on screen. Focus its field here (`ref.focus()`)
|
|
61
|
-
* rather than with `autoFocus`: in a `Modal`, Android may not raise the
|
|
62
|
-
* keyboard for a field focused at mount, and the web focus trap moves focus
|
|
63
|
-
* to the first control (the backdrop) after it.
|
|
64
|
-
*/
|
|
65
52
|
onShow?: () => void;
|
|
66
53
|
};
|
|
67
54
|
|
|
68
|
-
/** Web `rounded-t-2xl` (16) on the compact sheet. */
|
|
69
55
|
const SHEET_RADIUS = tokens.radius.lg;
|
|
70
56
|
|
|
71
|
-
/** The centred panel: at most 480 wide. */
|
|
72
57
|
const PANEL = { width: "100%", maxWidth: 480, alignSelf: "center" } as const;
|
|
73
|
-
/** The compact sheet: its bottom corners sit below the screen edge, and it shrinks to the room, as `SheetContent`. */
|
|
74
58
|
const SHEET = { marginBottom: -SHEET_RADIUS, flexShrink: 1 };
|
|
75
59
|
const SHRINK = { flexShrink: 1 };
|
|
76
60
|
|
|
@@ -106,8 +90,6 @@ export function DialogContent({
|
|
|
106
90
|
const insets = useSafeAreaInsets();
|
|
107
91
|
const compact = viewportAware && isCompactOverlay(width, height);
|
|
108
92
|
|
|
109
|
-
// One tree for both layouts, so a window that crosses the compact size while
|
|
110
|
-
// open (split view, a foldable) keeps the content and its state.
|
|
111
93
|
return (
|
|
112
94
|
<DialogLayoutContext.Provider value={compact ? COMPACT : CENTRED}>
|
|
113
95
|
<OverlayModal
|
|
@@ -140,10 +122,6 @@ export function DialogContent({
|
|
|
140
122
|
);
|
|
141
123
|
}
|
|
142
124
|
|
|
143
|
-
/**
|
|
144
|
-
* The web compact handle: an `h-1 w-12` pill in `surface-tertiary`, in a
|
|
145
|
-
* 44-high row. The whole sheet drags (`SheetDragView`), the handle with it.
|
|
146
|
-
*/
|
|
147
125
|
function DialogHandle() {
|
|
148
126
|
const scheme = useScheme();
|
|
149
127
|
return (
|
|
@@ -164,8 +142,6 @@ function DialogCloseButton() {
|
|
|
164
142
|
const largerText = useLargerText();
|
|
165
143
|
const scheme = useScheme();
|
|
166
144
|
const press = usePressScale();
|
|
167
|
-
// `asChild`: the close press goes into this animated `Pressable`, so the
|
|
168
|
-
// button scales while `overlay.tsx` stays as it is.
|
|
169
145
|
return (
|
|
170
146
|
<DialogClose asChild>
|
|
171
147
|
<AnimatedPressable
|
|
@@ -190,9 +166,6 @@ export function DialogHeader({ className, ...props }: PartProps) {
|
|
|
190
166
|
return <View className={cn("gap-1.5 pr-10", className)} {...props} />;
|
|
191
167
|
}
|
|
192
168
|
|
|
193
|
-
// Text colours are styles (`textStyle`), so they follow the colour scheme in
|
|
194
|
-
// apps whose `text-foreground` does not. Recolour with `style`, not `className`.
|
|
195
|
-
|
|
196
169
|
/** Web `text-lg font-medium`. */
|
|
197
170
|
export function DialogTitle({ className, style, ...props }: TextPartProps) {
|
|
198
171
|
const largerText = useLargerText();
|
package/src/DividedList.tsx
CHANGED