@vvedantb/native-ui 0.17.2 → 0.18.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/AlertDialog.jsx +123 -0
- package/dist/AmbientBackground.jsx +73 -0
- package/dist/ArtifactList.jsx +59 -0
- package/dist/Avatar.jsx +285 -0
- package/dist/Badge.jsx +154 -0
- package/dist/BottomSheetContainer.jsx +208 -0
- package/dist/BulkActionBar.jsx +717 -0
- package/dist/Button.jsx +344 -0
- package/dist/CaptureButton.jsx +104 -0
- package/dist/Card.jsx +371 -0
- package/dist/Checkbox.jsx +177 -0
- package/dist/Chip.jsx +79 -0
- package/dist/ColorSwatches.jsx +159 -0
- package/dist/ConfirmDialog.jsx +157 -0
- package/dist/DateTimeField.jsx +204 -0
- package/dist/Dialog.jsx +614 -0
- package/dist/DividedList.jsx +120 -0
- package/dist/DropdownMenu.jsx +849 -0
- package/dist/EmptyState.jsx +434 -0
- package/dist/ExpoWebRoot.jsx +134 -0
- package/dist/FloatingFAB.jsx +95 -0
- package/dist/FloatingSurface.jsx +226 -0
- package/dist/FloatingTabBar.jsx +403 -0
- package/dist/HeaderIconButton.jsx +53 -0
- package/dist/IconButton.jsx +157 -0
- package/dist/Input.jsx +96 -0
- package/dist/Label.jsx +96 -0
- package/dist/LabeledSwitchRow.jsx +170 -0
- package/dist/LiquidGlass.jsx +2 -0
- package/dist/ListRow.jsx +281 -0
- package/dist/LoadingState.jsx +205 -0
- package/dist/PageIndicator.jsx +128 -0
- package/dist/PageTitle.jsx +205 -0
- package/dist/Pager.jsx +105 -0
- package/dist/PasswordInput.jsx +120 -0
- package/dist/PillTabs.jsx +300 -0
- package/dist/PinnedBotTile.jsx +212 -0
- package/dist/Progress.jsx +147 -0
- package/dist/SafeAreaContainer.jsx +38 -0
- package/dist/ScreenContainer.jsx +117 -0
- package/dist/SearchInput.jsx +150 -0
- package/dist/SectionLabel.jsx +128 -0
- package/dist/Select.jsx +223 -0
- package/dist/Separator.jsx +95 -0
- package/dist/Sheet.jsx +343 -0
- package/dist/SheetRow.jsx +198 -0
- package/dist/Skeleton.jsx +311 -0
- package/dist/Spinner.jsx +195 -0
- package/dist/StackPageHeader.jsx +160 -0
- package/dist/StatGrid.jsx +74 -0
- package/dist/StatusDot.jsx +129 -0
- package/dist/SurfaceRow.jsx +143 -0
- package/dist/SwipeableRow.jsx +50 -0
- package/dist/Switch.jsx +130 -0
- package/dist/Tabs.jsx +385 -0
- package/dist/Textarea.jsx +103 -0
- package/dist/ThemeToggle.jsx +78 -0
- package/dist/Toast.jsx +396 -0
- package/dist/ai/activity-step-detail.jsx +179 -0
- package/dist/ai/activity-step-label.js +816 -0
- package/dist/ai/activity-step-types.js +14 -0
- package/dist/ai/activity-step.jsx +98 -0
- package/dist/ai/activity-tasks-utils.js +172 -0
- package/dist/ai/activity-timeline.js +47 -0
- package/dist/ai/attachments.jsx +258 -0
- package/dist/ai/card-button.jsx +188 -0
- package/dist/ai/chain-of-thought.jsx +459 -0
- package/dist/ai/chat-jump-rail.jsx +57 -0
- package/dist/ai/chat-text.js +44 -0
- package/dist/ai/chat-thread.jsx +135 -0
- package/dist/ai/choice-question.jsx +925 -0
- package/dist/ai/code-block.jsx +574 -0
- package/dist/ai/collapsible.jsx +275 -0
- package/dist/ai/conversation.jsx +723 -0
- package/dist/ai/file-chip.jsx +198 -0
- package/dist/ai/icon-button.jsx +179 -0
- package/dist/ai/index.js +37 -0
- package/dist/ai/message-action-sheet.jsx +408 -0
- package/dist/ai/message-quote.jsx +241 -0
- package/dist/ai/message.jsx +739 -0
- package/dist/ai/prompt-input-menu.jsx +365 -0
- package/dist/ai/prompt-input.jsx +626 -0
- package/dist/ai/reasoning.jsx +446 -0
- package/dist/ai/reply-quote-chip.jsx +278 -0
- package/dist/ai/response-text.jsx +130 -0
- package/dist/ai/shimmer.jsx +149 -0
- package/dist/ai/sources.jsx +260 -0
- package/dist/ai/subagent-cards.jsx +645 -0
- package/dist/ai/suggestion.jsx +186 -0
- package/dist/ai/tool-approval-card.jsx +359 -0
- package/dist/ai/trace.jsx +728 -0
- package/dist/ai/unified-diff.jsx +280 -0
- package/dist/ai/use-streaming-disclosure.js +70 -0
- package/dist/auth/AuthProviders.jsx +27 -0
- package/dist/auth/AuthScreen.jsx +292 -0
- package/dist/auth/GoogleSignInButton.jsx +188 -0
- package/dist/auth/SecondFactorScreen.jsx +133 -0
- package/dist/auth/SignInScreen.jsx +482 -0
- package/dist/auth/authErrors.js +131 -0
- package/dist/auth/index.js +11 -0
- package/dist/auth/totp.js +378 -0
- package/dist/blur.js +36 -0
- package/dist/brand/AppIcons.jsx +118 -0
- package/dist/brand/AppMark.jsx +128 -0
- package/dist/brand/AppWordmark.jsx +138 -0
- package/dist/brand/GoogleMark.jsx +71 -0
- package/dist/brand/ProviderIcon.jsx +192 -0
- package/dist/brand/familyApps.js +33 -0
- package/dist/brand/index.js +11 -0
- package/dist/brand/svg.js +252 -0
- package/dist/brand/vProAppBenefits.js +19 -0
- package/dist/cn.js +5 -0
- package/dist/colors.js +15 -0
- package/dist/configureTheme.js +72 -0
- package/dist/controlStyles.js +520 -0
- package/dist/definiteSize.js +12 -0
- package/dist/dialogLayout.js +18 -0
- package/dist/entries/ai.js +4 -0
- package/dist/entries/ambient.js +3 -0
- package/dist/entries/auth.js +5 -0
- package/dist/entries/bottom-sheet.js +2 -0
- package/dist/entries/brand.js +2 -0
- package/dist/entries/button.js +2 -0
- package/dist/entries/date-time.js +3 -0
- package/dist/entries/expo-router.js +4 -0
- package/dist/entries/expo-web-root.js +3 -0
- package/dist/entries/floating.js +7 -0
- package/dist/entries/gesture-handler.js +4 -0
- package/dist/entries/keyboard-controller.js +4 -0
- package/dist/entries/layout.js +16 -0
- package/dist/entries/markdown.js +4 -0
- package/dist/entries/marketing.js +3 -0
- package/dist/entries/page-title.js +7 -0
- package/dist/entries/password-input.js +3 -0
- package/dist/entries/primitives.js +57 -0
- package/dist/entries/search-input.js +3 -0
- package/dist/entries/tab-bar.js +4 -0
- package/dist/entries/theme.js +7 -0
- package/dist/entries/toast.js +5 -0
- package/dist/entries/video.js +3 -0
- package/dist/entries/webview.js +4 -0
- package/dist/examples/AiChatGallery.jsx +509 -0
- package/dist/examples/ParityGallery.jsx +1307 -0
- package/dist/floating.js +62 -0
- package/dist/glassBlur.jsx +145 -0
- package/dist/gradient.js +17 -0
- package/dist/haptics.js +44 -0
- package/dist/highlight.js +382 -0
- package/dist/index.js +85 -0
- package/dist/initials.js +4 -0
- package/dist/loadingGrid.js +81 -0
- package/dist/markdown/Markdown.jsx +515 -0
- package/dist/markdown/MarkdownTable.jsx +443 -0
- package/dist/markdown/tableText.js +68 -0
- package/dist/marketing/PricingModal.jsx +608 -0
- package/dist/marketing/UpgradeToProCard.jsx +164 -0
- package/dist/marketing/pricing.js +34 -0
- package/dist/media/ImageGallery.jsx +580 -0
- package/dist/media/MediaCard.jsx +162 -0
- package/dist/media/imageGrid.js +54 -0
- package/dist/motion.js +33 -0
- package/dist/pagerSwipe.js +104 -0
- package/dist/palette.js +104 -0
- package/dist/primitives/button.jsx +127 -0
- package/dist/primitives/card.jsx +249 -0
- package/dist/primitives/icon.jsx +37 -0
- package/dist/primitives/input.jsx +56 -0
- package/dist/primitives/keyboard-controller.jsx +207 -0
- package/dist/primitives/keyboard-parts.jsx +75 -0
- package/dist/primitives/native-only-animated-view.jsx +68 -0
- package/dist/primitives/overlay.jsx +391 -0
- package/dist/primitives/pager-gesture.jsx +131 -0
- package/dist/primitives/select-host.jsx +103 -0
- package/dist/primitives/select.jsx +555 -0
- package/dist/primitives/sheet-drag.jsx +420 -0
- package/dist/primitives/sheet-gesture.jsx +219 -0
- package/dist/primitives/swipe-row-gesture.jsx +341 -0
- package/dist/primitives/switch.jsx +105 -0
- package/dist/primitives/text.jsx +145 -0
- package/dist/primitives/toast-drag-gesture.jsx +94 -0
- package/dist/primitives/use-controllable-state.js +40 -0
- package/dist/primitives/web-click-guard.js +69 -0
- package/dist/push.js +166 -0
- package/dist/relativeTime.js +70 -0
- package/dist/router/RouterStackPageHeader.jsx +53 -0
- package/dist/selectA11y.js +32 -0
- package/dist/settings/MoreFromProjectV.jsx +168 -0
- package/dist/settings/SettingsEmptyState.jsx +102 -0
- package/dist/settings/SettingsField.jsx +49 -0
- package/dist/settings/SettingsSection.jsx +101 -0
- package/dist/settings/SettingsStack.jsx +17 -0
- package/dist/settings/SettingsToggleRow.jsx +163 -0
- package/dist/settings/projectVMobileApps.js +126 -0
- package/dist/settings/relaxedSizeStyle.js +11 -0
- package/dist/sheetDrag.js +76 -0
- package/dist/svgA11y.js +46 -0
- package/dist/swipeRow.js +161 -0
- package/dist/tabBarRoutes.js +41 -0
- package/dist/tabIndicator.js +139 -0
- package/dist/tailwind-preset.cjs +255 -0
- package/dist/tailwind-preset.d.cts +55 -0
- package/dist/theme.jsx +62 -0
- package/dist/toastChrome.js +110 -0
- package/dist/toastDrag.js +51 -0
- package/dist/toastStore.js +54 -0
- package/dist/tokens.js +70 -0
- package/dist/typography.js +40 -0
- package/dist/useReduceMotion.js +32 -0
- package/dist/useReduceTransparency.js +27 -0
- package/dist/useScheme.js +15 -0
- package/dist/video/InlineVideo.jsx +115 -0
- package/dist/webview/HtmlView.jsx +169 -0
- package/dist/webview/HtmlView.web.jsx +63 -0
- package/dist/webview/htmlView.js +43 -0
- package/package.json +70 -33
- package/src/DropdownMenu.tsx +28 -16
- package/src/FloatingTabBar.tsx +78 -41
- package/src/ai/conversation.tsx +12 -8
- package/src/glassBlur.tsx +47 -22
- package/src/primitives/swipe-row-gesture.tsx +11 -2
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { Text, View } from "react-native";
|
|
3
|
+
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
|
+
import { cn } from "./cn";
|
|
5
|
+
import { PAGE_HEADER_HEIGHT, PAGE_TITLE_CLASS, pageTitleStyle, textStyle } from "./controlStyles";
|
|
6
|
+
import { useScheme } from "./useScheme";
|
|
7
|
+
/**
|
|
8
|
+
* The web page title (`Breadcrumb`: `text-xl font-semibold leading-tight
|
|
9
|
+
* tracking-tight`): Instrument Sans 600 at 20 / 25 with -0.5 letter spacing,
|
|
10
|
+
* in the scheme's foreground. A header for VoiceOver and TalkBack. One line,
|
|
11
|
+
* cut off at the end as the web `truncate`; pass `numberOfLines={0}` to wrap.
|
|
12
|
+
* It scales with the system font size.
|
|
13
|
+
*/
|
|
14
|
+
export function PageTitle(t0) {
|
|
15
|
+
const $ = _c(16);
|
|
16
|
+
let className;
|
|
17
|
+
let props;
|
|
18
|
+
let style;
|
|
19
|
+
if ($[0] !== t0) {
|
|
20
|
+
({
|
|
21
|
+
className,
|
|
22
|
+
style,
|
|
23
|
+
...props
|
|
24
|
+
} = t0);
|
|
25
|
+
$[0] = t0;
|
|
26
|
+
$[1] = className;
|
|
27
|
+
$[2] = props;
|
|
28
|
+
$[3] = style;
|
|
29
|
+
} else {
|
|
30
|
+
className = $[1];
|
|
31
|
+
props = $[2];
|
|
32
|
+
style = $[3];
|
|
33
|
+
}
|
|
34
|
+
const scheme = useScheme();
|
|
35
|
+
let t1;
|
|
36
|
+
if ($[4] !== className) {
|
|
37
|
+
t1 = cn(PAGE_TITLE_CLASS, className);
|
|
38
|
+
$[4] = className;
|
|
39
|
+
$[5] = t1;
|
|
40
|
+
} else {
|
|
41
|
+
t1 = $[5];
|
|
42
|
+
}
|
|
43
|
+
let t2;
|
|
44
|
+
if ($[6] !== scheme) {
|
|
45
|
+
t2 = textStyle("foreground", scheme);
|
|
46
|
+
$[6] = scheme;
|
|
47
|
+
$[7] = t2;
|
|
48
|
+
} else {
|
|
49
|
+
t2 = $[7];
|
|
50
|
+
}
|
|
51
|
+
let t3;
|
|
52
|
+
if ($[8] === Symbol.for("react.memo_cache_sentinel")) {
|
|
53
|
+
t3 = pageTitleStyle();
|
|
54
|
+
$[8] = t3;
|
|
55
|
+
} else {
|
|
56
|
+
t3 = $[8];
|
|
57
|
+
}
|
|
58
|
+
let t4;
|
|
59
|
+
if ($[9] !== style || $[10] !== t2) {
|
|
60
|
+
t4 = [t2, t3, style];
|
|
61
|
+
$[9] = style;
|
|
62
|
+
$[10] = t2;
|
|
63
|
+
$[11] = t4;
|
|
64
|
+
} else {
|
|
65
|
+
t4 = $[11];
|
|
66
|
+
}
|
|
67
|
+
let t5;
|
|
68
|
+
if ($[12] !== props || $[13] !== t1 || $[14] !== t4) {
|
|
69
|
+
t5 = <Text accessibilityRole="header" numberOfLines={1} className={t1} style={t4} {...props} />;
|
|
70
|
+
$[12] = props;
|
|
71
|
+
$[13] = t1;
|
|
72
|
+
$[14] = t4;
|
|
73
|
+
$[15] = t5;
|
|
74
|
+
} else {
|
|
75
|
+
t5 = $[15];
|
|
76
|
+
}
|
|
77
|
+
return t5;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* A screen's title row: an optional `leading` part, `PageTitle` and an
|
|
81
|
+
* optional `action` at the end, with the `ScreenContainer` side padding (`px-4`). The row is at
|
|
82
|
+
* least `PAGE_HEADER_HEIGHT` (56) high below the top inset, so tab roots with
|
|
83
|
+
* and without an action put their titles at the same height.
|
|
84
|
+
*/
|
|
85
|
+
export function PageHeader(t0) {
|
|
86
|
+
const $ = _c(33);
|
|
87
|
+
let action;
|
|
88
|
+
let className;
|
|
89
|
+
let leading;
|
|
90
|
+
let props;
|
|
91
|
+
let style;
|
|
92
|
+
let t1;
|
|
93
|
+
let title;
|
|
94
|
+
let titleClassName;
|
|
95
|
+
if ($[0] !== t0) {
|
|
96
|
+
({
|
|
97
|
+
title,
|
|
98
|
+
leading,
|
|
99
|
+
action,
|
|
100
|
+
safeTop: t1,
|
|
101
|
+
className,
|
|
102
|
+
titleClassName,
|
|
103
|
+
style,
|
|
104
|
+
...props
|
|
105
|
+
} = t0);
|
|
106
|
+
$[0] = t0;
|
|
107
|
+
$[1] = action;
|
|
108
|
+
$[2] = className;
|
|
109
|
+
$[3] = leading;
|
|
110
|
+
$[4] = props;
|
|
111
|
+
$[5] = style;
|
|
112
|
+
$[6] = t1;
|
|
113
|
+
$[7] = title;
|
|
114
|
+
$[8] = titleClassName;
|
|
115
|
+
} else {
|
|
116
|
+
action = $[1];
|
|
117
|
+
className = $[2];
|
|
118
|
+
leading = $[3];
|
|
119
|
+
props = $[4];
|
|
120
|
+
style = $[5];
|
|
121
|
+
t1 = $[6];
|
|
122
|
+
title = $[7];
|
|
123
|
+
titleClassName = $[8];
|
|
124
|
+
}
|
|
125
|
+
const safeTop = t1 === undefined ? true : t1;
|
|
126
|
+
const insets = useSafeAreaInsets();
|
|
127
|
+
const top = safeTop ? insets.top : 0;
|
|
128
|
+
let t2;
|
|
129
|
+
if ($[9] !== className) {
|
|
130
|
+
t2 = cn("flex-row items-center justify-between gap-3 px-4", className);
|
|
131
|
+
$[9] = className;
|
|
132
|
+
$[10] = t2;
|
|
133
|
+
} else {
|
|
134
|
+
t2 = $[10];
|
|
135
|
+
}
|
|
136
|
+
const t3 = top + PAGE_HEADER_HEIGHT;
|
|
137
|
+
let t4;
|
|
138
|
+
if ($[11] !== t3 || $[12] !== top) {
|
|
139
|
+
t4 = {
|
|
140
|
+
paddingTop: top,
|
|
141
|
+
minHeight: t3
|
|
142
|
+
};
|
|
143
|
+
$[11] = t3;
|
|
144
|
+
$[12] = top;
|
|
145
|
+
$[13] = t4;
|
|
146
|
+
} else {
|
|
147
|
+
t4 = $[13];
|
|
148
|
+
}
|
|
149
|
+
let t5;
|
|
150
|
+
if ($[14] !== style || $[15] !== t4) {
|
|
151
|
+
t5 = [t4, style];
|
|
152
|
+
$[14] = style;
|
|
153
|
+
$[15] = t4;
|
|
154
|
+
$[16] = t5;
|
|
155
|
+
} else {
|
|
156
|
+
t5 = $[16];
|
|
157
|
+
}
|
|
158
|
+
let t6;
|
|
159
|
+
if ($[17] !== leading) {
|
|
160
|
+
t6 = leading ? <View className="shrink-0">{leading}</View> : null;
|
|
161
|
+
$[17] = leading;
|
|
162
|
+
$[18] = t6;
|
|
163
|
+
} else {
|
|
164
|
+
t6 = $[18];
|
|
165
|
+
}
|
|
166
|
+
let t7;
|
|
167
|
+
if ($[19] !== titleClassName) {
|
|
168
|
+
t7 = cn("min-w-0 flex-1", titleClassName);
|
|
169
|
+
$[19] = titleClassName;
|
|
170
|
+
$[20] = t7;
|
|
171
|
+
} else {
|
|
172
|
+
t7 = $[20];
|
|
173
|
+
}
|
|
174
|
+
let t8;
|
|
175
|
+
if ($[21] !== t7 || $[22] !== title) {
|
|
176
|
+
t8 = <PageTitle className={t7}>{title}</PageTitle>;
|
|
177
|
+
$[21] = t7;
|
|
178
|
+
$[22] = title;
|
|
179
|
+
$[23] = t8;
|
|
180
|
+
} else {
|
|
181
|
+
t8 = $[23];
|
|
182
|
+
}
|
|
183
|
+
let t9;
|
|
184
|
+
if ($[24] !== action) {
|
|
185
|
+
t9 = action ? <View className="shrink-0">{action}</View> : null;
|
|
186
|
+
$[24] = action;
|
|
187
|
+
$[25] = t9;
|
|
188
|
+
} else {
|
|
189
|
+
t9 = $[25];
|
|
190
|
+
}
|
|
191
|
+
let t10;
|
|
192
|
+
if ($[26] !== props || $[27] !== t2 || $[28] !== t5 || $[29] !== t6 || $[30] !== t8 || $[31] !== t9) {
|
|
193
|
+
t10 = <View className={t2} style={t5} {...props}>{t6}{t8}{t9}</View>;
|
|
194
|
+
$[26] = props;
|
|
195
|
+
$[27] = t2;
|
|
196
|
+
$[28] = t5;
|
|
197
|
+
$[29] = t6;
|
|
198
|
+
$[30] = t8;
|
|
199
|
+
$[31] = t9;
|
|
200
|
+
$[32] = t10;
|
|
201
|
+
} else {
|
|
202
|
+
t10 = $[32];
|
|
203
|
+
}
|
|
204
|
+
return t10;
|
|
205
|
+
}
|
package/dist/Pager.jsx
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { createContext, useContext, useEffect } from "react";
|
|
3
|
+
import { View } from "react-native";
|
|
4
|
+
/**
|
|
5
|
+
* The Gesture Handler pager, from `@vvedantb/native-ui/gesture-handler`
|
|
6
|
+
* (`GestureHandlerProvider`). A context, so only that entry imports
|
|
7
|
+
* `react-native-gesture-handler`.
|
|
8
|
+
*/
|
|
9
|
+
export const PagerGestureContext = createContext(null);
|
|
10
|
+
|
|
11
|
+
/** Set inside a swiped `Pager`: a `SwipeableRow` there leaves the directions it has no actions for to the pager. */
|
|
12
|
+
export const InsidePagerContext = createContext(false);
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Side-by-side pages a horizontal swipe moves between, such as the sections
|
|
16
|
+
* under a row of `PillTabs`. The pages follow the finger 1:1 and, on release,
|
|
17
|
+
* spring on at the finger's speed to the nearest page (a flick turns one
|
|
18
|
+
* page); past the first and last page they rubber-band. The linked
|
|
19
|
+
* `progress` moves the `PillTabs` indicator with them. Only a clearly
|
|
20
|
+
* sideways drag takes the pages: a vertical drag scrolls the page, and a
|
|
21
|
+
* `SwipeableRow` under the finger takes its own swipe first (it lets a drag
|
|
22
|
+
* toward a side it has no actions for through to the pager). A settled page
|
|
23
|
+
* fires a selection haptic and `onIndexChange`. With Reduce Motion on the
|
|
24
|
+
* pages still follow the finger, and the release settles at once.
|
|
25
|
+
*
|
|
26
|
+
* The swipe needs `GestureHandlerProvider`; without it only the current page
|
|
27
|
+
* is drawn, with no swipe.
|
|
28
|
+
*/
|
|
29
|
+
export function Pager(props) {
|
|
30
|
+
const $ = _c(5);
|
|
31
|
+
const GesturePager = useContext(PagerGestureContext);
|
|
32
|
+
if (GesturePager) {
|
|
33
|
+
let t0;
|
|
34
|
+
if ($[0] !== GesturePager || $[1] !== props) {
|
|
35
|
+
t0 = <GesturePager {...props} />;
|
|
36
|
+
$[0] = GesturePager;
|
|
37
|
+
$[1] = props;
|
|
38
|
+
$[2] = t0;
|
|
39
|
+
} else {
|
|
40
|
+
t0 = $[2];
|
|
41
|
+
}
|
|
42
|
+
return t0;
|
|
43
|
+
}
|
|
44
|
+
let t0;
|
|
45
|
+
if ($[3] !== props) {
|
|
46
|
+
t0 = <StaticPager {...props} />;
|
|
47
|
+
$[3] = props;
|
|
48
|
+
$[4] = t0;
|
|
49
|
+
} else {
|
|
50
|
+
t0 = $[4];
|
|
51
|
+
}
|
|
52
|
+
return t0;
|
|
53
|
+
}
|
|
54
|
+
function StaticPager(t0) {
|
|
55
|
+
const $ = _c(11);
|
|
56
|
+
const {
|
|
57
|
+
index,
|
|
58
|
+
progress,
|
|
59
|
+
renderPage
|
|
60
|
+
} = t0;
|
|
61
|
+
let t1;
|
|
62
|
+
let t2;
|
|
63
|
+
if ($[0] !== index || $[1] !== progress) {
|
|
64
|
+
t1 = () => {
|
|
65
|
+
progress.set(index);
|
|
66
|
+
};
|
|
67
|
+
t2 = [index, progress];
|
|
68
|
+
$[0] = index;
|
|
69
|
+
$[1] = progress;
|
|
70
|
+
$[2] = t1;
|
|
71
|
+
$[3] = t2;
|
|
72
|
+
} else {
|
|
73
|
+
t1 = $[2];
|
|
74
|
+
t2 = $[3];
|
|
75
|
+
}
|
|
76
|
+
useEffect(t1, t2);
|
|
77
|
+
let t3;
|
|
78
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
79
|
+
t3 = {
|
|
80
|
+
flex: 1
|
|
81
|
+
};
|
|
82
|
+
$[4] = t3;
|
|
83
|
+
} else {
|
|
84
|
+
t3 = $[4];
|
|
85
|
+
}
|
|
86
|
+
let t4;
|
|
87
|
+
if ($[5] !== index || $[6] !== renderPage) {
|
|
88
|
+
t4 = renderPage(index);
|
|
89
|
+
$[5] = index;
|
|
90
|
+
$[6] = renderPage;
|
|
91
|
+
$[7] = t4;
|
|
92
|
+
} else {
|
|
93
|
+
t4 = $[7];
|
|
94
|
+
}
|
|
95
|
+
let t5;
|
|
96
|
+
if ($[8] !== index || $[9] !== t4) {
|
|
97
|
+
t5 = <View key={index} style={t3}>{t4}</View>;
|
|
98
|
+
$[8] = index;
|
|
99
|
+
$[9] = t4;
|
|
100
|
+
$[10] = t5;
|
|
101
|
+
} else {
|
|
102
|
+
t5 = $[10];
|
|
103
|
+
}
|
|
104
|
+
return t5;
|
|
105
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { Pressable, View } from "react-native";
|
|
4
|
+
import { IconEye, IconEyeOff } from "@tabler/icons-react-native";
|
|
5
|
+
import { Input } from "./Input";
|
|
6
|
+
import { cn } from "./cn";
|
|
7
|
+
import { fieldStyle, fieldTextStyle, touchSlop, typeStyle } from "./controlStyles";
|
|
8
|
+
import { tokens } from "./tokens";
|
|
9
|
+
import { useLargerText } from "./theme";
|
|
10
|
+
import { useScheme } from "./useScheme";
|
|
11
|
+
/** Toggle metrics: painted 24 (32 with larger text), 44 with its hit slop. */
|
|
12
|
+
function passwordToggleSize(largerText) {
|
|
13
|
+
return largerText ? {
|
|
14
|
+
button: 32,
|
|
15
|
+
icon: 20,
|
|
16
|
+
right: 12,
|
|
17
|
+
paddingRight: 56
|
|
18
|
+
} : {
|
|
19
|
+
button: 24,
|
|
20
|
+
icon: 18,
|
|
21
|
+
right: 8,
|
|
22
|
+
paddingRight: 44
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* `Input` for a password, with a show/hide eye button at the end. The text is
|
|
28
|
+
* hidden at first. The toggle flips `secureTextEntry` on the same mounted
|
|
29
|
+
* field, so focus and the cursor stay where they were. The `secureTextEntry`
|
|
30
|
+
* prop is not accepted: the toggle owns it. Every other `Input` prop, `ref`
|
|
31
|
+
* and `testID` pass through. The toggle is labelled "Show password" while the
|
|
32
|
+
* text is hidden and "Hide password" while it shows, has the test ID
|
|
33
|
+
* `${testID}-toggle` (`password-input-toggle` without a `testID`), is painted
|
|
34
|
+
* at 24 and reaches 44 with its hit slop (`touchSlop`). It is hidden when the
|
|
35
|
+
* field is not editable. Inside a `ScrollView`, set
|
|
36
|
+
* `keyboardShouldPersistTaps="handled"` so the first tap toggles while the
|
|
37
|
+
* keyboard is up.
|
|
38
|
+
*/
|
|
39
|
+
const PasswordInput = React.forwardRef((t0, ref) => {
|
|
40
|
+
const $ = _c(21);
|
|
41
|
+
let className;
|
|
42
|
+
let props;
|
|
43
|
+
let style;
|
|
44
|
+
let testID;
|
|
45
|
+
let wrapperClassName;
|
|
46
|
+
if ($[0] !== t0) {
|
|
47
|
+
({
|
|
48
|
+
wrapperClassName,
|
|
49
|
+
className,
|
|
50
|
+
style,
|
|
51
|
+
testID,
|
|
52
|
+
...props
|
|
53
|
+
} = t0);
|
|
54
|
+
$[0] = t0;
|
|
55
|
+
$[1] = className;
|
|
56
|
+
$[2] = props;
|
|
57
|
+
$[3] = style;
|
|
58
|
+
$[4] = testID;
|
|
59
|
+
$[5] = wrapperClassName;
|
|
60
|
+
} else {
|
|
61
|
+
className = $[1];
|
|
62
|
+
props = $[2];
|
|
63
|
+
style = $[3];
|
|
64
|
+
testID = $[4];
|
|
65
|
+
wrapperClassName = $[5];
|
|
66
|
+
}
|
|
67
|
+
const largerText = useLargerText();
|
|
68
|
+
const scheme = useScheme();
|
|
69
|
+
const [visible, setVisible] = React.useState(false);
|
|
70
|
+
let t1;
|
|
71
|
+
if ($[6] !== className || $[7] !== largerText || $[8] !== props || $[9] !== ref || $[10] !== scheme || $[11] !== style || $[12] !== testID || $[13] !== visible || $[14] !== wrapperClassName) {
|
|
72
|
+
const metrics = passwordToggleSize(largerText);
|
|
73
|
+
const muted = tokens.color.muted[scheme];
|
|
74
|
+
const Icon = visible ? IconEyeOff : IconEye;
|
|
75
|
+
let t2;
|
|
76
|
+
if ($[16] !== wrapperClassName) {
|
|
77
|
+
t2 = cn("relative w-full", wrapperClassName);
|
|
78
|
+
$[16] = wrapperClassName;
|
|
79
|
+
$[17] = t2;
|
|
80
|
+
} else {
|
|
81
|
+
t2 = $[17];
|
|
82
|
+
}
|
|
83
|
+
const t3 = largerText && "min-h-16 px-4 py-4 text-xl font-instrument-sans-medium";
|
|
84
|
+
let t4;
|
|
85
|
+
if ($[18] !== className || $[19] !== t3) {
|
|
86
|
+
t4 = cn("min-h-11 border px-3.5 py-2 text-base font-instrument-sans", t3, className);
|
|
87
|
+
$[18] = className;
|
|
88
|
+
$[19] = t3;
|
|
89
|
+
$[20] = t4;
|
|
90
|
+
} else {
|
|
91
|
+
t4 = $[20];
|
|
92
|
+
}
|
|
93
|
+
t1 = <View className={t2}><Input {...props} ref={ref} testID={testID} className={t4} secureTextEntry={!visible} style={[fieldStyle(scheme), fieldTextStyle(scheme), largerText ? typeStyle("medium") : null, {
|
|
94
|
+
paddingRight: metrics.paddingRight
|
|
95
|
+
}, style]} />{props.editable !== false ? <View pointerEvents="box-none" className="absolute bottom-0 top-0 justify-center" style={{
|
|
96
|
+
right: metrics.right
|
|
97
|
+
}}><Pressable testID={testID ? `${testID}-toggle` : "password-input-toggle"} accessibilityRole="button" accessibilityLabel={visible ? "Hide password" : "Show password"} hitSlop={touchSlop(metrics.button)} onPress={() => setVisible(_temp)} className="items-center justify-center rounded-md active:opacity-70" style={{
|
|
98
|
+
width: metrics.button,
|
|
99
|
+
height: metrics.button
|
|
100
|
+
}}><Icon size={metrics.icon} color={muted} strokeWidth={1.75} /></Pressable></View> : null}</View>;
|
|
101
|
+
$[6] = className;
|
|
102
|
+
$[7] = largerText;
|
|
103
|
+
$[8] = props;
|
|
104
|
+
$[9] = ref;
|
|
105
|
+
$[10] = scheme;
|
|
106
|
+
$[11] = style;
|
|
107
|
+
$[12] = testID;
|
|
108
|
+
$[13] = visible;
|
|
109
|
+
$[14] = wrapperClassName;
|
|
110
|
+
$[15] = t1;
|
|
111
|
+
} else {
|
|
112
|
+
t1 = $[15];
|
|
113
|
+
}
|
|
114
|
+
return t1;
|
|
115
|
+
});
|
|
116
|
+
PasswordInput.displayName = "PasswordInput";
|
|
117
|
+
export { PasswordInput };
|
|
118
|
+
function _temp(current) {
|
|
119
|
+
return !current;
|
|
120
|
+
}
|