@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.
@@ -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` (React Navigation's `BottomTabBarProps`, Expo SDK 57). Declared
31
- * here so the tab bar does not import `expo-router`.
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(40);
46
+ const $ = _c(42);
46
47
  const {
47
48
  state,
48
49
  descriptors,
49
- navigation
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] !== largerText || $[20] !== navigation || $[21] !== scheme || $[22] !== state.index || $[23] !== state.routes) {
129
+ if ($[18] !== descriptors || $[19] !== emitter || $[20] !== largerText || $[21] !== navigateToTab || $[22] !== scheme || $[23] !== state.index || $[24] !== state.routes) {
128
130
  let t7;
129
- if ($[25] !== descriptors || $[26] !== largerText || $[27] !== navigation || $[28] !== scheme || $[29] !== state.index) {
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} navigation={navigation} focused={focused} label={label} color={color} largerText={largerText} renderIcon={options.tabBarIcon} testID={options.tabBarButtonTestID} accessibilityLabel={options.tabBarAccessibilityLabel ?? label} />;
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
- $[25] = descriptors;
141
- $[26] = largerText;
142
- $[27] = navigation;
143
- $[28] = scheme;
144
- $[29] = state.index;
145
- $[30] = t7;
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 = $[30];
150
+ t7 = $[32];
148
151
  }
149
152
  t6 = state.routes.map(t7);
150
153
  $[18] = descriptors;
151
- $[19] = largerText;
152
- $[20] = navigation;
153
- $[21] = scheme;
154
- $[22] = state.index;
155
- $[23] = state.routes;
156
- $[24] = t6;
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 = $[24];
162
+ t6 = $[25];
159
163
  }
160
164
  let t7;
161
- if ($[31] !== t5 || $[32] !== t6) {
165
+ if ($[33] !== t5 || $[34] !== t6) {
162
166
  t7 = <View className="flex-row items-center justify-around" style={t5} accessibilityRole="tablist">{t6}</View>;
163
- $[31] = t5;
164
- $[32] = t6;
165
- $[33] = t7;
167
+ $[33] = t5;
168
+ $[34] = t6;
169
+ $[35] = t7;
166
170
  } else {
167
- t7 = $[33];
171
+ t7 = $[35];
168
172
  }
169
173
  let t8;
170
- if ($[34] !== t4 || $[35] !== t7) {
174
+ if ($[36] !== t4 || $[37] !== t7) {
171
175
  t8 = <FloatingSurface radius={FLOATING_PILL_RADIUS}>{t4}{t7}</FloatingSurface>;
172
- $[34] = t4;
173
- $[35] = t7;
174
- $[36] = t8;
176
+ $[36] = t4;
177
+ $[37] = t7;
178
+ $[38] = t8;
175
179
  } else {
176
- t8 = $[36];
180
+ t8 = $[38];
177
181
  }
178
182
  let t9;
179
- if ($[37] !== t3 || $[38] !== t8) {
183
+ if ($[39] !== t3 || $[40] !== t8) {
180
184
  t9 = <View pointerEvents="box-none" style={t3}>{t8}</View>;
181
- $[37] = t3;
182
- $[38] = t8;
183
- $[39] = t9;
185
+ $[39] = t3;
186
+ $[40] = t8;
187
+ $[41] = t9;
184
188
  } else {
185
- t9 = $[39];
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 `navigation` keep their identity, and `tabBarIcon` is
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(34);
200
+ const $ = _c(33);
197
201
  const {
198
202
  route,
199
- navigation,
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] !== focused || $[1] !== navigation || $[2] !== route.key || $[3] !== route.name || $[4] !== route.params) {
215
+ if ($[0] !== emitter || $[1] !== focused || $[2] !== navigateToTab || $[3] !== route.key) {
211
216
  t1 = () => {
212
- const event = navigation.emit({
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
- navigation.navigate(route.name, route.params);
224
+ navigateToTab(route.key);
220
225
  }
221
226
  };
222
- $[0] = focused;
223
- $[1] = navigation;
224
- $[2] = route.key;
225
- $[3] = route.name;
226
- $[4] = route.params;
227
- $[5] = t1;
227
+ $[0] = emitter;
228
+ $[1] = focused;
229
+ $[2] = navigateToTab;
230
+ $[3] = route.key;
231
+ $[4] = t1;
228
232
  } else {
229
- t1 = $[5];
233
+ t1 = $[4];
230
234
  }
231
235
  const onPress = t1;
232
236
  let t2;
233
- if ($[6] !== focused) {
237
+ if ($[5] !== focused) {
234
238
  t2 = {
235
239
  selected: focused
236
240
  };
237
- $[6] = focused;
238
- $[7] = t2;
241
+ $[5] = focused;
242
+ $[6] = t2;
239
243
  } else {
240
- t2 = $[7];
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 ($[8] !== t5) {
250
+ if ($[7] !== t5) {
247
251
  t6 = {
248
252
  opacity: t5
249
253
  };
250
- $[8] = t5;
251
- $[9] = t6;
254
+ $[7] = t5;
255
+ $[8] = t6;
252
256
  } else {
253
- t6 = $[9];
257
+ t6 = $[8];
254
258
  }
255
259
  let t7;
256
- if ($[10] !== color || $[11] !== focused || $[12] !== largerText || $[13] !== renderIcon) {
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
- $[10] = color;
263
- $[11] = focused;
264
- $[12] = largerText;
265
- $[13] = renderIcon;
266
- $[14] = t7;
266
+ $[9] = color;
267
+ $[10] = focused;
268
+ $[11] = largerText;
269
+ $[12] = renderIcon;
270
+ $[13] = t7;
267
271
  } else {
268
- t7 = $[14];
272
+ t7 = $[13];
269
273
  }
270
274
  const t8 = `font-instrument-sans-semibold ${largerText ? "text-base" : "text-sm"}`;
271
275
  let t9;
272
- if ($[15] !== color) {
276
+ if ($[14] !== color) {
273
277
  t9 = {
274
278
  color
275
279
  };
276
- $[15] = color;
277
- $[16] = t9;
280
+ $[14] = color;
281
+ $[15] = t9;
278
282
  } else {
279
- t9 = $[16];
283
+ t9 = $[15];
280
284
  }
281
285
  let t10;
282
- if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
286
+ if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
283
287
  t10 = typeStyle("semibold");
284
- $[17] = t10;
288
+ $[16] = t10;
285
289
  } else {
286
- t10 = $[17];
290
+ t10 = $[16];
287
291
  }
288
292
  let t11;
289
- if ($[18] !== t9) {
293
+ if ($[17] !== t9) {
290
294
  t11 = [t9, t10];
291
- $[18] = t9;
292
- $[19] = t11;
295
+ $[17] = t9;
296
+ $[18] = t11;
293
297
  } else {
294
- t11 = $[19];
298
+ t11 = $[18];
295
299
  }
296
300
  let t12;
297
- if ($[20] !== label || $[21] !== t11 || $[22] !== t8) {
301
+ if ($[19] !== label || $[20] !== t11 || $[21] !== t8) {
298
302
  t12 = <Text numberOfLines={1} maxFontSizeMultiplier={1.5} className={t8} style={t11}>{label}</Text>;
299
- $[20] = label;
300
- $[21] = t11;
301
- $[22] = t8;
302
- $[23] = t12;
303
+ $[19] = label;
304
+ $[20] = t11;
305
+ $[21] = t8;
306
+ $[22] = t12;
303
307
  } else {
304
- t12 = $[23];
308
+ t12 = $[22];
305
309
  }
306
310
  let t13;
307
- if ($[24] !== accessibilityLabel || $[25] !== onPress || $[26] !== press.onPressIn || $[27] !== press.onPressOut || $[28] !== t12 || $[29] !== t2 || $[30] !== t6 || $[31] !== t7 || $[32] !== testID) {
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
- $[24] = accessibilityLabel;
310
- $[25] = onPress;
311
- $[26] = press.onPressIn;
312
- $[27] = press.onPressOut;
313
- $[28] = t12;
314
- $[29] = t2;
315
- $[30] = t6;
316
- $[31] = t7;
317
- $[32] = testID;
318
- $[33] = t13;
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 = $[33];
324
+ t13 = $[32];
321
325
  }
322
326
  return t13;
323
327
  }
@@ -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
@@ -1,3 +1,9 @@
1
+ /**
2
+ * The ref an expo-blur `BlurView` blurs (its `blurTarget` prop, and the ref a
3
+ * `BlurTargetView` takes). Derived from expo-blur's own type so the two match
4
+ * under any React Native version.
5
+ */
6
+
1
7
  let expoBlur;
2
8
 
3
9
  /**
@@ -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. `tinted` is the pink tint that `outline`
16
- * drew before 0.3.0.
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,
@@ -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";