@vvedantb/native-ui 0.34.0 → 0.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -2
- package/dist/Button.jsx +9 -3
- package/dist/ExpoWebRoot.jsx +42 -21
- package/dist/Field.jsx +309 -0
- package/dist/FloatingTabBar.jsx +98 -94
- package/dist/ai/conversation.jsx +1 -1
- package/dist/blur.js +6 -0
- package/dist/controlStyles.js +24 -2
- package/dist/entries/layout.js +1 -0
- package/dist/entries/primitives.js +1 -0
- package/dist/examples/ParityGallery.jsx +488 -475
- package/dist/glassBlur.jsx +1 -1
- package/dist/index.js +2 -0
- package/dist/primitives/window-layer.jsx +35 -28
- package/dist/settings/ThemeModePicker.jsx +135 -0
- package/package.json +27 -3
- package/src/Button.tsx +10 -4
- package/src/DropdownMenu.tsx +11 -2
- package/src/ExpoWebRoot.tsx +18 -3
- package/src/Field.tsx +105 -0
- package/src/FloatingTabBar.tsx +17 -12
- package/src/Spinner.tsx +2 -2
- package/src/ai/conversation.tsx +1 -1
- package/src/ai/message.tsx +2 -2
- package/src/auth/AccountScreens.tsx +4 -4
- package/src/auth/SignInScreen.tsx +4 -4
- package/src/blur.ts +8 -0
- package/src/controlStyles.ts +29 -2
- package/src/entries/layout.ts +2 -0
- package/src/entries/primitives.ts +2 -0
- package/src/examples/ParityGallery.tsx +22 -1
- package/src/glassBlur.tsx +5 -7
- package/src/index.ts +4 -0
- package/src/primitives/sheet-gesture.tsx +1 -2
- package/src/primitives/web-click-guard.ts +3 -3
- package/src/primitives/window-layer.tsx +8 -6
- package/src/settings/ThemeModePicker.tsx +132 -0
- package/src/tabBarRoutes.ts +4 -3
- package/src/webview/HtmlView.tsx +5 -2
package/dist/FloatingTabBar.jsx
CHANGED
|
@@ -27,8 +27,9 @@ const PILL_SLIDE = {
|
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* The fields this bar reads from the props Expo Router's `Tabs` passes to
|
|
30
|
-
* `tabBar` (
|
|
31
|
-
*
|
|
30
|
+
* `tabBar` (its `BottomTabBarProps`, Expo SDK 58). Declared here so the tab
|
|
31
|
+
* bar does not import `expo-router`. SDK 58 replaced the `navigation` prop
|
|
32
|
+
* with an `emitter` (for `tabPress`) and `navigateToTab(routeKey)`.
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -42,11 +43,12 @@ const PILL_SLIDE = {
|
|
|
42
43
|
* whole bar with `tabBarStyle: { display: "none" }` (`isTabBarHidden`).
|
|
43
44
|
*/
|
|
44
45
|
export function FloatingTabBar(t0) {
|
|
45
|
-
const $ = _c(
|
|
46
|
+
const $ = _c(42);
|
|
46
47
|
const {
|
|
47
48
|
state,
|
|
48
49
|
descriptors,
|
|
49
|
-
|
|
50
|
+
emitter,
|
|
51
|
+
navigateToTab
|
|
50
52
|
} = t0;
|
|
51
53
|
const insets = useSafeAreaInsets();
|
|
52
54
|
const largerText = useLargerText();
|
|
@@ -124,9 +126,9 @@ export function FloatingTabBar(t0) {
|
|
|
124
126
|
t5 = $[17];
|
|
125
127
|
}
|
|
126
128
|
let t6;
|
|
127
|
-
if ($[18] !== descriptors || $[19] !==
|
|
129
|
+
if ($[18] !== descriptors || $[19] !== emitter || $[20] !== largerText || $[21] !== navigateToTab || $[22] !== scheme || $[23] !== state.index || $[24] !== state.routes) {
|
|
128
130
|
let t7;
|
|
129
|
-
if ($[
|
|
131
|
+
if ($[26] !== descriptors || $[27] !== emitter || $[28] !== largerText || $[29] !== navigateToTab || $[30] !== scheme || $[31] !== state.index) {
|
|
130
132
|
t7 = (route_1, index) => {
|
|
131
133
|
const options = descriptors[route_1.key]?.options;
|
|
132
134
|
if (!isTabBarRouteVisible(options)) {
|
|
@@ -135,68 +137,71 @@ export function FloatingTabBar(t0) {
|
|
|
135
137
|
const focused = state.index === index;
|
|
136
138
|
const label = typeof options.tabBarLabel === "string" ? options.tabBarLabel : typeof options.title === "string" ? options.title : route_1.name;
|
|
137
139
|
const color = (focused ? options.tabBarActiveTintColor : options.tabBarInactiveTintColor) ?? tabColors("segmented", focused, scheme).color;
|
|
138
|
-
return <TabBarItem key={route_1.key} route={route_1}
|
|
140
|
+
return <TabBarItem key={route_1.key} route={route_1} emitter={emitter} navigateToTab={navigateToTab} focused={focused} label={label} color={color} largerText={largerText} renderIcon={options.tabBarIcon} testID={options.tabBarButtonTestID} accessibilityLabel={options.tabBarAccessibilityLabel ?? label} />;
|
|
139
141
|
};
|
|
140
|
-
$[
|
|
141
|
-
$[
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
142
|
+
$[26] = descriptors;
|
|
143
|
+
$[27] = emitter;
|
|
144
|
+
$[28] = largerText;
|
|
145
|
+
$[29] = navigateToTab;
|
|
146
|
+
$[30] = scheme;
|
|
147
|
+
$[31] = state.index;
|
|
148
|
+
$[32] = t7;
|
|
146
149
|
} else {
|
|
147
|
-
t7 = $[
|
|
150
|
+
t7 = $[32];
|
|
148
151
|
}
|
|
149
152
|
t6 = state.routes.map(t7);
|
|
150
153
|
$[18] = descriptors;
|
|
151
|
-
$[19] =
|
|
152
|
-
$[20] =
|
|
153
|
-
$[21] =
|
|
154
|
-
$[22] =
|
|
155
|
-
$[23] = state.
|
|
156
|
-
$[24] =
|
|
154
|
+
$[19] = emitter;
|
|
155
|
+
$[20] = largerText;
|
|
156
|
+
$[21] = navigateToTab;
|
|
157
|
+
$[22] = scheme;
|
|
158
|
+
$[23] = state.index;
|
|
159
|
+
$[24] = state.routes;
|
|
160
|
+
$[25] = t6;
|
|
157
161
|
} else {
|
|
158
|
-
t6 = $[
|
|
162
|
+
t6 = $[25];
|
|
159
163
|
}
|
|
160
164
|
let t7;
|
|
161
|
-
if ($[
|
|
165
|
+
if ($[33] !== t5 || $[34] !== t6) {
|
|
162
166
|
t7 = <View className="flex-row items-center justify-around" style={t5} accessibilityRole="tablist">{t6}</View>;
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
167
|
+
$[33] = t5;
|
|
168
|
+
$[34] = t6;
|
|
169
|
+
$[35] = t7;
|
|
166
170
|
} else {
|
|
167
|
-
t7 = $[
|
|
171
|
+
t7 = $[35];
|
|
168
172
|
}
|
|
169
173
|
let t8;
|
|
170
|
-
if ($[
|
|
174
|
+
if ($[36] !== t4 || $[37] !== t7) {
|
|
171
175
|
t8 = <FloatingSurface radius={FLOATING_PILL_RADIUS}>{t4}{t7}</FloatingSurface>;
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
176
|
+
$[36] = t4;
|
|
177
|
+
$[37] = t7;
|
|
178
|
+
$[38] = t8;
|
|
175
179
|
} else {
|
|
176
|
-
t8 = $[
|
|
180
|
+
t8 = $[38];
|
|
177
181
|
}
|
|
178
182
|
let t9;
|
|
179
|
-
if ($[
|
|
183
|
+
if ($[39] !== t3 || $[40] !== t8) {
|
|
180
184
|
t9 = <View pointerEvents="box-none" style={t3}>{t8}</View>;
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
185
|
+
$[39] = t3;
|
|
186
|
+
$[40] = t8;
|
|
187
|
+
$[41] = t9;
|
|
184
188
|
} else {
|
|
185
|
-
t9 = $[
|
|
189
|
+
t9 = $[41];
|
|
186
190
|
}
|
|
187
191
|
return t9;
|
|
188
192
|
}
|
|
189
193
|
/**
|
|
190
194
|
* One tab. React Compiler (the package build) memoises it, so a switch
|
|
191
195
|
* renders only the two tabs whose focus changed. Its props are stable between
|
|
192
|
-
* switches: `route` and `
|
|
193
|
-
* the caller's function.
|
|
196
|
+
* switches: `route`, `emitter` and `navigateToTab` keep their identity, and
|
|
197
|
+
* `tabBarIcon` is the caller's function.
|
|
194
198
|
*/
|
|
195
199
|
function TabBarItem(t0) {
|
|
196
|
-
const $ = _c(
|
|
200
|
+
const $ = _c(33);
|
|
197
201
|
const {
|
|
198
202
|
route,
|
|
199
|
-
|
|
203
|
+
emitter,
|
|
204
|
+
navigateToTab,
|
|
200
205
|
focused,
|
|
201
206
|
label,
|
|
202
207
|
color,
|
|
@@ -207,117 +212,116 @@ function TabBarItem(t0) {
|
|
|
207
212
|
} = t0;
|
|
208
213
|
const press = usePressed();
|
|
209
214
|
let t1;
|
|
210
|
-
if ($[0] !==
|
|
215
|
+
if ($[0] !== emitter || $[1] !== focused || $[2] !== navigateToTab || $[3] !== route.key) {
|
|
211
216
|
t1 = () => {
|
|
212
|
-
const event =
|
|
217
|
+
const event = emitter.emit({
|
|
213
218
|
type: "tabPress",
|
|
214
219
|
target: route.key,
|
|
215
220
|
canPreventDefault: true
|
|
216
221
|
});
|
|
217
222
|
if (!focused && !event.defaultPrevented) {
|
|
218
223
|
selectionHaptic();
|
|
219
|
-
|
|
224
|
+
navigateToTab(route.key);
|
|
220
225
|
}
|
|
221
226
|
};
|
|
222
|
-
$[0] =
|
|
223
|
-
$[1] =
|
|
224
|
-
$[2] =
|
|
225
|
-
$[3] = route.
|
|
226
|
-
$[4] =
|
|
227
|
-
$[5] = t1;
|
|
227
|
+
$[0] = emitter;
|
|
228
|
+
$[1] = focused;
|
|
229
|
+
$[2] = navigateToTab;
|
|
230
|
+
$[3] = route.key;
|
|
231
|
+
$[4] = t1;
|
|
228
232
|
} else {
|
|
229
|
-
t1 = $[
|
|
233
|
+
t1 = $[4];
|
|
230
234
|
}
|
|
231
235
|
const onPress = t1;
|
|
232
236
|
let t2;
|
|
233
|
-
if ($[
|
|
237
|
+
if ($[5] !== focused) {
|
|
234
238
|
t2 = {
|
|
235
239
|
selected: focused
|
|
236
240
|
};
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
241
|
+
$[5] = focused;
|
|
242
|
+
$[6] = t2;
|
|
239
243
|
} else {
|
|
240
|
-
t2 = $[
|
|
244
|
+
t2 = $[6];
|
|
241
245
|
}
|
|
242
246
|
const t3 = press.onPressIn;
|
|
243
247
|
const t4 = press.onPressOut;
|
|
244
248
|
const t5 = press.pressed ? 0.7 : 1;
|
|
245
249
|
let t6;
|
|
246
|
-
if ($[
|
|
250
|
+
if ($[7] !== t5) {
|
|
247
251
|
t6 = {
|
|
248
252
|
opacity: t5
|
|
249
253
|
};
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
254
|
+
$[7] = t5;
|
|
255
|
+
$[8] = t6;
|
|
252
256
|
} else {
|
|
253
|
-
t6 = $[
|
|
257
|
+
t6 = $[8];
|
|
254
258
|
}
|
|
255
259
|
let t7;
|
|
256
|
-
if ($[
|
|
260
|
+
if ($[9] !== color || $[10] !== focused || $[11] !== largerText || $[12] !== renderIcon) {
|
|
257
261
|
t7 = renderIcon ? renderIcon({
|
|
258
262
|
focused,
|
|
259
263
|
color,
|
|
260
264
|
size: largerText ? 28 : 24
|
|
261
265
|
}) : null;
|
|
262
|
-
$[
|
|
263
|
-
$[
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
266
|
-
$[
|
|
266
|
+
$[9] = color;
|
|
267
|
+
$[10] = focused;
|
|
268
|
+
$[11] = largerText;
|
|
269
|
+
$[12] = renderIcon;
|
|
270
|
+
$[13] = t7;
|
|
267
271
|
} else {
|
|
268
|
-
t7 = $[
|
|
272
|
+
t7 = $[13];
|
|
269
273
|
}
|
|
270
274
|
const t8 = `font-instrument-sans-semibold ${largerText ? "text-base" : "text-sm"}`;
|
|
271
275
|
let t9;
|
|
272
|
-
if ($[
|
|
276
|
+
if ($[14] !== color) {
|
|
273
277
|
t9 = {
|
|
274
278
|
color
|
|
275
279
|
};
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
280
|
+
$[14] = color;
|
|
281
|
+
$[15] = t9;
|
|
278
282
|
} else {
|
|
279
|
-
t9 = $[
|
|
283
|
+
t9 = $[15];
|
|
280
284
|
}
|
|
281
285
|
let t10;
|
|
282
|
-
if ($[
|
|
286
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
283
287
|
t10 = typeStyle("semibold");
|
|
284
|
-
$[
|
|
288
|
+
$[16] = t10;
|
|
285
289
|
} else {
|
|
286
|
-
t10 = $[
|
|
290
|
+
t10 = $[16];
|
|
287
291
|
}
|
|
288
292
|
let t11;
|
|
289
|
-
if ($[
|
|
293
|
+
if ($[17] !== t9) {
|
|
290
294
|
t11 = [t9, t10];
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
295
|
+
$[17] = t9;
|
|
296
|
+
$[18] = t11;
|
|
293
297
|
} else {
|
|
294
|
-
t11 = $[
|
|
298
|
+
t11 = $[18];
|
|
295
299
|
}
|
|
296
300
|
let t12;
|
|
297
|
-
if ($[
|
|
301
|
+
if ($[19] !== label || $[20] !== t11 || $[21] !== t8) {
|
|
298
302
|
t12 = <Text numberOfLines={1} maxFontSizeMultiplier={1.5} className={t8} style={t11}>{label}</Text>;
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
+
$[19] = label;
|
|
304
|
+
$[20] = t11;
|
|
305
|
+
$[21] = t8;
|
|
306
|
+
$[22] = t12;
|
|
303
307
|
} else {
|
|
304
|
-
t12 = $[
|
|
308
|
+
t12 = $[22];
|
|
305
309
|
}
|
|
306
310
|
let t13;
|
|
307
|
-
if ($[
|
|
311
|
+
if ($[23] !== accessibilityLabel || $[24] !== onPress || $[25] !== press.onPressIn || $[26] !== press.onPressOut || $[27] !== t12 || $[28] !== t2 || $[29] !== t6 || $[30] !== t7 || $[31] !== testID) {
|
|
308
312
|
t13 = <Pressable testID={testID} accessibilityRole="tab" accessibilityState={t2} accessibilityLabel={accessibilityLabel} onPress={onPress} onPressIn={t3} onPressOut={t4} className="min-h-12 min-w-12 flex-1 items-center justify-center gap-1" style={t6}>{t7}{t12}</Pressable>;
|
|
309
|
-
$[
|
|
310
|
-
$[
|
|
311
|
-
$[
|
|
312
|
-
$[
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
313
|
+
$[23] = accessibilityLabel;
|
|
314
|
+
$[24] = onPress;
|
|
315
|
+
$[25] = press.onPressIn;
|
|
316
|
+
$[26] = press.onPressOut;
|
|
317
|
+
$[27] = t12;
|
|
318
|
+
$[28] = t2;
|
|
319
|
+
$[29] = t6;
|
|
320
|
+
$[30] = t7;
|
|
321
|
+
$[31] = testID;
|
|
322
|
+
$[32] = t13;
|
|
319
323
|
} else {
|
|
320
|
-
t13 = $[
|
|
324
|
+
t13 = $[32];
|
|
321
325
|
}
|
|
322
326
|
return t13;
|
|
323
327
|
}
|
package/dist/ai/conversation.jsx
CHANGED
|
@@ -399,7 +399,7 @@ export function ConversationList({
|
|
|
399
399
|
// only if the element takes a `style`: draw it the right way up instead.
|
|
400
400
|
if (inverted && !hasRows) {
|
|
401
401
|
const Empty = props.ListEmptyComponent;
|
|
402
|
-
return <View style={styles.fill}>{isValidElement(Empty) ? Empty : Empty ? <Empty /> : null}</View>;
|
|
402
|
+
return <View style={styles.fill}>{isValidElement(Empty) ? Empty : typeof Empty === "function" ? <Empty /> : null}</View>;
|
|
403
403
|
}
|
|
404
404
|
// The newest message's offset: inverted, 0 less the space before it.
|
|
405
405
|
const end = () => inverted ? size.current.inset > 0 ? -size.current.inset : 0 : Math.max(0, size.current.content + size.current.inset - size.current.view);
|
package/dist/blur.js
CHANGED
package/dist/controlStyles.js
CHANGED
|
@@ -12,8 +12,15 @@ import { tokens } from "./tokens";
|
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* `primary` and `default` are the same (`default` is the web name). `outline`
|
|
15
|
-
* is the web bordered neutral button. `
|
|
16
|
-
*
|
|
15
|
+
* is the web bordered neutral button. `tertiary` is the web name for `ghost`
|
|
16
|
+
* and `danger` for `destructive`. `success`, `warning` and `flat` match the web
|
|
17
|
+
* variants. `tinted` is a legacy alias: the pink tint that `outline` drew
|
|
18
|
+
* before 0.3.0 (it keeps its NativeWind classes).
|
|
19
|
+
*
|
|
20
|
+
* Hierarchy: `primary`/`default` is the one main action, `secondary` an
|
|
21
|
+
* alternative, `tertiary`/`ghost` a dismissive action, `destructive`/`danger`
|
|
22
|
+
* a destructive action, `success` and `warning` show status, and `outline`,
|
|
23
|
+
* `link` and `flat` are visual.
|
|
17
24
|
*/
|
|
18
25
|
|
|
19
26
|
/**
|
|
@@ -37,17 +44,32 @@ export function buttonColors(variant, scheme) {
|
|
|
37
44
|
color: tokens.color.foreground[scheme]
|
|
38
45
|
};
|
|
39
46
|
case "destructive":
|
|
47
|
+
case "danger":
|
|
40
48
|
return {
|
|
41
49
|
backgroundColor: palette.destructive,
|
|
42
50
|
borderColor: none,
|
|
43
51
|
color: tokens.color.white
|
|
44
52
|
};
|
|
45
53
|
case "ghost":
|
|
54
|
+
case "tertiary":
|
|
55
|
+
case "flat":
|
|
46
56
|
return {
|
|
47
57
|
backgroundColor: none,
|
|
48
58
|
borderColor: none,
|
|
49
59
|
color: tokens.color.muted[scheme]
|
|
50
60
|
};
|
|
61
|
+
case "success":
|
|
62
|
+
return {
|
|
63
|
+
backgroundColor: palette.success[scheme],
|
|
64
|
+
borderColor: none,
|
|
65
|
+
color: palette.successForeground[scheme]
|
|
66
|
+
};
|
|
67
|
+
case "warning":
|
|
68
|
+
return {
|
|
69
|
+
backgroundColor: palette.warning[scheme],
|
|
70
|
+
borderColor: none,
|
|
71
|
+
color: palette.warningForeground[scheme]
|
|
72
|
+
};
|
|
51
73
|
case "link":
|
|
52
74
|
return {
|
|
53
75
|
backgroundColor: none,
|
package/dist/entries/layout.js
CHANGED
|
@@ -10,6 +10,7 @@ export { SettingsField } from "../settings/SettingsField";
|
|
|
10
10
|
export { SettingsToggleRow } from "../settings/SettingsToggleRow";
|
|
11
11
|
export { SettingsStack } from "../settings/SettingsStack";
|
|
12
12
|
export { SettingsEmptyState } from "../settings/SettingsEmptyState";
|
|
13
|
+
export { ThemeModePicker, THEME_MODES } from "../settings/ThemeModePicker";
|
|
13
14
|
export { PinnedBotTile, BotPinGrid } from "../PinnedBotTile";
|
|
14
15
|
export { ArtifactList } from "../ArtifactList";
|
|
15
16
|
export { MoreFromProjectV, FromProjectV } from "../settings/MoreFromProjectV";
|
|
@@ -9,6 +9,7 @@ export { SearchInput } from "../SearchInput";
|
|
|
9
9
|
export { PasswordInput } from "../PasswordInput";
|
|
10
10
|
export { Textarea } from "../Textarea";
|
|
11
11
|
export { Label } from "../Label";
|
|
12
|
+
export { Field, FieldControl, FieldDescription, FieldError, FieldLabel } from "../Field";
|
|
12
13
|
export { Select } from "../Select";
|
|
13
14
|
export { Switch } from "../Switch";
|
|
14
15
|
export { LabeledSwitchRow } from "../LabeledSwitchRow";
|