@vvedantb/native-ui 0.25.1 → 0.25.3
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/FloatingTabBar.jsx +66 -56
- package/dist/SheetRow.jsx +102 -101
- package/dist/ai/conversation-context.js +27 -0
- package/dist/ai/conversation.jsx +62 -52
- package/dist/ai/message-context-menu.jsx +408 -330
- package/dist/ai/message.jsx +94 -75
- package/dist/ai/sources.jsx +37 -37
- package/dist/ai/suggestion.jsx +42 -40
- package/dist/primitives/keyboard-controller.jsx +32 -26
- package/dist/usePressed.js +38 -0
- package/package.json +3 -3
- package/src/FloatingTabBar.tsx +5 -1
- package/src/SheetRow.tsx +7 -3
- package/src/ai/conversation-context.ts +56 -0
- package/src/ai/conversation.tsx +12 -42
- package/src/ai/message-context-menu.tsx +76 -31
- package/src/ai/message.tsx +15 -5
- package/src/ai/sources.tsx +7 -3
- package/src/ai/suggestion.tsx +7 -3
- package/src/primitives/keyboard-controller.tsx +3 -0
- package/src/primitives/keyboard-parts.tsx +3 -1
- package/src/usePressed.ts +13 -0
package/dist/ai/message.jsx
CHANGED
|
@@ -14,8 +14,10 @@ import { useScheme } from "../useScheme";
|
|
|
14
14
|
import { META_TEXT_STYLE, chatTextSize } from "./chat-text";
|
|
15
15
|
import { ChatIconButton } from "./icon-button";
|
|
16
16
|
import { MESSAGE_ACTIONS_TITLE, MessageActionSheet } from "./message-action-sheet";
|
|
17
|
+
import { useOptionalConversation } from "./conversation-context";
|
|
17
18
|
import { MessageContextMenu } from "./message-context-menu";
|
|
18
19
|
import { ChatTextColorContext, ResponseText } from "./response-text";
|
|
20
|
+
import { usePressed } from "../usePressed";
|
|
19
21
|
const MessageContext = createContext("assistant");
|
|
20
22
|
|
|
21
23
|
/** The bot behind an incoming message in a group chat. */
|
|
@@ -123,7 +125,7 @@ const HELD_STYLE = {
|
|
|
123
125
|
opacity: 0.9
|
|
124
126
|
};
|
|
125
127
|
export function Message(t0) {
|
|
126
|
-
const $ = _c(
|
|
128
|
+
const $ = _c(57);
|
|
127
129
|
let actionSheetTitle;
|
|
128
130
|
let actions;
|
|
129
131
|
let bot;
|
|
@@ -177,18 +179,20 @@ export function Message(t0) {
|
|
|
177
179
|
const highlighted = t1 === undefined ? false : t1;
|
|
178
180
|
const user = from === "user";
|
|
179
181
|
const [sheetOpen, setSheetOpen] = useState(false);
|
|
180
|
-
const
|
|
182
|
+
const press = usePressed();
|
|
181
183
|
const [held, setHeld] = useState(null);
|
|
182
184
|
const pressable = useRef(null);
|
|
183
185
|
const hasActions = actions != null && actions.length > 0;
|
|
184
186
|
const longPressable = onLongPress != null || hasActions || menu != null;
|
|
187
|
+
const conversation = useOptionalConversation();
|
|
185
188
|
let t2;
|
|
186
|
-
if ($[12] !==
|
|
189
|
+
if ($[12] !== conversation || $[13] !== hasActions || $[14] !== menu || $[15] !== onLongPress) {
|
|
187
190
|
t2 = () => {
|
|
188
191
|
impactHaptic("medium");
|
|
189
192
|
onLongPress?.();
|
|
190
193
|
if (menu) {
|
|
191
194
|
const built = menu();
|
|
195
|
+
conversation?.openOverlay();
|
|
192
196
|
pressable.current?.measureInWindow((x, y, width, height) => setHeld({
|
|
193
197
|
anchor: {
|
|
194
198
|
x,
|
|
@@ -204,119 +208,134 @@ export function Message(t0) {
|
|
|
204
208
|
}
|
|
205
209
|
}
|
|
206
210
|
};
|
|
207
|
-
$[12] =
|
|
208
|
-
$[13] =
|
|
209
|
-
$[14] =
|
|
210
|
-
$[15] =
|
|
211
|
+
$[12] = conversation;
|
|
212
|
+
$[13] = hasActions;
|
|
213
|
+
$[14] = menu;
|
|
214
|
+
$[15] = onLongPress;
|
|
215
|
+
$[16] = t2;
|
|
211
216
|
} else {
|
|
212
|
-
t2 = $[
|
|
217
|
+
t2 = $[16];
|
|
213
218
|
}
|
|
214
219
|
const longPress = t2;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
alignSelf: t3,
|
|
221
|
-
alignItems: t4
|
|
220
|
+
let t3;
|
|
221
|
+
if ($[17] !== conversation) {
|
|
222
|
+
t3 = () => {
|
|
223
|
+
setHeld(null);
|
|
224
|
+
conversation?.closeOverlay();
|
|
222
225
|
};
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[18] = t5;
|
|
226
|
+
$[17] = conversation;
|
|
227
|
+
$[18] = t3;
|
|
226
228
|
} else {
|
|
227
|
-
|
|
229
|
+
t3 = $[18];
|
|
228
230
|
}
|
|
231
|
+
const closeMenu = t3;
|
|
232
|
+
const t4 = user ? "flex-end" : "flex-start";
|
|
233
|
+
const t5 = user ? "flex-end" : "stretch";
|
|
229
234
|
let t6;
|
|
230
|
-
if ($[19] !==
|
|
231
|
-
t6 =
|
|
232
|
-
|
|
235
|
+
if ($[19] !== t4 || $[20] !== t5) {
|
|
236
|
+
t6 = {
|
|
237
|
+
alignSelf: t4,
|
|
238
|
+
alignItems: t5
|
|
239
|
+
};
|
|
240
|
+
$[19] = t4;
|
|
233
241
|
$[20] = t5;
|
|
234
242
|
$[21] = t6;
|
|
235
243
|
} else {
|
|
236
244
|
t6 = $[21];
|
|
237
245
|
}
|
|
238
|
-
const layout = t6;
|
|
239
246
|
let t7;
|
|
240
|
-
if ($[22] !==
|
|
241
|
-
t7 =
|
|
242
|
-
$[22] =
|
|
243
|
-
$[23] =
|
|
247
|
+
if ($[22] !== style || $[23] !== t6) {
|
|
248
|
+
t7 = [t6, style];
|
|
249
|
+
$[22] = style;
|
|
250
|
+
$[23] = t6;
|
|
251
|
+
$[24] = t7;
|
|
244
252
|
} else {
|
|
245
|
-
t7 = $[
|
|
253
|
+
t7 = $[24];
|
|
246
254
|
}
|
|
247
|
-
const
|
|
255
|
+
const layout = t7;
|
|
248
256
|
let t8;
|
|
249
|
-
if ($[
|
|
250
|
-
t8 =
|
|
251
|
-
$[
|
|
252
|
-
$[25] = user;
|
|
257
|
+
if ($[25] !== className) {
|
|
258
|
+
t8 = cn("w-full max-w-[95%] gap-2", className);
|
|
259
|
+
$[25] = className;
|
|
253
260
|
$[26] = t8;
|
|
254
261
|
} else {
|
|
255
262
|
t8 = $[26];
|
|
256
263
|
}
|
|
264
|
+
const merged = t8;
|
|
257
265
|
let t9;
|
|
258
|
-
if ($[27] !==
|
|
259
|
-
t9 =
|
|
260
|
-
$[27] =
|
|
261
|
-
$[28] =
|
|
266
|
+
if ($[27] !== bot || $[28] !== user) {
|
|
267
|
+
t9 = bot && !user ? <MessageBotLabel name={bot.name} avatar={bot.avatar} /> : null;
|
|
268
|
+
$[27] = bot;
|
|
269
|
+
$[28] = user;
|
|
270
|
+
$[29] = t9;
|
|
262
271
|
} else {
|
|
263
|
-
t9 = $[
|
|
272
|
+
t9 = $[29];
|
|
264
273
|
}
|
|
265
274
|
let t10;
|
|
266
|
-
if ($[
|
|
267
|
-
t10 =
|
|
268
|
-
$[
|
|
269
|
-
$[
|
|
270
|
-
$[31] = t9;
|
|
271
|
-
$[32] = t10;
|
|
275
|
+
if ($[30] !== highlighted) {
|
|
276
|
+
t10 = highlighted ? <MessageHighlight /> : null;
|
|
277
|
+
$[30] = highlighted;
|
|
278
|
+
$[31] = t10;
|
|
272
279
|
} else {
|
|
273
|
-
t10 = $[
|
|
280
|
+
t10 = $[31];
|
|
274
281
|
}
|
|
275
|
-
const parts = t10;
|
|
276
282
|
let t11;
|
|
277
|
-
if ($[
|
|
278
|
-
t11 =
|
|
283
|
+
if ($[32] !== children || $[33] !== t10 || $[34] !== t9) {
|
|
284
|
+
t11 = <>{t9}{children}{t10}</>;
|
|
285
|
+
$[32] = children;
|
|
286
|
+
$[33] = t10;
|
|
287
|
+
$[34] = t9;
|
|
288
|
+
$[35] = t11;
|
|
289
|
+
} else {
|
|
290
|
+
t11 = $[35];
|
|
291
|
+
}
|
|
292
|
+
const parts = t11;
|
|
293
|
+
let t12;
|
|
294
|
+
if ($[36] !== actionSheetTitle || $[37] !== actions || $[38] !== closeMenu || $[39] !== conversation?.settleOverlay || $[40] !== from || $[41] !== hasActions || $[42] !== held || $[43] !== layout || $[44] !== longPress || $[45] !== longPressable || $[46] !== menu || $[47] !== merged || $[48] !== parts || $[49] !== press || $[50] !== props || $[51] !== sheetOpen || $[52] !== user) {
|
|
295
|
+
t12 = longPressable ? <><Pressable ref={pressable} accessible={false} className={merged} style={[layout, press.pressed ? HELD_STYLE : null]} onPressIn={press.onPressIn} onPressOut={press.onPressOut} onLongPress={longPress} delayLongPress={HOLD_DELAY_MS} accessibilityActions={[{
|
|
279
296
|
name: "longpress",
|
|
280
297
|
label: actionSheetTitle ?? MESSAGE_ACTIONS_TITLE
|
|
281
298
|
}]} onAccessibilityAction={event => {
|
|
282
299
|
if (event.nativeEvent.actionName === "longpress") {
|
|
283
300
|
longPress();
|
|
284
301
|
}
|
|
285
|
-
}} {...props}>{parts}</Pressable>{menu ? <MessageContextMenu open={held !== null} onClose={
|
|
302
|
+
}} {...props}>{parts}</Pressable>{menu ? <MessageContextMenu open={held !== null} onClose={closeMenu} onDismissed={conversation?.settleOverlay} anchor={held?.anchor ?? null} align={user ? "end" : "start"} preview={<MessageContext.Provider value={from}><View className={merged} style={[layout, {
|
|
286
303
|
maxWidth: "100%",
|
|
287
304
|
width: "100%"
|
|
288
305
|
}]}>{parts}</View></MessageContext.Provider>} menu={held?.menu ?? {
|
|
289
306
|
actions: []
|
|
290
307
|
}} /> : hasActions ? <MessageActionSheet open={sheetOpen} onClose={() => setSheetOpen(false)} actions={actions} title={actionSheetTitle} /> : null}</> : <View className={merged} style={layout} {...props}>{parts}</View>;
|
|
291
|
-
$[
|
|
292
|
-
$[
|
|
293
|
-
$[
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
$[
|
|
306
|
-
$[
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
$[36] = actionSheetTitle;
|
|
309
|
+
$[37] = actions;
|
|
310
|
+
$[38] = closeMenu;
|
|
311
|
+
$[39] = conversation?.settleOverlay;
|
|
312
|
+
$[40] = from;
|
|
313
|
+
$[41] = hasActions;
|
|
314
|
+
$[42] = held;
|
|
315
|
+
$[43] = layout;
|
|
316
|
+
$[44] = longPress;
|
|
317
|
+
$[45] = longPressable;
|
|
318
|
+
$[46] = menu;
|
|
319
|
+
$[47] = merged;
|
|
320
|
+
$[48] = parts;
|
|
321
|
+
$[49] = press;
|
|
322
|
+
$[50] = props;
|
|
323
|
+
$[51] = sheetOpen;
|
|
324
|
+
$[52] = user;
|
|
325
|
+
$[53] = t12;
|
|
326
|
+
} else {
|
|
327
|
+
t12 = $[53];
|
|
309
328
|
}
|
|
310
|
-
let
|
|
311
|
-
if ($[
|
|
312
|
-
|
|
313
|
-
$[
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
329
|
+
let t13;
|
|
330
|
+
if ($[54] !== from || $[55] !== t12) {
|
|
331
|
+
t13 = <MessageContext.Provider value={from}>{t12}</MessageContext.Provider>;
|
|
332
|
+
$[54] = from;
|
|
333
|
+
$[55] = t12;
|
|
334
|
+
$[56] = t13;
|
|
316
335
|
} else {
|
|
317
|
-
|
|
336
|
+
t13 = $[56];
|
|
318
337
|
}
|
|
319
|
-
return
|
|
338
|
+
return t13;
|
|
320
339
|
}
|
|
321
340
|
|
|
322
341
|
/**
|
package/dist/ai/sources.jsx
CHANGED
|
@@ -8,6 +8,7 @@ import { tokens } from "../tokens";
|
|
|
8
8
|
import { useScheme } from "../useScheme";
|
|
9
9
|
import { Collapsible, CollapsibleChevron, CollapsibleContent, CollapsibleTrigger, useCollapsible } from "./collapsible";
|
|
10
10
|
import { ResponseText } from "./response-text";
|
|
11
|
+
import { usePressed } from "../usePressed";
|
|
11
12
|
|
|
12
13
|
/** The sources a reply used, folded (default closed). */
|
|
13
14
|
export function Sources(t0) {
|
|
@@ -182,13 +183,14 @@ const ROW_HEIGHT = 36;
|
|
|
182
183
|
* Pressed, it takes the web hover fill (`bg-surface-secondary`).
|
|
183
184
|
*/
|
|
184
185
|
export function Source(t0) {
|
|
185
|
-
const $ = _c(
|
|
186
|
+
const $ = _c(20);
|
|
186
187
|
const {
|
|
187
188
|
href,
|
|
188
189
|
title,
|
|
189
190
|
onPress,
|
|
190
191
|
testID
|
|
191
192
|
} = t0;
|
|
193
|
+
const press = usePressed();
|
|
192
194
|
const scheme = useScheme();
|
|
193
195
|
const largerText = useLargerText();
|
|
194
196
|
const label = title ?? href;
|
|
@@ -208,53 +210,51 @@ export function Source(t0) {
|
|
|
208
210
|
} else {
|
|
209
211
|
t2 = $[3];
|
|
210
212
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
return {
|
|
218
|
-
borderRadius: tokens.radius.md,
|
|
219
|
-
backgroundColor: pressed ? tokens.color.surfaceSecondary[scheme] : "transparent"
|
|
220
|
-
};
|
|
213
|
+
const t3 = press.pressed ? tokens.color.surfaceSecondary[scheme] : "transparent";
|
|
214
|
+
let t4;
|
|
215
|
+
if ($[4] !== t3) {
|
|
216
|
+
t4 = {
|
|
217
|
+
borderRadius: tokens.radius.md,
|
|
218
|
+
backgroundColor: t3
|
|
221
219
|
};
|
|
222
|
-
$[4] =
|
|
223
|
-
$[5] =
|
|
220
|
+
$[4] = t3;
|
|
221
|
+
$[5] = t4;
|
|
224
222
|
} else {
|
|
225
|
-
|
|
223
|
+
t4 = $[5];
|
|
226
224
|
}
|
|
227
|
-
let
|
|
225
|
+
let t5;
|
|
228
226
|
if ($[6] !== label) {
|
|
229
|
-
|
|
227
|
+
t5 = <ResponseText size="small" tone="muted" selectable={false} numberOfLines={1} className="shrink">{label}</ResponseText>;
|
|
230
228
|
$[6] = label;
|
|
231
|
-
$[7] =
|
|
229
|
+
$[7] = t5;
|
|
232
230
|
} else {
|
|
233
|
-
|
|
231
|
+
t5 = $[7];
|
|
234
232
|
}
|
|
235
|
-
const
|
|
236
|
-
const
|
|
237
|
-
let
|
|
238
|
-
if ($[8] !==
|
|
239
|
-
|
|
240
|
-
$[8] =
|
|
241
|
-
$[9] =
|
|
242
|
-
$[10] =
|
|
233
|
+
const t6 = largerText ? 18 : 14;
|
|
234
|
+
const t7 = tokens.color.muted[scheme];
|
|
235
|
+
let t8;
|
|
236
|
+
if ($[8] !== t6 || $[9] !== t7) {
|
|
237
|
+
t8 = <IconBook size={t6} color={t7} strokeWidth={1.5} />;
|
|
238
|
+
$[8] = t6;
|
|
239
|
+
$[9] = t7;
|
|
240
|
+
$[10] = t8;
|
|
243
241
|
} else {
|
|
244
|
-
|
|
242
|
+
t8 = $[10];
|
|
245
243
|
}
|
|
246
|
-
let
|
|
247
|
-
if ($[11] !== label || $[12] !==
|
|
248
|
-
|
|
244
|
+
let t9;
|
|
245
|
+
if ($[11] !== label || $[12] !== press.onPressIn || $[13] !== press.onPressOut || $[14] !== t2 || $[15] !== t4 || $[16] !== t5 || $[17] !== t8 || $[18] !== testID) {
|
|
246
|
+
t9 = <Pressable testID={testID} accessibilityRole="link" accessibilityLabel={label} hitSlop={t1} onPress={t2} onPressIn={press.onPressIn} onPressOut={press.onPressOut} className="flex-row items-center justify-between gap-2 px-3 py-2" style={t4}>{t5}{t8}</Pressable>;
|
|
249
247
|
$[11] = label;
|
|
250
|
-
$[12] =
|
|
251
|
-
$[13] =
|
|
252
|
-
$[14] =
|
|
253
|
-
$[15] =
|
|
254
|
-
$[16] =
|
|
248
|
+
$[12] = press.onPressIn;
|
|
249
|
+
$[13] = press.onPressOut;
|
|
250
|
+
$[14] = t2;
|
|
251
|
+
$[15] = t4;
|
|
252
|
+
$[16] = t5;
|
|
255
253
|
$[17] = t8;
|
|
254
|
+
$[18] = testID;
|
|
255
|
+
$[19] = t9;
|
|
256
256
|
} else {
|
|
257
|
-
|
|
257
|
+
t9 = $[19];
|
|
258
258
|
}
|
|
259
|
-
return
|
|
259
|
+
return t9;
|
|
260
260
|
}
|
package/dist/ai/suggestion.jsx
CHANGED
|
@@ -7,6 +7,7 @@ import { useLargerText } from "../theme";
|
|
|
7
7
|
import { tokens } from "../tokens";
|
|
8
8
|
import { useScheme } from "../useScheme";
|
|
9
9
|
import { chatTextSize } from "./chat-text";
|
|
10
|
+
import { usePressed } from "../usePressed";
|
|
10
11
|
/**
|
|
11
12
|
* Prompt suggestions. Horizontal is a `ScrollView` with no scroll bar (the web
|
|
12
13
|
* row with its scroll arrows; a phone swipes instead).
|
|
@@ -77,7 +78,7 @@ const CHIP_HEIGHT = 32;
|
|
|
77
78
|
* it takes the web hover (`bg-surface-tertiary text-foreground`).
|
|
78
79
|
*/
|
|
79
80
|
export function Suggestion(t0) {
|
|
80
|
-
const $ = _c(
|
|
81
|
+
const $ = _c(30);
|
|
81
82
|
const {
|
|
82
83
|
suggestion,
|
|
83
84
|
onPress,
|
|
@@ -85,6 +86,7 @@ export function Suggestion(t0) {
|
|
|
85
86
|
disabled,
|
|
86
87
|
testID
|
|
87
88
|
} = t0;
|
|
89
|
+
const press = usePressed();
|
|
88
90
|
const scheme = useScheme();
|
|
89
91
|
const largerText = useLargerText();
|
|
90
92
|
let t1;
|
|
@@ -134,53 +136,53 @@ export function Suggestion(t0) {
|
|
|
134
136
|
} else {
|
|
135
137
|
t8 = $[10];
|
|
136
138
|
}
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
borderColor: tokens.color.border[scheme],
|
|
146
|
-
backgroundColor: pressed ? palette.surfaceTertiary[scheme] : tokens.color.surfaceSecondary[scheme]
|
|
147
|
-
};
|
|
139
|
+
const t9 = tokens.color.border[scheme];
|
|
140
|
+
const t10 = press.pressed ? palette.surfaceTertiary[scheme] : tokens.color.surfaceSecondary[scheme];
|
|
141
|
+
let t11;
|
|
142
|
+
if ($[11] !== t10 || $[12] !== t9) {
|
|
143
|
+
t11 = {
|
|
144
|
+
borderRadius: tokens.radius.pill,
|
|
145
|
+
borderColor: t9,
|
|
146
|
+
backgroundColor: t10
|
|
148
147
|
};
|
|
149
|
-
$[11] =
|
|
148
|
+
$[11] = t10;
|
|
150
149
|
$[12] = t9;
|
|
150
|
+
$[13] = t11;
|
|
151
151
|
} else {
|
|
152
|
-
|
|
152
|
+
t11 = $[13];
|
|
153
153
|
}
|
|
154
|
-
let
|
|
155
|
-
if ($[
|
|
156
|
-
|
|
154
|
+
let t12;
|
|
155
|
+
if ($[14] !== children || $[15] !== scheme || $[16] !== size || $[17] !== suggestion) {
|
|
156
|
+
t12 = t13 => {
|
|
157
157
|
const {
|
|
158
|
-
pressed
|
|
159
|
-
} =
|
|
160
|
-
return <Text className={cn(size, "font-instrument-sans")} style={[sizeStyle(size), textStyle(
|
|
158
|
+
pressed
|
|
159
|
+
} = t13;
|
|
160
|
+
return <Text className={cn(size, "font-instrument-sans")} style={[sizeStyle(size), textStyle(pressed ? "foreground" : "muted", scheme)]}>{children ?? suggestion}</Text>;
|
|
161
161
|
};
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
162
|
+
$[14] = children;
|
|
163
|
+
$[15] = scheme;
|
|
164
|
+
$[16] = size;
|
|
165
|
+
$[17] = suggestion;
|
|
166
|
+
$[18] = t12;
|
|
167
167
|
} else {
|
|
168
|
-
|
|
168
|
+
t12 = $[18];
|
|
169
169
|
}
|
|
170
|
-
let
|
|
171
|
-
if ($[
|
|
172
|
-
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
175
|
-
$[
|
|
176
|
-
$[
|
|
177
|
-
$[
|
|
178
|
-
$[
|
|
179
|
-
$[
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
170
|
+
let t13;
|
|
171
|
+
if ($[19] !== disabled || $[20] !== press.onPressIn || $[21] !== press.onPressOut || $[22] !== suggestion || $[23] !== t11 || $[24] !== t12 || $[25] !== t3 || $[26] !== t5 || $[27] !== t8 || $[28] !== testID) {
|
|
172
|
+
t13 = <Pressable testID={testID} accessibilityRole="button" accessibilityLabel={suggestion} accessibilityState={t3} disabled={disabled} hitSlop={t4} onPress={t5} className={t8} onPressIn={press.onPressIn} onPressOut={press.onPressOut} style={t11}>{t12}</Pressable>;
|
|
173
|
+
$[19] = disabled;
|
|
174
|
+
$[20] = press.onPressIn;
|
|
175
|
+
$[21] = press.onPressOut;
|
|
176
|
+
$[22] = suggestion;
|
|
177
|
+
$[23] = t11;
|
|
178
|
+
$[24] = t12;
|
|
179
|
+
$[25] = t3;
|
|
180
|
+
$[26] = t5;
|
|
181
|
+
$[27] = t8;
|
|
182
|
+
$[28] = testID;
|
|
183
|
+
$[29] = t13;
|
|
182
184
|
} else {
|
|
183
|
-
|
|
185
|
+
t13 = $[29];
|
|
184
186
|
}
|
|
185
|
-
return
|
|
187
|
+
return t13;
|
|
186
188
|
}
|
|
@@ -76,16 +76,18 @@ function StickyView(t0) {
|
|
|
76
76
|
* end on either platform.
|
|
77
77
|
*/
|
|
78
78
|
function ChatScrollView(t0) {
|
|
79
|
-
const $ = _c(
|
|
79
|
+
const $ = _c(19);
|
|
80
80
|
let bottomOffset;
|
|
81
81
|
let onInsetChange;
|
|
82
82
|
let onKeyboardMove;
|
|
83
83
|
let props;
|
|
84
84
|
let t1;
|
|
85
|
+
let t2;
|
|
85
86
|
if ($[0] !== t0) {
|
|
86
87
|
({
|
|
87
88
|
bottomOffset,
|
|
88
89
|
inverted: t1,
|
|
90
|
+
freeze: t2,
|
|
89
91
|
onInsetChange,
|
|
90
92
|
onKeyboardMove,
|
|
91
93
|
...props
|
|
@@ -96,18 +98,21 @@ function ChatScrollView(t0) {
|
|
|
96
98
|
$[3] = onKeyboardMove;
|
|
97
99
|
$[4] = props;
|
|
98
100
|
$[5] = t1;
|
|
101
|
+
$[6] = t2;
|
|
99
102
|
} else {
|
|
100
103
|
bottomOffset = $[1];
|
|
101
104
|
onInsetChange = $[2];
|
|
102
105
|
onKeyboardMove = $[3];
|
|
103
106
|
props = $[4];
|
|
104
107
|
t1 = $[5];
|
|
108
|
+
t2 = $[6];
|
|
105
109
|
}
|
|
106
110
|
const inverted = t1 === undefined ? false : t1;
|
|
107
|
-
|
|
111
|
+
const freeze = t2 === undefined ? false : t2;
|
|
108
112
|
let t3;
|
|
109
|
-
|
|
110
|
-
|
|
113
|
+
let t4;
|
|
114
|
+
if ($[7] !== onKeyboardMove) {
|
|
115
|
+
t3 = {
|
|
111
116
|
onStart: () => {
|
|
112
117
|
"worklet";
|
|
113
118
|
|
|
@@ -119,36 +124,37 @@ function ChatScrollView(t0) {
|
|
|
119
124
|
runOnJS(onKeyboardMove)(false);
|
|
120
125
|
}
|
|
121
126
|
};
|
|
122
|
-
|
|
123
|
-
$[
|
|
124
|
-
$[7] = t2;
|
|
127
|
+
t4 = [onKeyboardMove];
|
|
128
|
+
$[7] = onKeyboardMove;
|
|
125
129
|
$[8] = t3;
|
|
130
|
+
$[9] = t4;
|
|
126
131
|
} else {
|
|
127
|
-
t2 = $[7];
|
|
128
132
|
t3 = $[8];
|
|
133
|
+
t4 = $[9];
|
|
129
134
|
}
|
|
130
|
-
useKeyboardHandler(
|
|
131
|
-
let
|
|
132
|
-
if ($[
|
|
133
|
-
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
135
|
+
useKeyboardHandler(t3, t4);
|
|
136
|
+
let t5;
|
|
137
|
+
if ($[10] !== inverted || $[11] !== onInsetChange) {
|
|
138
|
+
t5 = insets => onInsetChange(inverted ? Platform.OS === "ios" ? insets.top : 0 : insets.bottom);
|
|
139
|
+
$[10] = inverted;
|
|
140
|
+
$[11] = onInsetChange;
|
|
141
|
+
$[12] = t5;
|
|
137
142
|
} else {
|
|
138
|
-
|
|
143
|
+
t5 = $[12];
|
|
139
144
|
}
|
|
140
|
-
let
|
|
141
|
-
if ($[
|
|
142
|
-
|
|
143
|
-
$[
|
|
144
|
-
$[
|
|
145
|
-
$[
|
|
146
|
-
$[
|
|
147
|
-
$[
|
|
145
|
+
let t6;
|
|
146
|
+
if ($[13] !== bottomOffset || $[14] !== freeze || $[15] !== inverted || $[16] !== props || $[17] !== t5) {
|
|
147
|
+
t6 = <KeyboardChatScrollView {...props} inverted={inverted} freeze={freeze} offset={bottomOffset} keyboardLiftBehavior="always" onContentInsetChange={t5} />;
|
|
148
|
+
$[13] = bottomOffset;
|
|
149
|
+
$[14] = freeze;
|
|
150
|
+
$[15] = inverted;
|
|
151
|
+
$[16] = props;
|
|
152
|
+
$[17] = t5;
|
|
153
|
+
$[18] = t6;
|
|
148
154
|
} else {
|
|
149
|
-
|
|
155
|
+
t6 = $[18];
|
|
150
156
|
}
|
|
151
|
-
return
|
|
157
|
+
return t6;
|
|
152
158
|
}
|
|
153
159
|
|
|
154
160
|
/**
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Whether a `Pressable` is held down, as state, for a pressed look. With a
|
|
6
|
+
* `className`, NativeWind drops a `Pressable` style function (`({ pressed })
|
|
7
|
+
* => ...`), and with it the radius, border and fill it sets; so a pressable
|
|
8
|
+
* with classes reads `pressed` from here and passes a plain style. Spread
|
|
9
|
+
* `onPressIn` and `onPressOut` on the `Pressable`.
|
|
10
|
+
*/
|
|
11
|
+
export function usePressed() {
|
|
12
|
+
const $ = _c(4);
|
|
13
|
+
const [pressed, setPressed] = useState(false);
|
|
14
|
+
let t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
17
|
+
t0 = () => setPressed(true);
|
|
18
|
+
t1 = () => setPressed(false);
|
|
19
|
+
$[0] = t0;
|
|
20
|
+
$[1] = t1;
|
|
21
|
+
} else {
|
|
22
|
+
t0 = $[0];
|
|
23
|
+
t1 = $[1];
|
|
24
|
+
}
|
|
25
|
+
let t2;
|
|
26
|
+
if ($[2] !== pressed) {
|
|
27
|
+
t2 = {
|
|
28
|
+
pressed,
|
|
29
|
+
onPressIn: t0,
|
|
30
|
+
onPressOut: t1
|
|
31
|
+
};
|
|
32
|
+
$[2] = pressed;
|
|
33
|
+
$[3] = t2;
|
|
34
|
+
} else {
|
|
35
|
+
t2 = $[3];
|
|
36
|
+
}
|
|
37
|
+
return t2;
|
|
38
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vvedantb/native-ui",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Shared React Native / Expo UI primitives. Floating surfaces, forms, overlays, toasts, settings chrome, tab bar, AI chat parts, the family app marks, a NativeWind preset, the Expo web root and Clerk + Convex auth screens.",
|
|
6
6
|
"type": "module",
|
|
@@ -310,8 +310,8 @@
|
|
|
310
310
|
"check:exports": "node scripts/check-exports.mjs",
|
|
311
311
|
"check:hermes": "node scripts/check-hermes-compat.mjs",
|
|
312
312
|
"test": "vitest run",
|
|
313
|
-
"typecheck": "
|
|
314
|
-
"typecheck:consumer": "
|
|
313
|
+
"typecheck": "tsrs --noEmit --fast -p tsconfig.typecheck.json && pnpm run typecheck:consumer",
|
|
314
|
+
"typecheck:consumer": "tsrs --noEmit --fast -p tsconfig.consumer.json",
|
|
315
315
|
"build:baseline": "node scripts/build-dist.mjs --update"
|
|
316
316
|
}
|
|
317
317
|
}
|
package/src/FloatingTabBar.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import { useLargerText } from "./theme";
|
|
|
15
15
|
import { useReduceMotion } from "./useReduceMotion";
|
|
16
16
|
import { useScheme } from "./useScheme";
|
|
17
17
|
import { FLOATING_PILL_RADIUS, tabBarHeight, tabBarSlotStyle } from "./floating";
|
|
18
|
+
import { usePressed } from "./usePressed";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Space between the bar edge and the tabs, on every side of the active pill,
|
|
@@ -158,6 +159,7 @@ function TabBarItem({
|
|
|
158
159
|
testID,
|
|
159
160
|
accessibilityLabel,
|
|
160
161
|
}: TabBarItemProps) {
|
|
162
|
+
const press = usePressed();
|
|
161
163
|
const onPress = () => {
|
|
162
164
|
const event = navigation.emit({
|
|
163
165
|
type: "tabPress",
|
|
@@ -177,8 +179,10 @@ function TabBarItem({
|
|
|
177
179
|
accessibilityState={{ selected: focused }}
|
|
178
180
|
accessibilityLabel={accessibilityLabel}
|
|
179
181
|
onPress={onPress}
|
|
182
|
+
onPressIn={press.onPressIn}
|
|
183
|
+
onPressOut={press.onPressOut}
|
|
180
184
|
className="min-h-12 min-w-12 flex-1 items-center justify-center gap-1"
|
|
181
|
-
style={
|
|
185
|
+
style={{ opacity: press.pressed ? 0.7 : 1 }}
|
|
182
186
|
>
|
|
183
187
|
{renderIcon ? renderIcon({ focused, color, size: largerText ? 28 : 24 }) : null}
|
|
184
188
|
<Text
|