@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/DropdownMenu.tsx
CHANGED
|
@@ -82,11 +82,8 @@ function useMenu(part: string): MenuContextValue {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
export type DropdownMenuProps = {
|
|
85
|
-
/** Open state when the parent controls it. */
|
|
86
85
|
open?: boolean;
|
|
87
|
-
/** Initial open state when `open` is not set. Default `false`. */
|
|
88
86
|
defaultOpen?: boolean;
|
|
89
|
-
/** Called with the next open state (trigger, item, outside tap, Android back). */
|
|
90
87
|
onOpenChange?: (open: boolean) => void;
|
|
91
88
|
children?: ReactNode;
|
|
92
89
|
};
|
|
@@ -107,13 +104,7 @@ export function DropdownMenu({ open, defaultOpen = false, onOpenChange, children
|
|
|
107
104
|
}
|
|
108
105
|
|
|
109
106
|
export type DropdownMenuTriggerProps = PressableProps & {
|
|
110
|
-
/**
|
|
111
|
-
* Merge the press into the single child (for example a `Button` or
|
|
112
|
-
* `IconButton`) instead of wrapping it. The child must pass `ref` on to its
|
|
113
|
-
* native view, so the menu can measure it.
|
|
114
|
-
*/
|
|
115
107
|
asChild?: boolean;
|
|
116
|
-
/** Also receives the native view; the menu keeps its own handle. */
|
|
117
108
|
ref?: Ref<ComponentRef<typeof View>>;
|
|
118
109
|
};
|
|
119
110
|
|
|
@@ -124,15 +115,12 @@ export function isMeasuredRect(rect: DropdownMenuRect): boolean {
|
|
|
124
115
|
|
|
125
116
|
type Measurable = Pick<ComponentRef<typeof View>, "measureInWindow" | "measure">;
|
|
126
117
|
|
|
127
|
-
/** The wrapper shrink-wraps the trigger in a flex row (such as the PromptInput `leading` slot). */
|
|
128
118
|
const TRIGGER_HOST = { alignSelf: "flex-start" } as const;
|
|
129
119
|
|
|
130
|
-
/** Frames to wait for layout to settle, when a view reads empty. */
|
|
131
120
|
const MEASURE_RETRIES = 2;
|
|
132
121
|
|
|
133
122
|
type LayoutSize = { width: number; height: number };
|
|
134
123
|
|
|
135
|
-
/** Last-resort trigger size when a press has a touch point but no `onLayout` size and no style size: a 44 point touch target. */
|
|
136
124
|
const FALLBACK_SIZE: LayoutSize = { width: 44, height: 44 };
|
|
137
125
|
|
|
138
126
|
/** Numeric `width` and `height` of a plain style object, such as `{ width: 44, height: 44 }`; `undefined` for a function, array or missing size. */
|
|
@@ -208,7 +196,6 @@ export function DropdownMenuTrigger({
|
|
|
208
196
|
}: DropdownMenuTriggerProps) {
|
|
209
197
|
const { open, setOpen, setTrigger } = useMenu("DropdownMenuTrigger");
|
|
210
198
|
const ref = useRef<ComponentRef<typeof View> | null>(null);
|
|
211
|
-
// This trigger's last `onLayout` size and last good measured box, kept for when a live reading is empty.
|
|
212
199
|
const layoutSizeRef = useRef<LayoutSize | undefined>(undefined);
|
|
213
200
|
const lastRectRef = useRef<DropdownMenuRect | undefined>(undefined);
|
|
214
201
|
const styleSize = sizeFromStyle(style);
|
|
@@ -244,7 +231,6 @@ export function DropdownMenuTrigger({
|
|
|
244
231
|
const view = ref.current;
|
|
245
232
|
const size = layoutSizeRef.current ?? styleSize ?? FALLBACK_SIZE;
|
|
246
233
|
const pressRect = triggerRectFromPress(event, size);
|
|
247
|
-
// Anchor and open at once from the press, then refine from a live measure.
|
|
248
234
|
if (pressRect) setTrigger(pressRect);
|
|
249
235
|
setOpen(true);
|
|
250
236
|
if (!view) return;
|
|
@@ -309,12 +295,8 @@ export function dropdownMenuPosition({
|
|
|
309
295
|
const above = trigger.y - sideOffset;
|
|
310
296
|
const roomBelow = maxBottom - below;
|
|
311
297
|
const roomAbove = above - minTop;
|
|
312
|
-
// Not measured yet (0): flip only when almost no room is below, so a bottom
|
|
313
|
-
// trigger never gets a first layout with a tiny `maxHeight`.
|
|
314
298
|
const tooTight = contentHeight > 0 ? contentHeight > roomBelow : roomBelow < DROPDOWN_MENU.itemHeight;
|
|
315
299
|
if (tooTight && roomAbove > roomBelow) {
|
|
316
|
-
// `top` only: `bottom` is ignored inside `WindowLayerHost` on Android. The menu's
|
|
317
|
-
// bottom edge lands on `above`; before measure, a two-row estimate stands in.
|
|
318
300
|
const height = contentHeight > 0 ? contentHeight : Math.min(roomAbove, DROPDOWN_MENU.itemHeight * 2 + DROPDOWN_MENU.padding * 2);
|
|
319
301
|
return { ...horizontal, top: Math.max(minTop, above - height), maxHeight: roomAbove };
|
|
320
302
|
}
|
|
@@ -322,9 +304,7 @@ export function dropdownMenuPosition({
|
|
|
322
304
|
}
|
|
323
305
|
|
|
324
306
|
export type DropdownMenuContentProps = ViewProps & {
|
|
325
|
-
/** Which trigger edge the menu lines up with. Default `"start"`. */
|
|
326
307
|
align?: DropdownMenuAlign;
|
|
327
|
-
/** Gap from the trigger. Default 4, as on the web. */
|
|
328
308
|
sideOffset?: number;
|
|
329
309
|
className?: string;
|
|
330
310
|
};
|
|
@@ -352,10 +332,7 @@ export function DropdownMenuContent({
|
|
|
352
332
|
const window = useWindowDimensions();
|
|
353
333
|
const insets = useSafeAreaInsets();
|
|
354
334
|
const reduceMotion = useReduceMotion();
|
|
355
|
-
// `null` until the content is measured: only then is it known whether the
|
|
356
|
-
// menu fits below the trigger or flips above, so it stays hidden till then.
|
|
357
335
|
const [contentHeight, setContentHeight] = useState<number | null>(null);
|
|
358
|
-
// Up while open, and after a close until the panel has faded out.
|
|
359
336
|
const [shown, setShown] = useState(open);
|
|
360
337
|
if (open && !shown) setShown(true);
|
|
361
338
|
if (!open && shown && reduceMotion) setShown(false);
|
|
@@ -363,12 +340,10 @@ export function DropdownMenuContent({
|
|
|
363
340
|
useEffect(() => {
|
|
364
341
|
openRef.current = open;
|
|
365
342
|
}, [open]);
|
|
366
|
-
// The panel's motion, on the UI thread. At rest (1, 1) under Reduce Motion.
|
|
367
343
|
const opacity = useSharedValue(reduceMotion ? 1 : 0);
|
|
368
344
|
const scale = useSharedValue(reduceMotion ? 1 : PANEL_SCALE_FROM);
|
|
369
345
|
const measured = contentHeight !== null;
|
|
370
346
|
const hide = () => {
|
|
371
|
-
// Opened again in the moment the fade ended: stay up.
|
|
372
347
|
if (openRef.current) return;
|
|
373
348
|
setShown(false);
|
|
374
349
|
setContentHeight(null);
|
|
@@ -385,7 +360,6 @@ export function DropdownMenuContent({
|
|
|
385
360
|
opacity.set(withTiming(1, POPOVER_ENTER));
|
|
386
361
|
scale.set(withTiming(1, POPOVER_ENTER));
|
|
387
362
|
} else if (shown) {
|
|
388
|
-
// A fade only: the scale stays where it is.
|
|
389
363
|
opacity.set(
|
|
390
364
|
withTiming(0, POPOVER_EXIT, (finished) => {
|
|
391
365
|
"worklet";
|
|
@@ -393,7 +367,6 @@ export function DropdownMenuContent({
|
|
|
393
367
|
}),
|
|
394
368
|
);
|
|
395
369
|
}
|
|
396
|
-
// Only opening, measuring and closing start the motion.
|
|
397
370
|
}, [open, measured, reduceMotion]);
|
|
398
371
|
const panelStyle = useAnimatedStyle(() => ({
|
|
399
372
|
opacity: opacity.get(),
|
|
@@ -401,18 +374,11 @@ export function DropdownMenuContent({
|
|
|
401
374
|
}));
|
|
402
375
|
const close = () => setOpen(false);
|
|
403
376
|
const position = dropdownMenuPosition({ trigger, window, insets, align, sideOffset, contentHeight: contentHeight ?? 0 });
|
|
404
|
-
// The scale grows from the corner nearest the trigger: its edge on the
|
|
405
|
-
// trigger's (`align`), and the top, or the bottom when the menu flipped above.
|
|
406
377
|
const transformOrigin = `${align === "end" ? 100 : 0}% ${position.bottom === undefined ? 0 : 100}%`;
|
|
407
378
|
if (!shown) return null;
|
|
408
379
|
return (
|
|
409
|
-
// The panel runs its own motion, so no fade; the items need the menu's
|
|
410
|
-
// context, which a layer loses, so it is provided again.
|
|
411
380
|
<WindowLayer onRequestClose={close} fade={false}>
|
|
412
381
|
<MenuContext.Provider value={menu}>
|
|
413
|
-
{/* A full-size host, as `OverlayModal` has: without it the backdrop and the
|
|
414
|
-
menu are bare layer children with no box to size or hit-test against,
|
|
415
|
-
and the menu can stack under tab bars and glass layers. */}
|
|
416
382
|
<View style={{ flex: 1 }} pointerEvents="box-none">
|
|
417
383
|
<Pressable
|
|
418
384
|
testID="DropdownMenu-backdrop"
|
|
@@ -425,12 +391,9 @@ export function DropdownMenuContent({
|
|
|
425
391
|
accessibilityRole="menu"
|
|
426
392
|
accessibilityViewIsModal
|
|
427
393
|
onAccessibilityEscape={close}
|
|
428
|
-
// Leaving: a late tap on a row must not select twice.
|
|
429
394
|
pointerEvents={open ? "auto" : "none"}
|
|
430
395
|
style={{
|
|
431
396
|
position: "absolute",
|
|
432
|
-
// Every edge is set, `null` when unused, so React Native clears the one
|
|
433
|
-
// a flip leaves behind instead of keeping a stale `top`.
|
|
434
397
|
top: position.top ?? null,
|
|
435
398
|
bottom: position.bottom ?? null,
|
|
436
399
|
left: position.left ?? null,
|
|
@@ -462,7 +425,6 @@ export function DropdownMenuContent({
|
|
|
462
425
|
);
|
|
463
426
|
}
|
|
464
427
|
|
|
465
|
-
/** Item type and icon size: the web `text-sm` with a 16 icon in 48 rows, or `text-lg` with a 22 icon and 56 rows with larger text. */
|
|
466
428
|
function itemMetrics(largerText: boolean) {
|
|
467
429
|
return largerText
|
|
468
430
|
? { text: sizeStyle("text-lg"), icon: 22, minHeight: 56 }
|
|
@@ -473,9 +435,7 @@ type MenuIcon = ComponentType<IconProps>;
|
|
|
473
435
|
|
|
474
436
|
type MenuItemBaseProps = Omit<PressableProps, "onPress" | "children" | "style"> & {
|
|
475
437
|
children: ReactNode;
|
|
476
|
-
/** Called on press. The menu then closes, unless `closeOnSelect` is `false`. */
|
|
477
438
|
onSelect?: () => void;
|
|
478
|
-
/** Default `true`. */
|
|
479
439
|
closeOnSelect?: boolean;
|
|
480
440
|
disabled?: boolean;
|
|
481
441
|
className?: string;
|
|
@@ -513,16 +473,10 @@ function MenuRow({
|
|
|
513
473
|
disabled={disabled}
|
|
514
474
|
accessibilityState={{ ...accessibilityState, disabled: Boolean(disabled), ...(checked === undefined ? null : { checked }) }}
|
|
515
475
|
onPress={() => {
|
|
516
|
-
// A new pick from a set ticks; a plain action and the current choice do not.
|
|
517
476
|
if (checked === false) selectionHaptic();
|
|
518
477
|
onSelect?.();
|
|
519
478
|
if (closeOnSelect) setOpen(false);
|
|
520
479
|
}}
|
|
521
|
-
// The row layout is a plain style object. NativeWind's `Pressable`
|
|
522
|
-
// interop rebuilds `style` from the inline value on native and drops a
|
|
523
|
-
// function `style` entirely, so a layout kept in one stacked the icon
|
|
524
|
-
// above the label on Android (React Native's default column). The press
|
|
525
|
-
// highlight comes from the `pressed` render state as a background layer.
|
|
526
480
|
style={{
|
|
527
481
|
flexDirection: "row",
|
|
528
482
|
alignItems: "center",
|
|
@@ -544,7 +498,6 @@ function MenuRow({
|
|
|
544
498
|
/>
|
|
545
499
|
) : null}
|
|
546
500
|
{leading}
|
|
547
|
-
{/* A caller `className` lands here, off the Pressable (see the style note above). */}
|
|
548
501
|
<View className={cn("min-w-0 flex-1 flex-row items-center", className)}>
|
|
549
502
|
{typeof children === "string" ? (
|
|
550
503
|
<Text className="flex-1 font-instrument-sans" style={[metrics.text, { color }]}>
|
|
@@ -561,11 +514,8 @@ function MenuRow({
|
|
|
561
514
|
}
|
|
562
515
|
|
|
563
516
|
export type DropdownMenuItemProps = MenuItemBaseProps & {
|
|
564
|
-
/** Leading icon (a Tabler icon), drawn at 16 in the item colour. */
|
|
565
517
|
icon?: MenuIcon;
|
|
566
|
-
/** The web `text-destructive` item: label and icon in the danger colour. */
|
|
567
518
|
destructive?: boolean;
|
|
568
|
-
/** The web `text-warning` item (such as Archive): label and icon in the warning colour. */
|
|
569
519
|
warning?: boolean;
|
|
570
520
|
};
|
|
571
521
|
|
|
@@ -591,7 +541,6 @@ export function DropdownMenuItem({ icon: Icon, destructive, warning, ...props }:
|
|
|
591
541
|
}
|
|
592
542
|
|
|
593
543
|
export type DropdownMenuRadioItemProps = MenuItemBaseProps & {
|
|
594
|
-
/** Shows the check and reports `checked`. */
|
|
595
544
|
checked: boolean;
|
|
596
545
|
};
|
|
597
546
|
|
package/src/EmptyState.tsx
CHANGED
|
@@ -56,9 +56,6 @@ function EmptyStateView({
|
|
|
56
56
|
);
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
// Composable parts with the web names (`EmptyState.Root`, `.Icon`, `.Title`,
|
|
60
|
-
// `.Description`, `.Actions`). `Root` sets the variant, the parts read it.
|
|
61
|
-
|
|
62
59
|
/** `default`: open centred block with a large bare icon. `panel`: filled rounded block, icon in a tile. */
|
|
63
60
|
export type EmptyStateVariant = "default" | "panel";
|
|
64
61
|
|
|
@@ -92,9 +89,7 @@ function Icon({
|
|
|
92
89
|
className,
|
|
93
90
|
}: {
|
|
94
91
|
icon: ComponentType<IconProps>;
|
|
95
|
-
/** Default 40 (`default`) or 22 (`panel`). */
|
|
96
92
|
size?: number;
|
|
97
|
-
/** Line width, as on the web. Default the icon's own (`default`) or 1.5 (`panel`). Passed to Tabler as `strokeWidth`, since native Tabler reads `stroke` as the colour. */
|
|
98
93
|
stroke?: number;
|
|
99
94
|
className?: string;
|
|
100
95
|
}) {
|
package/src/ExpoWebRoot.tsx
CHANGED
|
@@ -4,10 +4,6 @@ import { tokens } from "./tokens";
|
|
|
4
4
|
|
|
5
5
|
const { ScrollViewStyleReset } = expoRouterHtml;
|
|
6
6
|
|
|
7
|
-
// From Expo SDK 58 the static render no longer writes the page's CSS links and
|
|
8
|
-
// script tags into the HTML afterwards: it hands them to the root as nodes, and
|
|
9
|
-
// a root that leaves them out gives a blank page. Earlier SDKs have no such
|
|
10
|
-
// hook and still write the tags themselves.
|
|
11
7
|
type ServerDocument = ReturnType<NonNullable<typeof expoRouterHtml.useServerDocumentContext>>;
|
|
12
8
|
const emptyDocument: ServerDocument = {};
|
|
13
9
|
const useServerDocument = expoRouterHtml.useServerDocumentContext ?? (() => emptyDocument);
|
|
@@ -22,17 +18,11 @@ export const EXPO_WEB_VIEWPORT: Record<ExpoWebRootViewport, string> = {
|
|
|
22
18
|
|
|
23
19
|
export type ExpoWebRootProps = {
|
|
24
20
|
children: ReactNode;
|
|
25
|
-
/** `<html lang>`. Default `"en"`. */
|
|
26
21
|
lang?: string;
|
|
27
|
-
/** Default `"native"`. */
|
|
28
22
|
viewport?: ExpoWebRootViewport;
|
|
29
|
-
/** `ScrollViewStyleReset`: no body scroll, so `ScrollView` works as on native. Default `true`. */
|
|
30
23
|
scrollReset?: boolean;
|
|
31
|
-
/** Body fill in light. Default `tokens.color.background.light`. */
|
|
32
24
|
lightBackground?: string;
|
|
33
|
-
/** Body fill in dark. Default `tokens.color.background.dark`. */
|
|
34
25
|
darkBackground?: string;
|
|
35
|
-
/** More `<head>` nodes, after the defaults. */
|
|
36
26
|
head?: ReactNode;
|
|
37
27
|
};
|
|
38
28
|
|
package/src/Field.tsx
CHANGED
|
@@ -24,15 +24,9 @@ function useField(part: string): FieldContextValue {
|
|
|
24
24
|
|
|
25
25
|
type FieldProps = ViewProps & {
|
|
26
26
|
className?: string;
|
|
27
|
-
/** The `nativeID` of the label. Default: a generated id. */
|
|
28
27
|
labelId?: string;
|
|
29
28
|
};
|
|
30
29
|
|
|
31
|
-
/**
|
|
32
|
-
* A labelled control: a `gap-2` column. It generates the `nativeID` that
|
|
33
|
-
* `FieldLabel` sets and `FieldControl` points at with `accessibilityLabelledBy`.
|
|
34
|
-
* A plain `Input` does not need it.
|
|
35
|
-
*/
|
|
36
30
|
function Field({ className, labelId, ...props }: FieldProps) {
|
|
37
31
|
const generated = React.useId();
|
|
38
32
|
const [hasLabel, setHasLabel] = React.useState(false);
|
|
@@ -45,7 +39,6 @@ function Field({ className, labelId, ...props }: FieldProps) {
|
|
|
45
39
|
);
|
|
46
40
|
}
|
|
47
41
|
|
|
48
|
-
/** `Label` with the `nativeID` of the nearest `Field`. */
|
|
49
42
|
function FieldLabel(props: LabelProps) {
|
|
50
43
|
const field = useField("FieldLabel");
|
|
51
44
|
const { setHasLabel } = field;
|
|
@@ -56,11 +49,6 @@ function FieldLabel(props: LabelProps) {
|
|
|
56
49
|
return <Label nativeID={field.labelId} {...props} />;
|
|
57
50
|
}
|
|
58
51
|
|
|
59
|
-
/**
|
|
60
|
-
* `Input` that names itself from the `FieldLabel` of the nearest `Field`
|
|
61
|
-
* (`accessibilityLabelledBy`, Android). With no `FieldLabel` rendered it
|
|
62
|
-
* keeps the `accessibilityLabel` you pass, which is the fallback on iOS too.
|
|
63
|
-
*/
|
|
64
52
|
function FieldControl(props: InputProps) {
|
|
65
53
|
const field = useField("FieldControl");
|
|
66
54
|
return (
|
|
@@ -71,7 +59,6 @@ function FieldControl(props: InputProps) {
|
|
|
71
59
|
);
|
|
72
60
|
}
|
|
73
61
|
|
|
74
|
-
/** Muted hint under the control. */
|
|
75
62
|
function FieldDescription({ className, style, ...props }: TextProps & { className?: string }) {
|
|
76
63
|
useField("FieldDescription");
|
|
77
64
|
const scheme = useScheme();
|
|
@@ -85,7 +72,6 @@ function FieldDescription({ className, style, ...props }: TextProps & { classNam
|
|
|
85
72
|
);
|
|
86
73
|
}
|
|
87
74
|
|
|
88
|
-
/** Error message under the control, read out when it appears. */
|
|
89
75
|
function FieldError({ className, style, ...props }: TextProps & { className?: string }) {
|
|
90
76
|
useField("FieldError");
|
|
91
77
|
const scheme = useScheme();
|
package/src/FloatingFAB.tsx
CHANGED
|
@@ -48,9 +48,6 @@ export function FloatingFAB({
|
|
|
48
48
|
onPress={onPress}
|
|
49
49
|
onPressIn={press.onPressIn}
|
|
50
50
|
onPressOut={press.onPressOut}
|
|
51
|
-
// Layout in `style` and no `className`: NativeWind drops a function
|
|
52
|
-
// `style` next to a `className`, and the press scale and dim come
|
|
53
|
-
// from the animated style, not a function style.
|
|
54
51
|
style={[
|
|
55
52
|
{
|
|
56
53
|
alignItems: "center",
|
package/src/FloatingSurface.tsx
CHANGED
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
floatingSolidFill,
|
|
10
10
|
FLOATING_RADIUS,
|
|
11
11
|
} from "./floating";
|
|
12
|
+
import { useGlass } from "./glass";
|
|
12
13
|
import { useGlassBlurTarget } from "./glassBlur";
|
|
14
|
+
import { useSurface } from "./theme";
|
|
13
15
|
import { useReduceTransparency } from "./useReduceTransparency";
|
|
14
16
|
import { useScheme } from "./useScheme";
|
|
15
17
|
|
|
@@ -31,12 +33,14 @@ export function FloatingSurface({
|
|
|
31
33
|
}: FloatingSurfaceProps) {
|
|
32
34
|
const colorScheme = useScheme();
|
|
33
35
|
const reduceTransparency = useReduceTransparency();
|
|
36
|
+
const flat = useSurface() === "flat";
|
|
37
|
+
const glass = useGlass("surface");
|
|
34
38
|
const blurTarget = useGlassBlurTarget();
|
|
35
39
|
const BlurView = loadBlur()?.BlurView;
|
|
36
40
|
const mode = glassMode({
|
|
37
41
|
os: Platform.OS,
|
|
38
42
|
blur,
|
|
39
|
-
reduceTransparency,
|
|
43
|
+
reduceTransparency: reduceTransparency || flat,
|
|
40
44
|
hasBlurView: BlurView != null,
|
|
41
45
|
});
|
|
42
46
|
const isDark = colorScheme === "dark";
|
|
@@ -70,9 +74,6 @@ export function FloatingSurface({
|
|
|
70
74
|
]}
|
|
71
75
|
>
|
|
72
76
|
{mode === "blur" && BlurView ? (
|
|
73
|
-
// Android: dimezis blur of the `GlassBlurTarget` content (without
|
|
74
|
-
// one, expo-blur draws only the tint). `experimentalBlurMethod` is
|
|
75
|
-
// the pre-SDK 55 name and logs a deprecation warning, so iOS skips it.
|
|
76
77
|
<BlurView
|
|
77
78
|
pointerEvents="none"
|
|
78
79
|
tint={isDark ? "systemMaterialDark" : "systemMaterialLight"}
|
|
@@ -87,8 +88,6 @@ export function FloatingSurface({
|
|
|
87
88
|
/>
|
|
88
89
|
) : null}
|
|
89
90
|
{mode === "blur" && Platform.OS === "android" ? (
|
|
90
|
-
// The iOS backdrop includes the outer fill; dimezis samples only the
|
|
91
|
-
// target, so Android lays the same fill over the blur.
|
|
92
91
|
<View
|
|
93
92
|
pointerEvents="none"
|
|
94
93
|
style={[StyleSheet.absoluteFill, { backgroundColor: translucentFill }]}
|
|
@@ -102,6 +101,12 @@ export function FloatingSurface({
|
|
|
102
101
|
/>
|
|
103
102
|
) : null}
|
|
104
103
|
{children}
|
|
104
|
+
{glass ? (
|
|
105
|
+
<View
|
|
106
|
+
pointerEvents="none"
|
|
107
|
+
style={[StyleSheet.absoluteFill, { borderRadius: radius }, glass]}
|
|
108
|
+
/>
|
|
109
|
+
) : null}
|
|
105
110
|
</View>
|
|
106
111
|
</View>
|
|
107
112
|
);
|
|
@@ -127,8 +132,6 @@ export function GlassSheetBackground({
|
|
|
127
132
|
const styles = StyleSheet.create({
|
|
128
133
|
clip: {
|
|
129
134
|
overflow: "hidden",
|
|
130
|
-
// A surface held shorter than its content (a sheet in a short window)
|
|
131
|
-
// shrinks the clip with it, so a scroll view inside can scroll.
|
|
132
135
|
flexShrink: 1,
|
|
133
136
|
},
|
|
134
137
|
fill: {
|
package/src/FloatingTabBar.tsx
CHANGED
|
@@ -17,13 +17,8 @@ import { useScheme } from "./useScheme";
|
|
|
17
17
|
import { FLOATING_PILL_RADIUS, tabBarHeight, tabBarSlotStyle } from "./floating";
|
|
18
18
|
import { usePressed } from "./usePressed";
|
|
19
19
|
|
|
20
|
-
/**
|
|
21
|
-
* Space between the bar edge and the tabs, on every side of the active pill,
|
|
22
|
-
* in points. The same all round, so the pill follows the bar's curve.
|
|
23
|
-
*/
|
|
24
20
|
const TAB_BAR_PADDING = 4;
|
|
25
21
|
|
|
26
|
-
/** The web `--tabs-dur` (200ms) and `--tabs-ease` (`tokens.css`). */
|
|
27
22
|
const PILL_SLIDE = { duration: 200, easing: Easing.bezier(0.22, 1, 0.36, 1) };
|
|
28
23
|
|
|
29
24
|
/**
|
|
@@ -72,7 +67,6 @@ export function FloatingTabBar({
|
|
|
72
67
|
if (focusedRoute && isTabBarHidden(descriptors[focusedRoute.key]?.options)) {
|
|
73
68
|
return null;
|
|
74
69
|
}
|
|
75
|
-
// The pill counts only the tabs drawn. No pill while a hidden route is focused.
|
|
76
70
|
const visible = state.routes.filter((route) =>
|
|
77
71
|
isTabBarRouteVisible(descriptors[route.key]?.options),
|
|
78
72
|
);
|
|
@@ -81,7 +75,6 @@ export function FloatingTabBar({
|
|
|
81
75
|
return (
|
|
82
76
|
<View
|
|
83
77
|
pointerEvents="box-none"
|
|
84
|
-
// Inside the home indicator and, in landscape, the notch.
|
|
85
78
|
style={tabBarSlotStyle(insets)}
|
|
86
79
|
>
|
|
87
80
|
<FloatingSurface radius={FLOATING_PILL_RADIUS}>
|
|
@@ -98,7 +91,6 @@ export function FloatingTabBar({
|
|
|
98
91
|
if (!isTabBarRouteVisible(options)) {
|
|
99
92
|
return null;
|
|
100
93
|
}
|
|
101
|
-
// `index` counts hidden routes too, as `state.index` does.
|
|
102
94
|
const focused = state.index === index;
|
|
103
95
|
const label =
|
|
104
96
|
typeof options.tabBarLabel === "string"
|
|
@@ -146,12 +138,6 @@ type TabBarItemProps = {
|
|
|
146
138
|
accessibilityLabel: string;
|
|
147
139
|
};
|
|
148
140
|
|
|
149
|
-
/**
|
|
150
|
-
* One tab. React Compiler (the package build) memoises it, so a switch
|
|
151
|
-
* renders only the two tabs whose focus changed. Its props are stable between
|
|
152
|
-
* switches: `route`, `emitter` and `navigateToTab` keep their identity, and
|
|
153
|
-
* `tabBarIcon` is the caller's function.
|
|
154
|
-
*/
|
|
155
141
|
function TabBarItem({
|
|
156
142
|
route,
|
|
157
143
|
emitter,
|
|
@@ -192,8 +178,6 @@ function TabBarItem({
|
|
|
192
178
|
{renderIcon ? renderIcon({ focused, color, size: largerText ? 28 : 24 }) : null}
|
|
193
179
|
<Text
|
|
194
180
|
numberOfLines={1}
|
|
195
|
-
// The bar has a fixed height (`tabBarReserve`), so labels
|
|
196
|
-
// scale with Dynamic Type only up to what fits in it.
|
|
197
181
|
maxFontSizeMultiplier={1.5}
|
|
198
182
|
className={`font-instrument-sans-medium ${largerText ? "text-base" : "text-sm"}`}
|
|
199
183
|
style={[{ color }, typeStyle("medium")]}
|
|
@@ -204,15 +188,6 @@ function TabBarItem({
|
|
|
204
188
|
);
|
|
205
189
|
}
|
|
206
190
|
|
|
207
|
-
/**
|
|
208
|
-
* The pill behind tab `index` of `count` drawn tabs: one tab wide (they share
|
|
209
|
-
* the row equally), `TAB_BAR_PADDING` inside the bar, in
|
|
210
|
-
* `floatingTabPillColors` (the muted `--default` in light, `--segment` in
|
|
211
|
-
* dark, so it shows on the glass bar) and the `TabsTrigger` pills outline.
|
|
212
|
-
* It slides to a newly focused tab, as the web segmented pill does,
|
|
213
|
-
* and moves at once with Reduce Motion. Behind the tablist, so assistive tech
|
|
214
|
-
* reads only the tabs.
|
|
215
|
-
*/
|
|
216
191
|
function ActiveTabPill({ index, count }: { index: number; count: number }) {
|
|
217
192
|
const scheme = useScheme();
|
|
218
193
|
const reduceMotion = useReduceMotion();
|
package/src/IconButton.tsx
CHANGED
|
@@ -13,20 +13,15 @@ export type IconButtonSize = "sm" | "md" | "lg";
|
|
|
13
13
|
|
|
14
14
|
export type IconButtonProps = {
|
|
15
15
|
icon: ComponentType<IconProps>;
|
|
16
|
-
/** Names the button for VoiceOver and TalkBack; it has no text. */
|
|
17
16
|
label: string;
|
|
18
17
|
onPress?: () => void;
|
|
19
18
|
disabled?: boolean;
|
|
20
|
-
/** `overlay` is for camera chrome over a live preview. Default `default`. */
|
|
21
19
|
variant?: IconButtonVariant;
|
|
22
|
-
/** `sm` 32, `md` 40, `lg` 48 across. Default `md`. */
|
|
23
20
|
size?: IconButtonSize;
|
|
24
21
|
testID?: string;
|
|
25
|
-
/** Default: the foreground in `default`, white in `overlay`. */
|
|
26
22
|
iconColor?: string;
|
|
27
23
|
};
|
|
28
24
|
|
|
29
|
-
/** Diameter and icon size per size, a step up with larger text. */
|
|
30
25
|
const METRICS = {
|
|
31
26
|
regular: { sm: [32, 16], md: [40, 20], lg: [48, 24] },
|
|
32
27
|
larger: { sm: [44, 20], md: [48, 24], lg: [56, 28] },
|
package/src/Input.tsx
CHANGED
|
@@ -21,7 +21,6 @@ const Input = React.forwardRef<
|
|
|
21
21
|
ref={ref}
|
|
22
22
|
placeholderTextColor={placeholderTextColor ?? palette.fieldPlaceholder[scheme]}
|
|
23
23
|
className={cn(
|
|
24
|
-
// The web field px-3.5 py-2 with 16 px type (its phone size), 44 high (the web h-10 is a desktop 40).
|
|
25
24
|
"min-h-11 border px-3.5 py-2 text-base font-instrument-sans",
|
|
26
25
|
largerText && "min-h-16 px-4 py-4 text-xl font-instrument-sans-medium",
|
|
27
26
|
className,
|
package/src/Label.tsx
CHANGED
package/src/LabeledSwitchRow.tsx
CHANGED
|
@@ -13,7 +13,6 @@ export type LabeledSwitchRowProps = {
|
|
|
13
13
|
onCheckedChange?: (checked: boolean) => void;
|
|
14
14
|
disabled?: boolean;
|
|
15
15
|
icon?: ReactNode;
|
|
16
|
-
/** Replaces the switch. */
|
|
17
16
|
trailing?: ReactNode;
|
|
18
17
|
className?: string;
|
|
19
18
|
testID?: string;
|
|
@@ -78,7 +77,6 @@ export function LabeledSwitchRow({
|
|
|
78
77
|
</View>
|
|
79
78
|
</Pressable>
|
|
80
79
|
{trailing ?? (
|
|
81
|
-
// The row above is the accessible switch, so this one is hidden from assistive tech.
|
|
82
80
|
<View
|
|
83
81
|
accessibilityElementsHidden
|
|
84
82
|
importantForAccessibility="no-hide-descendants"
|
package/src/ListRow.tsx
CHANGED
|
@@ -15,23 +15,14 @@ export type ListRowProps = {
|
|
|
15
15
|
detail?: ReactNode;
|
|
16
16
|
icon?: ComponentType<IconProps>;
|
|
17
17
|
iconColor?: string;
|
|
18
|
-
/** Any node at the start, such as an `Avatar` with an unread dot. Shown in place of `icon`. */
|
|
19
18
|
leading?: ReactNode;
|
|
20
|
-
/** At the end of the title line, such as a `Badge` or a time. The title is cut off first. */
|
|
21
19
|
titleEnd?: ReactNode;
|
|
22
|
-
/** At the end of the row, inside the pressable area. */
|
|
23
20
|
right?: ReactNode;
|
|
24
|
-
/**
|
|
25
|
-
* At the end of the row, outside the pressable area, such as a `Switch`:
|
|
26
|
-
* pressing it does not call `onPress`.
|
|
27
|
-
*/
|
|
28
21
|
control?: ReactNode;
|
|
29
22
|
onPress?: () => void;
|
|
30
23
|
onLongPress?: () => void;
|
|
31
|
-
/** Names the pressable row. Default `title`. */
|
|
32
24
|
accessibilityLabel?: string;
|
|
33
25
|
onCanvas?: boolean;
|
|
34
|
-
/** On the pressable area when there is a `control`, so a test can press it. */
|
|
35
26
|
testID?: string;
|
|
36
27
|
};
|
|
37
28
|
|
|
@@ -107,15 +98,12 @@ export function ListRow({
|
|
|
107
98
|
const pressable = Boolean(onPress || onLongPress);
|
|
108
99
|
const height = largerText ? "min-h-[72px]" : "min-h-16";
|
|
109
100
|
const paddingY = largerText ? "py-4" : "py-3";
|
|
110
|
-
// The fill is a style: an app theme that nests `dark` under `surface` keeps
|
|
111
|
-
// `bg-surface` and `bg-surface-secondary` light in dark mode.
|
|
112
101
|
const rowStyle = {
|
|
113
102
|
backgroundColor: tokens.color[onCanvas ? "surface" : "surfaceSecondary"][scheme],
|
|
114
103
|
borderRadius: FLOATING_ROW_RADIUS,
|
|
115
104
|
};
|
|
116
105
|
|
|
117
106
|
if (control != null) {
|
|
118
|
-
// The control is a sibling of the pressable area, so its presses stay its own.
|
|
119
107
|
const bodyClassName = cn("min-w-0 flex-1 flex-row items-center gap-3 self-stretch pl-4 pr-3", paddingY);
|
|
120
108
|
return (
|
|
121
109
|
<View className={cn("flex-row items-center", height)} style={rowStyle}>
|
package/src/LoadingState.tsx
CHANGED
|
@@ -19,18 +19,10 @@ import { useScheme } from "./useScheme";
|
|
|
19
19
|
export type { LoadingStateSize } from "./loadingGrid";
|
|
20
20
|
|
|
21
21
|
export type LoadingStateProps = {
|
|
22
|
-
/** What is running, for assistive tech. Default `"Working"`, as the web. */
|
|
23
22
|
label?: string;
|
|
24
|
-
/** `sm` is the web session-row grid (3 pt cells, 11 pt). Default `"default"` (4 pt cells, 15 pt). */
|
|
25
23
|
size?: LoadingStateSize;
|
|
26
|
-
/** Cell colour. Default the muted text colour. Native has no `currentColor`. */
|
|
27
24
|
color?: string;
|
|
28
|
-
/**
|
|
29
|
-
* One colour per column, left to right, as the web `LoadingState` `colors`
|
|
30
|
-
* (Eva's brand purple-to-blue sweep). Wins over `color`.
|
|
31
|
-
*/
|
|
32
25
|
colors?: readonly [string, string, string];
|
|
33
|
-
/** Hold a still frame, for example while the screen is not focused. Default `false`. */
|
|
34
26
|
paused?: boolean;
|
|
35
27
|
};
|
|
36
28
|
|
|
@@ -66,10 +58,8 @@ export function LoadingState({ label = "Working", size = "default", color, color
|
|
|
66
58
|
);
|
|
67
59
|
}
|
|
68
60
|
|
|
69
|
-
/** Column colours, left to right. */
|
|
70
61
|
type Fills = readonly [string, string, string];
|
|
71
62
|
|
|
72
|
-
/** Owns the clock, so unmounting it (Reduce Motion, `paused`) stops the frame callback. */
|
|
73
63
|
function RunningDriveGrid({ size, fill }: { size: LoadingStateSize; fill: Fills }) {
|
|
74
64
|
const elapsed = useSharedValue(0);
|
|
75
65
|
useFrameCallback((frame) => {
|
|
@@ -79,7 +69,6 @@ function RunningDriveGrid({ size, fill }: { size: LoadingStateSize; fill: Fills
|
|
|
79
69
|
return <DriveGrid size={size} fill={fill} elapsed={elapsed} />;
|
|
80
70
|
}
|
|
81
71
|
|
|
82
|
-
/** The nine cells. No `elapsed`: the still frame. */
|
|
83
72
|
function DriveGrid({
|
|
84
73
|
size,
|
|
85
74
|
fill,
|
|
@@ -90,7 +79,6 @@ function DriveGrid({
|
|
|
90
79
|
elapsed: SharedValue<number> | undefined;
|
|
91
80
|
}) {
|
|
92
81
|
const { gap } = DRIVE_SIZES[size];
|
|
93
|
-
// Three explicit rows, not a wrapping row: a fractional gap could wrap early.
|
|
94
82
|
return (
|
|
95
83
|
<View style={{ gap }}>
|
|
96
84
|
{[0, 1, 2].map((row) => (
|
package/src/MenuSheet.tsx
CHANGED
|
@@ -10,7 +10,6 @@ export type MenuSheetProps = {
|
|
|
10
10
|
open: boolean;
|
|
11
11
|
onOpenChange: (open: boolean) => void;
|
|
12
12
|
title: string;
|
|
13
|
-
/** Set on a submenu page: the header gets a 44 back button to the root page. */
|
|
14
13
|
onBack?: () => void;
|
|
15
14
|
children: ReactNode;
|
|
16
15
|
testID?: string;
|
|
@@ -50,7 +49,6 @@ export function MenuSheet({ open, onOpenChange, title, onBack, children, testID
|
|
|
50
49
|
|
|
51
50
|
export type SubmenuRowProps = {
|
|
52
51
|
icon?: ComponentType<IconProps>;
|
|
53
|
-
/** At the start in place of `icon`, such as a coloured status mark. */
|
|
54
52
|
leading?: ReactNode;
|
|
55
53
|
title: string;
|
|
56
54
|
detail?: string;
|
package/src/PageIndicator.tsx
CHANGED
|
@@ -7,9 +7,7 @@ import { useScheme } from "./useScheme";
|
|
|
7
7
|
|
|
8
8
|
export type PageIndicatorProps = {
|
|
9
9
|
count: number;
|
|
10
|
-
/** The current page, from 0. */
|
|
11
10
|
index: number;
|
|
12
|
-
/** Makes each dot a button that calls this with its page. */
|
|
13
11
|
onChange?: (index: number) => void;
|
|
14
12
|
testID?: string;
|
|
15
13
|
};
|
package/src/PageTitle.tsx
CHANGED
|
@@ -33,26 +33,11 @@ export function PageTitle({ className, style, ...props }: PageTitleProps) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
export type PageHeaderProps = Omit<ViewProps, "children"> & {
|
|
36
|
-
/** The page title, drawn with `PageTitle`. */
|
|
37
36
|
title: string;
|
|
38
|
-
/**
|
|
39
|
-
* Content before the title, such as a close `HeaderIconButton` while the
|
|
40
|
-
* page is in select mode (Android's contextual action bar). It keeps its width.
|
|
41
|
-
*/
|
|
42
37
|
leading?: ReactNode;
|
|
43
|
-
/**
|
|
44
|
-
* Content at the end of the row, such as an "Update all" `Button` (pass it
|
|
45
|
-
* `fullWidth={false}`). It keeps its width; a long title is cut off instead.
|
|
46
|
-
*/
|
|
47
38
|
action?: ReactNode;
|
|
48
|
-
/**
|
|
49
|
-
* Pad the top by the safe-area inset. Default `true`, for a header at the top
|
|
50
|
-
* of a screen with no navigation header. Pass `false` under a native header
|
|
51
|
-
* or inside a view that already pads the inset.
|
|
52
|
-
*/
|
|
53
39
|
safeTop?: boolean;
|
|
54
40
|
className?: string;
|
|
55
|
-
/** Classes on the title. */
|
|
56
41
|
titleClassName?: string;
|
|
57
42
|
};
|
|
58
43
|
|