@vvedantb/native-ui 0.25.2 → 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/message-context-menu.jsx +59 -66
- package/dist/ai/message.jsx +5 -4
- package/dist/ai/sources.jsx +37 -37
- package/dist/ai/suggestion.jsx +42 -40
- 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/message-context-menu.tsx +6 -5
- package/src/ai/message.tsx +5 -4
- package/src/ai/sources.tsx +7 -3
- package/src/ai/suggestion.tsx +7 -3
- package/src/usePressed.ts +13 -0
package/dist/FloatingTabBar.jsx
CHANGED
|
@@ -11,6 +11,7 @@ import { useLargerText } from "./theme";
|
|
|
11
11
|
import { useReduceMotion } from "./useReduceMotion";
|
|
12
12
|
import { useScheme } from "./useScheme";
|
|
13
13
|
import { FLOATING_PILL_RADIUS, tabBarHeight, tabBarSlotStyle } from "./floating";
|
|
14
|
+
import { usePressed } from "./usePressed";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* Space between the bar edge and the tabs, on every side of the active pill,
|
|
@@ -192,7 +193,7 @@ export function FloatingTabBar(t0) {
|
|
|
192
193
|
* the caller's function.
|
|
193
194
|
*/
|
|
194
195
|
function TabBarItem(t0) {
|
|
195
|
-
const $ = _c(
|
|
196
|
+
const $ = _c(34);
|
|
196
197
|
const {
|
|
197
198
|
route,
|
|
198
199
|
navigation,
|
|
@@ -204,6 +205,7 @@ function TabBarItem(t0) {
|
|
|
204
205
|
testID,
|
|
205
206
|
accessibilityLabel
|
|
206
207
|
} = t0;
|
|
208
|
+
const press = usePressed();
|
|
207
209
|
let t1;
|
|
208
210
|
if ($[0] !== focused || $[1] !== navigation || $[2] !== route.key || $[3] !== route.name || $[4] !== route.params) {
|
|
209
211
|
t1 = () => {
|
|
@@ -237,71 +239,87 @@ function TabBarItem(t0) {
|
|
|
237
239
|
} else {
|
|
238
240
|
t2 = $[7];
|
|
239
241
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
242
|
+
const t3 = press.onPressIn;
|
|
243
|
+
const t4 = press.onPressOut;
|
|
244
|
+
const t5 = press.pressed ? 0.7 : 1;
|
|
245
|
+
let t6;
|
|
246
|
+
if ($[8] !== t5) {
|
|
247
|
+
t6 = {
|
|
248
|
+
opacity: t5
|
|
249
|
+
};
|
|
250
|
+
$[8] = t5;
|
|
251
|
+
$[9] = t6;
|
|
252
|
+
} else {
|
|
253
|
+
t6 = $[9];
|
|
254
|
+
}
|
|
255
|
+
let t7;
|
|
256
|
+
if ($[10] !== color || $[11] !== focused || $[12] !== largerText || $[13] !== renderIcon) {
|
|
257
|
+
t7 = renderIcon ? renderIcon({
|
|
243
258
|
focused,
|
|
244
259
|
color,
|
|
245
260
|
size: largerText ? 28 : 24
|
|
246
261
|
}) : null;
|
|
247
|
-
$[
|
|
248
|
-
$[
|
|
249
|
-
$[
|
|
250
|
-
$[
|
|
251
|
-
$[
|
|
262
|
+
$[10] = color;
|
|
263
|
+
$[11] = focused;
|
|
264
|
+
$[12] = largerText;
|
|
265
|
+
$[13] = renderIcon;
|
|
266
|
+
$[14] = t7;
|
|
252
267
|
} else {
|
|
253
|
-
|
|
268
|
+
t7 = $[14];
|
|
254
269
|
}
|
|
255
|
-
const
|
|
256
|
-
let
|
|
257
|
-
if ($[
|
|
258
|
-
|
|
270
|
+
const t8 = `font-instrument-sans-semibold ${largerText ? "text-base" : "text-sm"}`;
|
|
271
|
+
let t9;
|
|
272
|
+
if ($[15] !== color) {
|
|
273
|
+
t9 = {
|
|
259
274
|
color
|
|
260
275
|
};
|
|
261
|
-
$[
|
|
262
|
-
$[
|
|
276
|
+
$[15] = color;
|
|
277
|
+
$[16] = t9;
|
|
263
278
|
} else {
|
|
264
|
-
|
|
279
|
+
t9 = $[16];
|
|
265
280
|
}
|
|
266
|
-
let
|
|
267
|
-
if ($[
|
|
268
|
-
|
|
269
|
-
$[
|
|
281
|
+
let t10;
|
|
282
|
+
if ($[17] === Symbol.for("react.memo_cache_sentinel")) {
|
|
283
|
+
t10 = typeStyle("semibold");
|
|
284
|
+
$[17] = t10;
|
|
270
285
|
} else {
|
|
271
|
-
|
|
286
|
+
t10 = $[17];
|
|
272
287
|
}
|
|
273
|
-
let
|
|
274
|
-
if ($[
|
|
275
|
-
|
|
276
|
-
$[
|
|
277
|
-
$[
|
|
288
|
+
let t11;
|
|
289
|
+
if ($[18] !== t9) {
|
|
290
|
+
t11 = [t9, t10];
|
|
291
|
+
$[18] = t9;
|
|
292
|
+
$[19] = t11;
|
|
278
293
|
} else {
|
|
279
|
-
|
|
294
|
+
t11 = $[19];
|
|
280
295
|
}
|
|
281
|
-
let
|
|
282
|
-
if ($[
|
|
283
|
-
|
|
284
|
-
$[
|
|
285
|
-
$[
|
|
286
|
-
$[
|
|
287
|
-
$[
|
|
296
|
+
let t12;
|
|
297
|
+
if ($[20] !== label || $[21] !== t11 || $[22] !== t8) {
|
|
298
|
+
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;
|
|
288
303
|
} else {
|
|
289
|
-
|
|
304
|
+
t12 = $[23];
|
|
290
305
|
}
|
|
291
|
-
let
|
|
292
|
-
if ($[
|
|
293
|
-
|
|
294
|
-
$[
|
|
295
|
-
$[
|
|
296
|
-
$[
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
306
|
+
let t13;
|
|
307
|
+
if ($[24] !== accessibilityLabel || $[25] !== onPress || $[26] !== press.onPressIn || $[27] !== press.onPressOut || $[28] !== t12 || $[29] !== t2 || $[30] !== t6 || $[31] !== t7 || $[32] !== testID) {
|
|
308
|
+
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;
|
|
301
319
|
} else {
|
|
302
|
-
|
|
320
|
+
t13 = $[33];
|
|
303
321
|
}
|
|
304
|
-
return
|
|
322
|
+
return t13;
|
|
305
323
|
}
|
|
306
324
|
|
|
307
325
|
/**
|
|
@@ -313,14 +331,6 @@ function TabBarItem(t0) {
|
|
|
313
331
|
* and moves at once with Reduce Motion. Behind the tablist, so assistive tech
|
|
314
332
|
* reads only the tabs.
|
|
315
333
|
*/
|
|
316
|
-
function _temp(t0) {
|
|
317
|
-
const {
|
|
318
|
-
pressed
|
|
319
|
-
} = t0;
|
|
320
|
-
return {
|
|
321
|
-
opacity: pressed ? 0.7 : 1
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
334
|
function ActiveTabPill(t0) {
|
|
325
335
|
const $ = _c(14);
|
|
326
336
|
const {
|
package/dist/SheetRow.jsx
CHANGED
|
@@ -7,6 +7,7 @@ import { palette } from "./palette";
|
|
|
7
7
|
import { useLargerText } from "./theme";
|
|
8
8
|
import { tokens } from "./tokens";
|
|
9
9
|
import { useScheme } from "./useScheme";
|
|
10
|
+
import { usePressed } from "./usePressed";
|
|
10
11
|
/**
|
|
11
12
|
* One action in a `Sheet` or bottom sheet, a touch size of the web menu item:
|
|
12
13
|
* icon (or another `leading` mark), title and optional detail, at least 56 high (64 with larger text) with
|
|
@@ -16,7 +17,7 @@ import { useScheme } from "./useScheme";
|
|
|
16
17
|
* item, and ignores presses.
|
|
17
18
|
*/
|
|
18
19
|
export function SheetRow(t0) {
|
|
19
|
-
const $ = _c(
|
|
20
|
+
const $ = _c(53);
|
|
20
21
|
const {
|
|
21
22
|
icon: Icon,
|
|
22
23
|
leading,
|
|
@@ -34,6 +35,7 @@ export function SheetRow(t0) {
|
|
|
34
35
|
const danger = t2 === undefined ? false : t2;
|
|
35
36
|
const warning = t3 === undefined ? false : t3;
|
|
36
37
|
const disabled = t4 === undefined ? false : t4;
|
|
38
|
+
const press = usePressed();
|
|
37
39
|
const scheme = useScheme();
|
|
38
40
|
const largerText = useLargerText();
|
|
39
41
|
const color = danger ? palette.danger[scheme] : warning ? palette.warning[scheme] : tokens.color.foreground[scheme];
|
|
@@ -66,133 +68,132 @@ export function SheetRow(t0) {
|
|
|
66
68
|
} else {
|
|
67
69
|
t9 = $[5];
|
|
68
70
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
const {
|
|
73
|
-
pressed
|
|
74
|
-
} = t11;
|
|
75
|
-
return {
|
|
76
|
-
borderRadius: tokens.radius.sm,
|
|
77
|
-
backgroundColor: pressed && !disabled ? palette.default[scheme] : "transparent"
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
$[6] = disabled;
|
|
81
|
-
$[7] = scheme;
|
|
82
|
-
$[8] = t10;
|
|
83
|
-
} else {
|
|
84
|
-
t10 = $[8];
|
|
85
|
-
}
|
|
86
|
-
let t11;
|
|
87
|
-
if ($[9] !== Icon || $[10] !== color || $[11] !== iconSize || $[12] !== leading) {
|
|
88
|
-
t11 = leading ?? (Icon ? <Icon size={iconSize} color={color} /> : null);
|
|
89
|
-
$[9] = Icon;
|
|
90
|
-
$[10] = color;
|
|
91
|
-
$[11] = iconSize;
|
|
92
|
-
$[12] = leading;
|
|
93
|
-
$[13] = t11;
|
|
94
|
-
} else {
|
|
95
|
-
t11 = $[13];
|
|
96
|
-
}
|
|
97
|
-
let t12;
|
|
98
|
-
if ($[14] !== titleSize) {
|
|
99
|
-
t12 = cn("font-instrument-sans-medium", titleSize);
|
|
100
|
-
$[14] = titleSize;
|
|
101
|
-
$[15] = t12;
|
|
102
|
-
} else {
|
|
103
|
-
t12 = $[15];
|
|
104
|
-
}
|
|
71
|
+
const t10 = press.onPressIn;
|
|
72
|
+
const t11 = press.onPressOut;
|
|
73
|
+
const t12 = press.pressed && !disabled ? palette.default[scheme] : "transparent";
|
|
105
74
|
let t13;
|
|
106
|
-
if ($[
|
|
75
|
+
if ($[6] !== t12) {
|
|
107
76
|
t13 = {
|
|
108
|
-
|
|
77
|
+
borderRadius: tokens.radius.sm,
|
|
78
|
+
backgroundColor: t12
|
|
109
79
|
};
|
|
110
|
-
$[
|
|
111
|
-
$[
|
|
80
|
+
$[6] = t12;
|
|
81
|
+
$[7] = t13;
|
|
112
82
|
} else {
|
|
113
|
-
t13 = $[
|
|
83
|
+
t13 = $[7];
|
|
114
84
|
}
|
|
115
85
|
let t14;
|
|
116
|
-
if ($[
|
|
117
|
-
t14 =
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
86
|
+
if ($[8] !== Icon || $[9] !== color || $[10] !== iconSize || $[11] !== leading) {
|
|
87
|
+
t14 = leading ?? (Icon ? <Icon size={iconSize} color={color} /> : null);
|
|
88
|
+
$[8] = Icon;
|
|
89
|
+
$[9] = color;
|
|
90
|
+
$[10] = iconSize;
|
|
91
|
+
$[11] = leading;
|
|
92
|
+
$[12] = t14;
|
|
120
93
|
} else {
|
|
121
|
-
t14 = $[
|
|
94
|
+
t14 = $[12];
|
|
122
95
|
}
|
|
123
96
|
let t15;
|
|
124
|
-
if ($[
|
|
125
|
-
t15 =
|
|
126
|
-
$[
|
|
97
|
+
if ($[13] !== titleSize) {
|
|
98
|
+
t15 = cn("font-instrument-sans-medium", titleSize);
|
|
99
|
+
$[13] = titleSize;
|
|
100
|
+
$[14] = t15;
|
|
127
101
|
} else {
|
|
128
|
-
t15 = $[
|
|
102
|
+
t15 = $[14];
|
|
129
103
|
}
|
|
130
104
|
let t16;
|
|
131
|
-
if ($[
|
|
132
|
-
t16 =
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
$[
|
|
105
|
+
if ($[15] !== color) {
|
|
106
|
+
t16 = {
|
|
107
|
+
color
|
|
108
|
+
};
|
|
109
|
+
$[15] = color;
|
|
110
|
+
$[16] = t16;
|
|
136
111
|
} else {
|
|
137
|
-
t16 = $[
|
|
112
|
+
t16 = $[16];
|
|
138
113
|
}
|
|
139
114
|
let t17;
|
|
140
|
-
if ($[
|
|
141
|
-
t17 =
|
|
142
|
-
$[
|
|
143
|
-
$[
|
|
144
|
-
$[26] = title;
|
|
145
|
-
$[27] = t17;
|
|
115
|
+
if ($[17] !== titleSize) {
|
|
116
|
+
t17 = sizeStyle(titleSize);
|
|
117
|
+
$[17] = titleSize;
|
|
118
|
+
$[18] = t17;
|
|
146
119
|
} else {
|
|
147
|
-
t17 = $[
|
|
120
|
+
t17 = $[18];
|
|
148
121
|
}
|
|
149
122
|
let t18;
|
|
150
|
-
if ($[
|
|
151
|
-
t18 =
|
|
152
|
-
$[
|
|
153
|
-
$[29] = detailSize;
|
|
154
|
-
$[30] = scheme;
|
|
155
|
-
$[31] = t18;
|
|
123
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
124
|
+
t18 = typeStyle("medium");
|
|
125
|
+
$[19] = t18;
|
|
156
126
|
} else {
|
|
157
|
-
t18 = $[
|
|
127
|
+
t18 = $[19];
|
|
158
128
|
}
|
|
159
129
|
let t19;
|
|
160
|
-
if ($[
|
|
161
|
-
t19 =
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
130
|
+
if ($[20] !== t16 || $[21] !== t17) {
|
|
131
|
+
t19 = [t16, t17, t18];
|
|
132
|
+
$[20] = t16;
|
|
133
|
+
$[21] = t17;
|
|
134
|
+
$[22] = t19;
|
|
165
135
|
} else {
|
|
166
|
-
t19 = $[
|
|
136
|
+
t19 = $[22];
|
|
167
137
|
}
|
|
168
138
|
let t20;
|
|
169
|
-
if ($[
|
|
170
|
-
t20 =
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
139
|
+
if ($[23] !== t15 || $[24] !== t19 || $[25] !== title) {
|
|
140
|
+
t20 = <Text className={t15} style={t19}>{title}</Text>;
|
|
141
|
+
$[23] = t15;
|
|
142
|
+
$[24] = t19;
|
|
143
|
+
$[25] = title;
|
|
144
|
+
$[26] = t20;
|
|
175
145
|
} else {
|
|
176
|
-
t20 = $[
|
|
146
|
+
t20 = $[26];
|
|
177
147
|
}
|
|
178
148
|
let t21;
|
|
179
|
-
if ($[
|
|
180
|
-
t21 =
|
|
181
|
-
$[
|
|
182
|
-
$[
|
|
183
|
-
$[
|
|
184
|
-
$[
|
|
185
|
-
|
|
186
|
-
$[
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
149
|
+
if ($[27] !== detail || $[28] !== detailSize || $[29] !== scheme) {
|
|
150
|
+
t21 = detail ? <Text className={cn("font-instrument-sans", detailSize)} style={[textStyle("muted", scheme), sizeStyle(detailSize)]}>{detail}</Text> : null;
|
|
151
|
+
$[27] = detail;
|
|
152
|
+
$[28] = detailSize;
|
|
153
|
+
$[29] = scheme;
|
|
154
|
+
$[30] = t21;
|
|
155
|
+
} else {
|
|
156
|
+
t21 = $[30];
|
|
157
|
+
}
|
|
158
|
+
let t22;
|
|
159
|
+
if ($[31] !== t20 || $[32] !== t21) {
|
|
160
|
+
t22 = <View className="min-w-0 flex-1">{t20}{t21}</View>;
|
|
161
|
+
$[31] = t20;
|
|
162
|
+
$[32] = t21;
|
|
163
|
+
$[33] = t22;
|
|
164
|
+
} else {
|
|
165
|
+
t22 = $[33];
|
|
166
|
+
}
|
|
167
|
+
let t23;
|
|
168
|
+
if ($[34] !== active || $[35] !== color || $[36] !== iconSize) {
|
|
169
|
+
t23 = active ? <IconCheck size={iconSize} color={color} strokeWidth={2} /> : null;
|
|
170
|
+
$[34] = active;
|
|
171
|
+
$[35] = color;
|
|
172
|
+
$[36] = iconSize;
|
|
173
|
+
$[37] = t23;
|
|
174
|
+
} else {
|
|
175
|
+
t23 = $[37];
|
|
176
|
+
}
|
|
177
|
+
let t24;
|
|
178
|
+
if ($[38] !== detail || $[39] !== disabled || $[40] !== onPress || $[41] !== press.onPressIn || $[42] !== press.onPressOut || $[43] !== t13 || $[44] !== t14 || $[45] !== t22 || $[46] !== t23 || $[47] !== t5 || $[48] !== t6 || $[49] !== t9 || $[50] !== testID || $[51] !== title) {
|
|
179
|
+
t24 = <Pressable testID={testID} accessibilityRole={t5} accessibilityLabel={title} accessibilityHint={detail} accessibilityState={t6} disabled={disabled} onPress={onPress} className={t9} onPressIn={t10} onPressOut={t11} style={t13}>{t14}{t22}{t23}</Pressable>;
|
|
180
|
+
$[38] = detail;
|
|
181
|
+
$[39] = disabled;
|
|
182
|
+
$[40] = onPress;
|
|
183
|
+
$[41] = press.onPressIn;
|
|
184
|
+
$[42] = press.onPressOut;
|
|
185
|
+
$[43] = t13;
|
|
186
|
+
$[44] = t14;
|
|
187
|
+
$[45] = t22;
|
|
188
|
+
$[46] = t23;
|
|
189
|
+
$[47] = t5;
|
|
190
|
+
$[48] = t6;
|
|
191
|
+
$[49] = t9;
|
|
192
|
+
$[50] = testID;
|
|
193
|
+
$[51] = title;
|
|
194
|
+
$[52] = t24;
|
|
194
195
|
} else {
|
|
195
|
-
|
|
196
|
+
t24 = $[52];
|
|
196
197
|
}
|
|
197
|
-
return
|
|
198
|
+
return t24;
|
|
198
199
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
2
|
import { Modal, Pressable, StyleSheet, Text, View, useWindowDimensions } from "react-native";
|
|
4
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
5
4
|
import { cn } from "../cn";
|
|
@@ -11,6 +10,7 @@ import { useReduceMotion } from "../useReduceMotion";
|
|
|
11
10
|
import { useScheme } from "../useScheme";
|
|
12
11
|
import { chatTextSize } from "./chat-text";
|
|
13
12
|
import { MESSAGE_MENU, messageContextMenuLayout } from "./message-menu-layout";
|
|
13
|
+
import { usePressed } from "../usePressed";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* The iMessage hold menu for a chat message: the chat fades under a frosted
|
|
@@ -331,7 +331,7 @@ function MenuCardRow(t0) {
|
|
|
331
331
|
onPress
|
|
332
332
|
} = t0;
|
|
333
333
|
const scheme = useScheme();
|
|
334
|
-
const
|
|
334
|
+
const press = usePressed();
|
|
335
335
|
const disabled = action.disabled === true;
|
|
336
336
|
const Icon = action.icon;
|
|
337
337
|
const color = action.destructive ? palette.danger[scheme] : tokens.color.foreground[scheme];
|
|
@@ -346,122 +346,115 @@ function MenuCardRow(t0) {
|
|
|
346
346
|
} else {
|
|
347
347
|
t2 = $[1];
|
|
348
348
|
}
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
352
|
-
t3 = () => setPressed(true);
|
|
353
|
-
t4 = () => setPressed(false);
|
|
354
|
-
$[2] = t3;
|
|
355
|
-
$[3] = t4;
|
|
356
|
-
} else {
|
|
357
|
-
t3 = $[2];
|
|
358
|
-
t4 = $[3];
|
|
359
|
-
}
|
|
349
|
+
const t3 = press.onPressIn;
|
|
350
|
+
const t4 = press.onPressOut;
|
|
360
351
|
const t5 = disabled ? 0.5 : 1;
|
|
361
|
-
const t6 = pressed && !disabled ? palette.default[scheme] : "transparent";
|
|
352
|
+
const t6 = press.pressed && !disabled ? palette.default[scheme] : "transparent";
|
|
362
353
|
let t7;
|
|
363
|
-
if ($[
|
|
354
|
+
if ($[2] !== rowHeight || $[3] !== t5 || $[4] !== t6) {
|
|
364
355
|
t7 = {
|
|
365
356
|
minHeight: rowHeight,
|
|
366
357
|
opacity: t5,
|
|
367
358
|
backgroundColor: t6
|
|
368
359
|
};
|
|
369
|
-
$[
|
|
370
|
-
$[
|
|
371
|
-
$[
|
|
372
|
-
$[
|
|
360
|
+
$[2] = rowHeight;
|
|
361
|
+
$[3] = t5;
|
|
362
|
+
$[4] = t6;
|
|
363
|
+
$[5] = t7;
|
|
373
364
|
} else {
|
|
374
|
-
t7 = $[
|
|
365
|
+
t7 = $[5];
|
|
375
366
|
}
|
|
376
367
|
let t8;
|
|
377
|
-
if ($[
|
|
368
|
+
if ($[6] !== first || $[7] !== scheme) {
|
|
378
369
|
t8 = !first && {
|
|
379
370
|
borderTopWidth: StyleSheet.hairlineWidth,
|
|
380
371
|
borderTopColor: tokens.color.separator[scheme]
|
|
381
372
|
};
|
|
382
|
-
$[
|
|
383
|
-
$[
|
|
384
|
-
$[
|
|
373
|
+
$[6] = first;
|
|
374
|
+
$[7] = scheme;
|
|
375
|
+
$[8] = t8;
|
|
385
376
|
} else {
|
|
386
|
-
t8 = $[
|
|
377
|
+
t8 = $[8];
|
|
387
378
|
}
|
|
388
379
|
let t9;
|
|
389
|
-
if ($[
|
|
380
|
+
if ($[9] !== t7 || $[10] !== t8) {
|
|
390
381
|
t9 = [t7, t8];
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
382
|
+
$[9] = t7;
|
|
383
|
+
$[10] = t8;
|
|
384
|
+
$[11] = t9;
|
|
394
385
|
} else {
|
|
395
|
-
t9 = $[
|
|
386
|
+
t9 = $[11];
|
|
396
387
|
}
|
|
397
388
|
let t10;
|
|
398
|
-
if ($[
|
|
389
|
+
if ($[12] !== body) {
|
|
399
390
|
t10 = cn(body, "min-w-0 flex-1 font-instrument-sans");
|
|
400
|
-
$[
|
|
401
|
-
$[
|
|
391
|
+
$[12] = body;
|
|
392
|
+
$[13] = t10;
|
|
402
393
|
} else {
|
|
403
|
-
t10 = $[
|
|
394
|
+
t10 = $[13];
|
|
404
395
|
}
|
|
405
396
|
let t11;
|
|
406
|
-
if ($[
|
|
397
|
+
if ($[14] !== body) {
|
|
407
398
|
t11 = sizeStyle(body);
|
|
408
|
-
$[
|
|
409
|
-
$[
|
|
399
|
+
$[14] = body;
|
|
400
|
+
$[15] = t11;
|
|
410
401
|
} else {
|
|
411
|
-
t11 = $[
|
|
402
|
+
t11 = $[15];
|
|
412
403
|
}
|
|
413
404
|
let t12;
|
|
414
|
-
if ($[
|
|
405
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
415
406
|
t12 = typeStyle("medium");
|
|
416
|
-
$[
|
|
407
|
+
$[16] = t12;
|
|
417
408
|
} else {
|
|
418
|
-
t12 = $[
|
|
409
|
+
t12 = $[16];
|
|
419
410
|
}
|
|
420
411
|
let t13;
|
|
421
|
-
if ($[
|
|
412
|
+
if ($[17] !== color) {
|
|
422
413
|
t13 = {
|
|
423
414
|
color
|
|
424
415
|
};
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
416
|
+
$[17] = color;
|
|
417
|
+
$[18] = t13;
|
|
427
418
|
} else {
|
|
428
|
-
t13 = $[
|
|
419
|
+
t13 = $[18];
|
|
429
420
|
}
|
|
430
421
|
let t14;
|
|
431
|
-
if ($[
|
|
422
|
+
if ($[19] !== t11 || $[20] !== t13) {
|
|
432
423
|
t14 = [t11, t12, t13];
|
|
433
|
-
$[
|
|
434
|
-
$[
|
|
435
|
-
$[
|
|
424
|
+
$[19] = t11;
|
|
425
|
+
$[20] = t13;
|
|
426
|
+
$[21] = t14;
|
|
436
427
|
} else {
|
|
437
|
-
t14 = $[
|
|
428
|
+
t14 = $[21];
|
|
438
429
|
}
|
|
439
430
|
let t15;
|
|
440
|
-
if ($[
|
|
431
|
+
if ($[22] !== action.label || $[23] !== t10 || $[24] !== t14) {
|
|
441
432
|
t15 = <Text numberOfLines={1} className={t10} style={t14}>{action.label}</Text>;
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
$[
|
|
433
|
+
$[22] = action.label;
|
|
434
|
+
$[23] = t10;
|
|
435
|
+
$[24] = t14;
|
|
436
|
+
$[25] = t15;
|
|
446
437
|
} else {
|
|
447
|
-
t15 = $[
|
|
438
|
+
t15 = $[25];
|
|
448
439
|
}
|
|
449
440
|
let t16;
|
|
450
|
-
if ($[
|
|
441
|
+
if ($[26] !== Icon || $[27] !== color || $[28] !== iconSize) {
|
|
451
442
|
t16 = Icon ? <Icon size={iconSize} color={color} /> : null;
|
|
452
|
-
$[
|
|
453
|
-
$[
|
|
454
|
-
$[
|
|
455
|
-
$[
|
|
443
|
+
$[26] = Icon;
|
|
444
|
+
$[27] = color;
|
|
445
|
+
$[28] = iconSize;
|
|
446
|
+
$[29] = t16;
|
|
456
447
|
} else {
|
|
457
|
-
t16 = $[
|
|
448
|
+
t16 = $[29];
|
|
458
449
|
}
|
|
459
450
|
let t17;
|
|
460
|
-
if ($[
|
|
451
|
+
if ($[30] !== action.label || $[31] !== disabled || $[32] !== onPress || $[33] !== press.onPressIn || $[34] !== press.onPressOut || $[35] !== t15 || $[36] !== t16 || $[37] !== t2 || $[38] !== t9 || $[39] !== testID) {
|
|
461
452
|
t17 = <Pressable testID={testID} accessibilityRole="menuitem" accessibilityLabel={t1} accessibilityState={t2} disabled={disabled} onPress={onPress} onPressIn={t3} onPressOut={t4} className="flex-row items-center gap-3 px-4" style={t9}>{t15}{t16}</Pressable>;
|
|
462
|
-
$[
|
|
463
|
-
$[
|
|
464
|
-
$[
|
|
453
|
+
$[30] = action.label;
|
|
454
|
+
$[31] = disabled;
|
|
455
|
+
$[32] = onPress;
|
|
456
|
+
$[33] = press.onPressIn;
|
|
457
|
+
$[34] = press.onPressOut;
|
|
465
458
|
$[35] = t15;
|
|
466
459
|
$[36] = t16;
|
|
467
460
|
$[37] = t2;
|
package/dist/ai/message.jsx
CHANGED
|
@@ -17,6 +17,7 @@ import { MESSAGE_ACTIONS_TITLE, MessageActionSheet } from "./message-action-shee
|
|
|
17
17
|
import { useOptionalConversation } from "./conversation-context";
|
|
18
18
|
import { MessageContextMenu } from "./message-context-menu";
|
|
19
19
|
import { ChatTextColorContext, ResponseText } from "./response-text";
|
|
20
|
+
import { usePressed } from "../usePressed";
|
|
20
21
|
const MessageContext = createContext("assistant");
|
|
21
22
|
|
|
22
23
|
/** The bot behind an incoming message in a group chat. */
|
|
@@ -178,7 +179,7 @@ export function Message(t0) {
|
|
|
178
179
|
const highlighted = t1 === undefined ? false : t1;
|
|
179
180
|
const user = from === "user";
|
|
180
181
|
const [sheetOpen, setSheetOpen] = useState(false);
|
|
181
|
-
const
|
|
182
|
+
const press = usePressed();
|
|
182
183
|
const [held, setHeld] = useState(null);
|
|
183
184
|
const pressable = useRef(null);
|
|
184
185
|
const hasActions = actions != null && actions.length > 0;
|
|
@@ -290,8 +291,8 @@ export function Message(t0) {
|
|
|
290
291
|
}
|
|
291
292
|
const parts = t11;
|
|
292
293
|
let t12;
|
|
293
|
-
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] !==
|
|
294
|
-
t12 = longPressable ? <><Pressable ref={pressable} accessible={false} className={merged} style={[layout,
|
|
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={[{
|
|
295
296
|
name: "longpress",
|
|
296
297
|
label: actionSheetTitle ?? MESSAGE_ACTIONS_TITLE
|
|
297
298
|
}]} onAccessibilityAction={event => {
|
|
@@ -317,7 +318,7 @@ export function Message(t0) {
|
|
|
317
318
|
$[46] = menu;
|
|
318
319
|
$[47] = merged;
|
|
319
320
|
$[48] = parts;
|
|
320
|
-
$[49] =
|
|
321
|
+
$[49] = press;
|
|
321
322
|
$[50] = props;
|
|
322
323
|
$[51] = sheetOpen;
|
|
323
324
|
$[52] = user;
|
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
|
}
|
|
@@ -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
|
package/src/SheetRow.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { palette } from "./palette";
|
|
|
7
7
|
import { useLargerText } from "./theme";
|
|
8
8
|
import { tokens } from "./tokens";
|
|
9
9
|
import { useScheme } from "./useScheme";
|
|
10
|
+
import { usePressed } from "./usePressed";
|
|
10
11
|
|
|
11
12
|
export type SheetRowProps = {
|
|
12
13
|
/** A Tabler icon at the start. */
|
|
@@ -55,6 +56,7 @@ export function SheetRow({
|
|
|
55
56
|
onPress,
|
|
56
57
|
testID,
|
|
57
58
|
}: SheetRowProps) {
|
|
59
|
+
const press = usePressed();
|
|
58
60
|
const scheme = useScheme();
|
|
59
61
|
const largerText = useLargerText();
|
|
60
62
|
const color = danger
|
|
@@ -79,10 +81,12 @@ export function SheetRow({
|
|
|
79
81
|
largerText ? "min-h-16" : "min-h-14",
|
|
80
82
|
disabled && "opacity-50",
|
|
81
83
|
)}
|
|
82
|
-
|
|
84
|
+
onPressIn={press.onPressIn}
|
|
85
|
+
onPressOut={press.onPressOut}
|
|
86
|
+
style={{
|
|
83
87
|
borderRadius: tokens.radius.sm,
|
|
84
|
-
backgroundColor: pressed && !disabled ? palette.default[scheme] : "transparent",
|
|
85
|
-
}
|
|
88
|
+
backgroundColor: press.pressed && !disabled ? palette.default[scheme] : "transparent",
|
|
89
|
+
}}
|
|
86
90
|
>
|
|
87
91
|
{leading ?? (Icon ? <Icon size={iconSize} color={color} /> : null)}
|
|
88
92
|
<View className="min-w-0 flex-1">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
2
|
import { Modal, Pressable, StyleSheet, Text, View, useWindowDimensions } from "react-native";
|
|
3
3
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
4
4
|
import { cn } from "../cn";
|
|
@@ -10,6 +10,7 @@ import { useReduceMotion } from "../useReduceMotion";
|
|
|
10
10
|
import { useScheme } from "../useScheme";
|
|
11
11
|
import { chatTextSize } from "./chat-text";
|
|
12
12
|
import { MESSAGE_MENU, messageContextMenuLayout, type MessageMenu, type MessageMenuRect } from "./message-menu-layout";
|
|
13
|
+
import { usePressed } from "../usePressed";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* The iMessage hold menu for a chat message: the chat fades under a frosted
|
|
@@ -193,7 +194,7 @@ function MenuCardRow({
|
|
|
193
194
|
}) {
|
|
194
195
|
const scheme = useScheme();
|
|
195
196
|
// A state, not a style function: with a `className`, NativeWind drops a style function.
|
|
196
|
-
const
|
|
197
|
+
const press = usePressed();
|
|
197
198
|
const disabled = action.disabled === true;
|
|
198
199
|
const Icon = action.icon;
|
|
199
200
|
const color = action.destructive ? palette.danger[scheme] : tokens.color.foreground[scheme];
|
|
@@ -205,14 +206,14 @@ function MenuCardRow({
|
|
|
205
206
|
accessibilityState={{ disabled }}
|
|
206
207
|
disabled={disabled}
|
|
207
208
|
onPress={onPress}
|
|
208
|
-
onPressIn={
|
|
209
|
-
onPressOut={
|
|
209
|
+
onPressIn={press.onPressIn}
|
|
210
|
+
onPressOut={press.onPressOut}
|
|
210
211
|
className="flex-row items-center gap-3 px-4"
|
|
211
212
|
style={[
|
|
212
213
|
{
|
|
213
214
|
minHeight: rowHeight,
|
|
214
215
|
opacity: disabled ? 0.5 : 1,
|
|
215
|
-
backgroundColor: pressed && !disabled ? palette.default[scheme] : "transparent",
|
|
216
|
+
backgroundColor: press.pressed && !disabled ? palette.default[scheme] : "transparent",
|
|
216
217
|
},
|
|
217
218
|
!first && { borderTopWidth: StyleSheet.hairlineWidth, borderTopColor: tokens.color.separator[scheme] },
|
|
218
219
|
]}
|
package/src/ai/message.tsx
CHANGED
|
@@ -24,6 +24,7 @@ import { useOptionalConversation } from "./conversation-context";
|
|
|
24
24
|
import { MessageContextMenu } from "./message-context-menu";
|
|
25
25
|
import type { MessageMenu, MessageMenuRect } from "./message-menu-layout";
|
|
26
26
|
import { ChatTextColorContext, ResponseText } from "./response-text";
|
|
27
|
+
import { usePressed } from "../usePressed";
|
|
27
28
|
|
|
28
29
|
export type MessageRole = "user" | "assistant" | "system";
|
|
29
30
|
|
|
@@ -138,7 +139,7 @@ export function Message({
|
|
|
138
139
|
}: MessageProps) {
|
|
139
140
|
const user = from === "user";
|
|
140
141
|
const [sheetOpen, setSheetOpen] = useState(false);
|
|
141
|
-
const
|
|
142
|
+
const press = usePressed();
|
|
142
143
|
// The open context menu: where the message was and what it offers, read at the hold.
|
|
143
144
|
const [held, setHeld] = useState<{ anchor: MessageMenuRect; menu: MessageMenu } | null>(null);
|
|
144
145
|
// Measured at the hold: the menu draws the message again where it is on screen.
|
|
@@ -183,9 +184,9 @@ export function Message({
|
|
|
183
184
|
className={merged}
|
|
184
185
|
// While held it dims a little: the feedback before the menu opens. A state, not a
|
|
185
186
|
// style function: with a `className`, NativeWind drops a style function, layout and all.
|
|
186
|
-
style={[layout,
|
|
187
|
-
onPressIn={
|
|
188
|
-
onPressOut={
|
|
187
|
+
style={[layout, press.pressed ? HELD_STYLE : null]}
|
|
188
|
+
onPressIn={press.onPressIn}
|
|
189
|
+
onPressOut={press.onPressOut}
|
|
189
190
|
onLongPress={longPress}
|
|
190
191
|
delayLongPress={HOLD_DELAY_MS}
|
|
191
192
|
// TalkBack's actions menu reaches the same sheet as a long press.
|
package/src/ai/sources.tsx
CHANGED
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type CollapsibleTriggerProps,
|
|
16
16
|
} from "./collapsible";
|
|
17
17
|
import { ResponseText } from "./response-text";
|
|
18
|
+
import { usePressed } from "../usePressed";
|
|
18
19
|
|
|
19
20
|
/** The sources a reply used, folded (default closed). */
|
|
20
21
|
export function Sources({ className, ...props }: CollapsibleProps) {
|
|
@@ -75,6 +76,7 @@ const ROW_HEIGHT = 36;
|
|
|
75
76
|
* Pressed, it takes the web hover fill (`bg-surface-secondary`).
|
|
76
77
|
*/
|
|
77
78
|
export function Source({ href, title, onPress, testID }: SourceProps) {
|
|
79
|
+
const press = usePressed();
|
|
78
80
|
const scheme = useScheme();
|
|
79
81
|
const largerText = useLargerText();
|
|
80
82
|
const label = title ?? href;
|
|
@@ -85,11 +87,13 @@ export function Source({ href, title, onPress, testID }: SourceProps) {
|
|
|
85
87
|
accessibilityLabel={label}
|
|
86
88
|
hitSlop={touchSlop(MIN_TOUCH_TARGET, ROW_HEIGHT)}
|
|
87
89
|
onPress={() => (onPress ? onPress(href) : void Linking.openURL(href))}
|
|
90
|
+
onPressIn={press.onPressIn}
|
|
91
|
+
onPressOut={press.onPressOut}
|
|
88
92
|
className="flex-row items-center justify-between gap-2 px-3 py-2"
|
|
89
|
-
style={
|
|
93
|
+
style={{
|
|
90
94
|
borderRadius: tokens.radius.md,
|
|
91
|
-
backgroundColor: pressed ? tokens.color.surfaceSecondary[scheme] : "transparent",
|
|
92
|
-
}
|
|
95
|
+
backgroundColor: press.pressed ? tokens.color.surfaceSecondary[scheme] : "transparent",
|
|
96
|
+
}}
|
|
93
97
|
>
|
|
94
98
|
<ResponseText size="small" tone="muted" selectable={false} numberOfLines={1} className="shrink">
|
|
95
99
|
{label}
|
package/src/ai/suggestion.tsx
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
|
export type SuggestionsProps = {
|
|
12
13
|
/** `horizontal` (default) scrolls one row of chips; `vertical` stacks them full width. */
|
|
@@ -61,6 +62,7 @@ const CHIP_HEIGHT = 32;
|
|
|
61
62
|
* it takes the web hover (`bg-surface-tertiary text-foreground`).
|
|
62
63
|
*/
|
|
63
64
|
export function Suggestion({ suggestion, onPress, children, disabled, testID }: SuggestionProps) {
|
|
65
|
+
const press = usePressed();
|
|
64
66
|
const scheme = useScheme();
|
|
65
67
|
const largerText = useLargerText();
|
|
66
68
|
const size = chatTextSize("small", largerText);
|
|
@@ -74,11 +76,13 @@ export function Suggestion({ suggestion, onPress, children, disabled, testID }:
|
|
|
74
76
|
hitSlop={touchSlop(MIN_TOUCH_TARGET, CHIP_HEIGHT)}
|
|
75
77
|
onPress={() => onPress?.(suggestion)}
|
|
76
78
|
className={cn("justify-center border", largerText ? "min-h-12 px-4 py-2" : "min-h-8 px-3 py-1.5", disabled && "opacity-45")}
|
|
77
|
-
|
|
79
|
+
onPressIn={press.onPressIn}
|
|
80
|
+
onPressOut={press.onPressOut}
|
|
81
|
+
style={{
|
|
78
82
|
borderRadius: tokens.radius.pill,
|
|
79
83
|
borderColor: tokens.color.border[scheme],
|
|
80
|
-
backgroundColor: pressed ? palette.surfaceTertiary[scheme] : tokens.color.surfaceSecondary[scheme],
|
|
81
|
-
}
|
|
84
|
+
backgroundColor: press.pressed ? palette.surfaceTertiary[scheme] : tokens.color.surfaceSecondary[scheme],
|
|
85
|
+
}}
|
|
82
86
|
>
|
|
83
87
|
{({ pressed }) => (
|
|
84
88
|
<Text
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Whether a `Pressable` is held down, as state, for a pressed look. With a
|
|
5
|
+
* `className`, NativeWind drops a `Pressable` style function (`({ pressed })
|
|
6
|
+
* => ...`), and with it the radius, border and fill it sets; so a pressable
|
|
7
|
+
* with classes reads `pressed` from here and passes a plain style. Spread
|
|
8
|
+
* `onPressIn` and `onPressOut` on the `Pressable`.
|
|
9
|
+
*/
|
|
10
|
+
export function usePressed() {
|
|
11
|
+
const [pressed, setPressed] = useState(false);
|
|
12
|
+
return { pressed, onPressIn: () => setPressed(true), onPressOut: () => setPressed(false) };
|
|
13
|
+
}
|