@vvedantb/native-ui 0.24.1 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/DropdownMenu.jsx +245 -116
- package/dist/MenuSheet.jsx +164 -0
- package/dist/ReactionRow.jsx +84 -0
- package/dist/ai/index.js +2 -0
- package/dist/ai/message-action-sheet.jsx +182 -202
- package/dist/ai/message-context-menu.jsx +386 -0
- package/dist/ai/message-menu-layout.js +46 -0
- package/dist/ai/message.jsx +113 -69
- package/dist/entries/primitives.js +2 -0
- package/dist/index.js +2 -0
- package/dist/motion.js +31 -0
- package/dist/primitives/overlay.jsx +162 -101
- package/package.json +1 -1
- package/src/DropdownMenu.tsx +71 -16
- package/src/MenuSheet.tsx +80 -0
- package/src/ReactionRow.tsx +70 -0
- package/src/ai/index.ts +3 -0
- package/src/ai/message-action-sheet.tsx +92 -97
- package/src/ai/message-context-menu.tsx +183 -0
- package/src/ai/message-menu-layout.ts +44 -0
- package/src/ai/message.tsx +52 -6
- package/src/entries/primitives.ts +4 -0
- package/src/index.ts +4 -0
- package/src/motion.ts +15 -0
- package/src/primitives/overlay.tsx +48 -8
package/dist/DropdownMenu.jsx
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import * as Slot from "@rn-primitives/slot";
|
|
3
|
-
import { createContext, useContext, useRef, useState } from "react";
|
|
3
|
+
import { createContext, useContext, useEffect, useRef, useState } from "react";
|
|
4
4
|
import { Modal, Pressable, ScrollView, StyleSheet, Text, View, useWindowDimensions } from "react-native";
|
|
5
|
+
import Animated, { runOnJS, useAnimatedStyle, useSharedValue, withTiming } from "react-native-reanimated";
|
|
5
6
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
6
7
|
import { IconCheck } from "@tabler/icons-react-native";
|
|
7
8
|
import { FloatingSurface } from "./FloatingSurface";
|
|
8
9
|
import { cn } from "./cn";
|
|
9
10
|
import { sizeStyle, typeStyle } from "./controlStyles";
|
|
10
11
|
import { selectionHaptic } from "./haptics";
|
|
12
|
+
import { PANEL_SCALE_FROM, POPOVER_ENTER, POPOVER_EXIT } from "./motion";
|
|
11
13
|
import { palette } from "./palette";
|
|
12
14
|
import { useLargerText } from "./theme";
|
|
13
15
|
import { tokens } from "./tokens";
|
|
@@ -247,10 +249,12 @@ export function dropdownMenuPosition({
|
|
|
247
249
|
* `Dialog` and `Sheet` (`FloatingSurface` without blur, with the floating
|
|
248
250
|
* shadow) at radius 16, at least 192 wide, `p-1.5`, scrolling when taller than
|
|
249
251
|
* the room. A tap outside, Android back and the VoiceOver escape gesture close
|
|
250
|
-
* it.
|
|
252
|
+
* it. The panel (not the backdrop) fades in and scales from 0.96 over 150 ms
|
|
253
|
+
* once it is measured, from the corner nearest the trigger, and fades out in
|
|
254
|
+
* 100 ms. With Reduce Motion on, it appears and leaves at once.
|
|
251
255
|
*/
|
|
252
256
|
export function DropdownMenuContent(t0) {
|
|
253
|
-
const $ = _c(
|
|
257
|
+
const $ = _c(74);
|
|
254
258
|
let children;
|
|
255
259
|
let className;
|
|
256
260
|
let props;
|
|
@@ -291,155 +295,280 @@ export function DropdownMenuContent(t0) {
|
|
|
291
295
|
const insets = useSafeAreaInsets();
|
|
292
296
|
const reduceMotion = useReduceMotion();
|
|
293
297
|
const [contentHeight, setContentHeight] = useState(null);
|
|
298
|
+
const [shown, setShown] = useState(open);
|
|
299
|
+
if (open && !shown) {
|
|
300
|
+
setShown(true);
|
|
301
|
+
}
|
|
302
|
+
if (!open && shown && reduceMotion) {
|
|
303
|
+
setShown(false);
|
|
304
|
+
}
|
|
305
|
+
const openRef = useRef(open);
|
|
294
306
|
let t2;
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
307
|
+
let t3;
|
|
308
|
+
if ($[7] !== open) {
|
|
309
|
+
t2 = () => {
|
|
310
|
+
openRef.current = open;
|
|
311
|
+
};
|
|
312
|
+
t3 = [open];
|
|
313
|
+
$[7] = open;
|
|
298
314
|
$[8] = t2;
|
|
315
|
+
$[9] = t3;
|
|
299
316
|
} else {
|
|
300
317
|
t2 = $[8];
|
|
318
|
+
t3 = $[9];
|
|
301
319
|
}
|
|
302
|
-
|
|
303
|
-
const
|
|
320
|
+
useEffect(t2, t3);
|
|
321
|
+
const opacity = useSharedValue(reduceMotion ? 1 : 0);
|
|
322
|
+
const scale = useSharedValue(reduceMotion ? 1 : PANEL_SCALE_FROM);
|
|
323
|
+
const measured = contentHeight !== null;
|
|
304
324
|
let t4;
|
|
305
|
-
if ($[
|
|
306
|
-
t4 =
|
|
325
|
+
if ($[10] !== scale) {
|
|
326
|
+
t4 = () => {
|
|
327
|
+
if (openRef.current) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
setShown(false);
|
|
331
|
+
setContentHeight(null);
|
|
332
|
+
scale.set(PANEL_SCALE_FROM);
|
|
333
|
+
};
|
|
334
|
+
$[10] = scale;
|
|
335
|
+
$[11] = t4;
|
|
336
|
+
} else {
|
|
337
|
+
t4 = $[11];
|
|
338
|
+
}
|
|
339
|
+
const hide = t4;
|
|
340
|
+
let t5;
|
|
341
|
+
if ($[12] !== hide || $[13] !== measured || $[14] !== opacity || $[15] !== open || $[16] !== reduceMotion || $[17] !== scale || $[18] !== shown) {
|
|
342
|
+
t5 = () => {
|
|
343
|
+
if (reduceMotion) {
|
|
344
|
+
opacity.set(1);
|
|
345
|
+
scale.set(1);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
if (open) {
|
|
349
|
+
if (!measured) {
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
opacity.set(withTiming(1, POPOVER_ENTER));
|
|
353
|
+
scale.set(withTiming(1, POPOVER_ENTER));
|
|
354
|
+
} else {
|
|
355
|
+
if (shown) {
|
|
356
|
+
opacity.set(withTiming(0, POPOVER_EXIT, finished => {
|
|
357
|
+
"worklet";
|
|
358
|
+
|
|
359
|
+
if (finished) {
|
|
360
|
+
runOnJS(hide)();
|
|
361
|
+
}
|
|
362
|
+
}));
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
$[12] = hide;
|
|
367
|
+
$[13] = measured;
|
|
368
|
+
$[14] = opacity;
|
|
369
|
+
$[15] = open;
|
|
370
|
+
$[16] = reduceMotion;
|
|
371
|
+
$[17] = scale;
|
|
372
|
+
$[18] = shown;
|
|
373
|
+
$[19] = t5;
|
|
374
|
+
} else {
|
|
375
|
+
t5 = $[19];
|
|
376
|
+
}
|
|
377
|
+
let t6;
|
|
378
|
+
if ($[20] !== measured || $[21] !== open || $[22] !== reduceMotion) {
|
|
379
|
+
t6 = [open, measured, reduceMotion];
|
|
380
|
+
$[20] = measured;
|
|
381
|
+
$[21] = open;
|
|
382
|
+
$[22] = reduceMotion;
|
|
383
|
+
$[23] = t6;
|
|
384
|
+
} else {
|
|
385
|
+
t6 = $[23];
|
|
386
|
+
}
|
|
387
|
+
useEffect(t5, t6);
|
|
388
|
+
const panelStyle = useAnimatedStyle(() => ({
|
|
389
|
+
opacity: opacity.get(),
|
|
390
|
+
transform: [{
|
|
391
|
+
scale: scale.get()
|
|
392
|
+
}]
|
|
393
|
+
}));
|
|
394
|
+
let t7;
|
|
395
|
+
if ($[24] !== setOpen) {
|
|
396
|
+
t7 = () => setOpen(false);
|
|
397
|
+
$[24] = setOpen;
|
|
398
|
+
$[25] = t7;
|
|
399
|
+
} else {
|
|
400
|
+
t7 = $[25];
|
|
401
|
+
}
|
|
402
|
+
const close = t7;
|
|
403
|
+
const t8 = contentHeight ?? 0;
|
|
404
|
+
let t9;
|
|
405
|
+
if ($[26] !== align || $[27] !== insets || $[28] !== sideOffset || $[29] !== t8 || $[30] !== trigger || $[31] !== window) {
|
|
406
|
+
t9 = dropdownMenuPosition({
|
|
307
407
|
trigger,
|
|
308
408
|
window,
|
|
309
409
|
insets,
|
|
310
410
|
align,
|
|
311
411
|
sideOffset,
|
|
312
|
-
contentHeight:
|
|
412
|
+
contentHeight: t8
|
|
313
413
|
});
|
|
314
|
-
$[
|
|
315
|
-
$[
|
|
316
|
-
$[
|
|
317
|
-
$[
|
|
318
|
-
$[
|
|
319
|
-
$[
|
|
320
|
-
$[
|
|
414
|
+
$[26] = align;
|
|
415
|
+
$[27] = insets;
|
|
416
|
+
$[28] = sideOffset;
|
|
417
|
+
$[29] = t8;
|
|
418
|
+
$[30] = trigger;
|
|
419
|
+
$[31] = window;
|
|
420
|
+
$[32] = t9;
|
|
321
421
|
} else {
|
|
322
|
-
|
|
422
|
+
t9 = $[32];
|
|
323
423
|
}
|
|
324
|
-
const position =
|
|
325
|
-
const
|
|
326
|
-
let
|
|
327
|
-
if ($[
|
|
328
|
-
|
|
424
|
+
const position = t9;
|
|
425
|
+
const transformOrigin = `${align === "end" ? 100 : 0}% ${position.bottom === undefined ? 0 : 100}%`;
|
|
426
|
+
let t10;
|
|
427
|
+
if ($[33] === Symbol.for("react.memo_cache_sentinel")) {
|
|
428
|
+
t10 = {
|
|
329
429
|
flex: 1
|
|
330
430
|
};
|
|
331
|
-
$[
|
|
431
|
+
$[33] = t10;
|
|
332
432
|
} else {
|
|
333
|
-
|
|
433
|
+
t10 = $[33];
|
|
334
434
|
}
|
|
335
|
-
let
|
|
336
|
-
if ($[
|
|
337
|
-
|
|
338
|
-
$[
|
|
339
|
-
$[
|
|
435
|
+
let t11;
|
|
436
|
+
if ($[34] !== close) {
|
|
437
|
+
t11 = <Pressable testID="DropdownMenu-backdrop" accessibilityRole="button" accessibilityLabel="Close menu" onPress={close} style={StyleSheet.absoluteFill} />;
|
|
438
|
+
$[34] = close;
|
|
439
|
+
$[35] = t11;
|
|
340
440
|
} else {
|
|
341
|
-
|
|
441
|
+
t11 = $[35];
|
|
342
442
|
}
|
|
343
|
-
const
|
|
344
|
-
const
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
443
|
+
const t12 = open ? "auto" : "none";
|
|
444
|
+
const t13 = window.width - insets.left - insets.right - 2 * DROPDOWN_MENU.edge;
|
|
445
|
+
const t14 = contentHeight === null ? 0 : 1;
|
|
446
|
+
let t15;
|
|
447
|
+
if ($[36] !== position || $[37] !== t13 || $[38] !== t14) {
|
|
448
|
+
t15 = {
|
|
348
449
|
position: "absolute",
|
|
349
450
|
...position,
|
|
350
451
|
minWidth: DROPDOWN_MENU.minWidth,
|
|
351
|
-
maxWidth:
|
|
352
|
-
opacity:
|
|
353
|
-
};
|
|
354
|
-
$[19] = position;
|
|
355
|
-
$[20] = t8;
|
|
356
|
-
$[21] = t9;
|
|
357
|
-
$[22] = t10;
|
|
358
|
-
} else {
|
|
359
|
-
t10 = $[22];
|
|
360
|
-
}
|
|
361
|
-
let t11;
|
|
362
|
-
if ($[23] !== position.maxHeight) {
|
|
363
|
-
t11 = {
|
|
364
|
-
maxHeight: position.maxHeight
|
|
452
|
+
maxWidth: t13,
|
|
453
|
+
opacity: t14
|
|
365
454
|
};
|
|
366
|
-
$[
|
|
367
|
-
$[
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}
|
|
371
|
-
let t12;
|
|
372
|
-
let t13;
|
|
373
|
-
if ($[25] === Symbol.for("react.memo_cache_sentinel")) {
|
|
374
|
-
t12 = (_width, height) => setContentHeight(height);
|
|
375
|
-
t13 = {
|
|
376
|
-
padding: DROPDOWN_MENU.padding
|
|
377
|
-
};
|
|
378
|
-
$[25] = t12;
|
|
379
|
-
$[26] = t13;
|
|
380
|
-
} else {
|
|
381
|
-
t12 = $[25];
|
|
382
|
-
t13 = $[26];
|
|
383
|
-
}
|
|
384
|
-
let t14;
|
|
385
|
-
if ($[27] !== className) {
|
|
386
|
-
t14 = cn(className);
|
|
387
|
-
$[27] = className;
|
|
388
|
-
$[28] = t14;
|
|
389
|
-
} else {
|
|
390
|
-
t14 = $[28];
|
|
391
|
-
}
|
|
392
|
-
let t15;
|
|
393
|
-
if ($[29] !== children || $[30] !== props || $[31] !== style || $[32] !== t14) {
|
|
394
|
-
t15 = <ScrollView bounces={false} showsVerticalScrollIndicator={false} onContentSizeChange={t12} contentContainerStyle={t13}><View className={t14} style={style} {...props}>{children}</View></ScrollView>;
|
|
395
|
-
$[29] = children;
|
|
396
|
-
$[30] = props;
|
|
397
|
-
$[31] = style;
|
|
398
|
-
$[32] = t14;
|
|
399
|
-
$[33] = t15;
|
|
455
|
+
$[36] = position;
|
|
456
|
+
$[37] = t13;
|
|
457
|
+
$[38] = t14;
|
|
458
|
+
$[39] = t15;
|
|
400
459
|
} else {
|
|
401
|
-
t15 = $[
|
|
460
|
+
t15 = $[39];
|
|
402
461
|
}
|
|
403
462
|
let t16;
|
|
404
|
-
if ($[
|
|
405
|
-
t16 =
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
$[
|
|
463
|
+
if ($[40] !== transformOrigin) {
|
|
464
|
+
t16 = {
|
|
465
|
+
transformOrigin
|
|
466
|
+
};
|
|
467
|
+
$[40] = transformOrigin;
|
|
468
|
+
$[41] = t16;
|
|
409
469
|
} else {
|
|
410
|
-
t16 = $[
|
|
470
|
+
t16 = $[41];
|
|
411
471
|
}
|
|
412
472
|
let t17;
|
|
413
|
-
if ($[
|
|
414
|
-
t17 =
|
|
415
|
-
$[
|
|
416
|
-
$[
|
|
417
|
-
$[
|
|
418
|
-
$[40] = t17;
|
|
473
|
+
if ($[42] !== panelStyle || $[43] !== t16) {
|
|
474
|
+
t17 = [t16, panelStyle];
|
|
475
|
+
$[42] = panelStyle;
|
|
476
|
+
$[43] = t16;
|
|
477
|
+
$[44] = t17;
|
|
419
478
|
} else {
|
|
420
|
-
t17 = $[
|
|
479
|
+
t17 = $[44];
|
|
421
480
|
}
|
|
422
481
|
let t18;
|
|
423
|
-
if ($[
|
|
424
|
-
t18 =
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
$[
|
|
428
|
-
} else {
|
|
429
|
-
t18 = $[43];
|
|
430
|
-
}
|
|
431
|
-
let t19;
|
|
432
|
-
if ($[44] !== close || $[45] !== open || $[46] !== t18 || $[47] !== t5) {
|
|
433
|
-
t19 = <Modal visible={open} transparent={true} animationType={t5} statusBarTranslucent={true} onRequestClose={close}>{t18}</Modal>;
|
|
434
|
-
$[44] = close;
|
|
435
|
-
$[45] = open;
|
|
482
|
+
if ($[45] !== position.maxHeight) {
|
|
483
|
+
t18 = {
|
|
484
|
+
maxHeight: position.maxHeight
|
|
485
|
+
};
|
|
486
|
+
$[45] = position.maxHeight;
|
|
436
487
|
$[46] = t18;
|
|
437
|
-
$[47] = t5;
|
|
438
|
-
$[48] = t19;
|
|
439
488
|
} else {
|
|
440
|
-
|
|
489
|
+
t18 = $[46];
|
|
441
490
|
}
|
|
442
|
-
|
|
491
|
+
let t19;
|
|
492
|
+
let t20;
|
|
493
|
+
if ($[47] === Symbol.for("react.memo_cache_sentinel")) {
|
|
494
|
+
t19 = (_width, height) => setContentHeight(height);
|
|
495
|
+
t20 = {
|
|
496
|
+
padding: DROPDOWN_MENU.padding
|
|
497
|
+
};
|
|
498
|
+
$[47] = t19;
|
|
499
|
+
$[48] = t20;
|
|
500
|
+
} else {
|
|
501
|
+
t19 = $[47];
|
|
502
|
+
t20 = $[48];
|
|
503
|
+
}
|
|
504
|
+
let t21;
|
|
505
|
+
if ($[49] !== className) {
|
|
506
|
+
t21 = cn(className);
|
|
507
|
+
$[49] = className;
|
|
508
|
+
$[50] = t21;
|
|
509
|
+
} else {
|
|
510
|
+
t21 = $[50];
|
|
511
|
+
}
|
|
512
|
+
let t22;
|
|
513
|
+
if ($[51] !== children || $[52] !== props || $[53] !== style || $[54] !== t21) {
|
|
514
|
+
t22 = <ScrollView bounces={false} showsVerticalScrollIndicator={false} onContentSizeChange={t19} contentContainerStyle={t20}><View className={t21} style={style} {...props}>{children}</View></ScrollView>;
|
|
515
|
+
$[51] = children;
|
|
516
|
+
$[52] = props;
|
|
517
|
+
$[53] = style;
|
|
518
|
+
$[54] = t21;
|
|
519
|
+
$[55] = t22;
|
|
520
|
+
} else {
|
|
521
|
+
t22 = $[55];
|
|
522
|
+
}
|
|
523
|
+
let t23;
|
|
524
|
+
if ($[56] !== t18 || $[57] !== t22) {
|
|
525
|
+
t23 = <FloatingSurface blur={false} radius={DROPDOWN_MENU.radius} style={t18}>{t22}</FloatingSurface>;
|
|
526
|
+
$[56] = t18;
|
|
527
|
+
$[57] = t22;
|
|
528
|
+
$[58] = t23;
|
|
529
|
+
} else {
|
|
530
|
+
t23 = $[58];
|
|
531
|
+
}
|
|
532
|
+
let t24;
|
|
533
|
+
if ($[59] !== t17 || $[60] !== t23) {
|
|
534
|
+
t24 = <Animated.View style={t17}>{t23}</Animated.View>;
|
|
535
|
+
$[59] = t17;
|
|
536
|
+
$[60] = t23;
|
|
537
|
+
$[61] = t24;
|
|
538
|
+
} else {
|
|
539
|
+
t24 = $[61];
|
|
540
|
+
}
|
|
541
|
+
let t25;
|
|
542
|
+
if ($[62] !== close || $[63] !== t12 || $[64] !== t15 || $[65] !== t24) {
|
|
543
|
+
t25 = <View accessibilityRole="menu" accessibilityViewIsModal={true} onAccessibilityEscape={close} pointerEvents={t12} style={t15}>{t24}</View>;
|
|
544
|
+
$[62] = close;
|
|
545
|
+
$[63] = t12;
|
|
546
|
+
$[64] = t15;
|
|
547
|
+
$[65] = t24;
|
|
548
|
+
$[66] = t25;
|
|
549
|
+
} else {
|
|
550
|
+
t25 = $[66];
|
|
551
|
+
}
|
|
552
|
+
let t26;
|
|
553
|
+
if ($[67] !== t11 || $[68] !== t25) {
|
|
554
|
+
t26 = <View style={t10} pointerEvents="box-none">{t11}{t25}</View>;
|
|
555
|
+
$[67] = t11;
|
|
556
|
+
$[68] = t25;
|
|
557
|
+
$[69] = t26;
|
|
558
|
+
} else {
|
|
559
|
+
t26 = $[69];
|
|
560
|
+
}
|
|
561
|
+
let t27;
|
|
562
|
+
if ($[70] !== close || $[71] !== shown || $[72] !== t26) {
|
|
563
|
+
t27 = <Modal visible={shown} transparent={true} animationType="none" statusBarTranslucent={true} onRequestClose={close}>{t26}</Modal>;
|
|
564
|
+
$[70] = close;
|
|
565
|
+
$[71] = shown;
|
|
566
|
+
$[72] = t26;
|
|
567
|
+
$[73] = t27;
|
|
568
|
+
} else {
|
|
569
|
+
t27 = $[73];
|
|
570
|
+
}
|
|
571
|
+
return t27;
|
|
443
572
|
}
|
|
444
573
|
|
|
445
574
|
/** Item type and icon size: the web `text-sm` with a 16 icon in 48 rows, or `text-lg` with a 22 icon and 56 rows with larger text. */
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { Pressable, View } from "react-native";
|
|
3
|
+
import { IconChevronLeft, IconChevronRight } from "@tabler/icons-react-native";
|
|
4
|
+
import { Sheet, SheetBody, SheetContent, SheetHeader, SheetTitle } from "./Sheet";
|
|
5
|
+
import { SheetRow } from "./SheetRow";
|
|
6
|
+
import { tokens } from "./tokens";
|
|
7
|
+
import { useScheme } from "./useScheme";
|
|
8
|
+
/**
|
|
9
|
+
* A dropdown or context menu as one bottom sheet: a title, then `SheetRow`s
|
|
10
|
+
* with no gap between them, `MenuDivider`s between groups. With submenus, the
|
|
11
|
+
* root page lists the items, a `SubmenuRow` swaps the sheet to its page, and
|
|
12
|
+
* that page's header has a back button (`onBack`) to the root.
|
|
13
|
+
*/
|
|
14
|
+
export function MenuSheet(t0) {
|
|
15
|
+
const $ = _c(18);
|
|
16
|
+
const {
|
|
17
|
+
open,
|
|
18
|
+
onOpenChange,
|
|
19
|
+
title,
|
|
20
|
+
onBack,
|
|
21
|
+
children,
|
|
22
|
+
testID
|
|
23
|
+
} = t0;
|
|
24
|
+
const muted = tokens.color.muted[useScheme()];
|
|
25
|
+
let t1;
|
|
26
|
+
if ($[0] !== muted || $[1] !== onBack) {
|
|
27
|
+
t1 = onBack ? <Pressable accessibilityRole="button" accessibilityLabel="Back" onPress={onBack} className="-ml-2 h-11 w-11 items-center justify-center rounded-lg active:opacity-70"><IconChevronLeft size={20} color={muted} /></Pressable> : null;
|
|
28
|
+
$[0] = muted;
|
|
29
|
+
$[1] = onBack;
|
|
30
|
+
$[2] = t1;
|
|
31
|
+
} else {
|
|
32
|
+
t1 = $[2];
|
|
33
|
+
}
|
|
34
|
+
let t2;
|
|
35
|
+
if ($[3] !== title) {
|
|
36
|
+
t2 = <SheetTitle numberOfLines={1} className="min-w-0 flex-1">{title}</SheetTitle>;
|
|
37
|
+
$[3] = title;
|
|
38
|
+
$[4] = t2;
|
|
39
|
+
} else {
|
|
40
|
+
t2 = $[4];
|
|
41
|
+
}
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[5] !== t1 || $[6] !== t2) {
|
|
44
|
+
t3 = <SheetHeader className="min-h-11 flex-row items-center gap-1 px-2">{t1}{t2}</SheetHeader>;
|
|
45
|
+
$[5] = t1;
|
|
46
|
+
$[6] = t2;
|
|
47
|
+
$[7] = t3;
|
|
48
|
+
} else {
|
|
49
|
+
t3 = $[7];
|
|
50
|
+
}
|
|
51
|
+
let t4;
|
|
52
|
+
if ($[8] !== children) {
|
|
53
|
+
t4 = <SheetBody>{children}</SheetBody>;
|
|
54
|
+
$[8] = children;
|
|
55
|
+
$[9] = t4;
|
|
56
|
+
} else {
|
|
57
|
+
t4 = $[9];
|
|
58
|
+
}
|
|
59
|
+
let t5;
|
|
60
|
+
if ($[10] !== t3 || $[11] !== t4 || $[12] !== testID) {
|
|
61
|
+
t5 = <SheetContent className="gap-3 px-3" testID={testID}>{t3}{t4}</SheetContent>;
|
|
62
|
+
$[10] = t3;
|
|
63
|
+
$[11] = t4;
|
|
64
|
+
$[12] = testID;
|
|
65
|
+
$[13] = t5;
|
|
66
|
+
} else {
|
|
67
|
+
t5 = $[13];
|
|
68
|
+
}
|
|
69
|
+
let t6;
|
|
70
|
+
if ($[14] !== onOpenChange || $[15] !== open || $[16] !== t5) {
|
|
71
|
+
t6 = <Sheet open={open} onOpenChange={onOpenChange}>{t5}</Sheet>;
|
|
72
|
+
$[14] = onOpenChange;
|
|
73
|
+
$[15] = open;
|
|
74
|
+
$[16] = t5;
|
|
75
|
+
$[17] = t6;
|
|
76
|
+
} else {
|
|
77
|
+
t6 = $[17];
|
|
78
|
+
}
|
|
79
|
+
return t6;
|
|
80
|
+
}
|
|
81
|
+
/** A root-page item that opens a submenu: a `SheetRow` with a chevron at the end. */
|
|
82
|
+
export function SubmenuRow(t0) {
|
|
83
|
+
const $ = _c(18);
|
|
84
|
+
const {
|
|
85
|
+
icon,
|
|
86
|
+
leading,
|
|
87
|
+
title,
|
|
88
|
+
detail,
|
|
89
|
+
disabled,
|
|
90
|
+
onPress,
|
|
91
|
+
testID
|
|
92
|
+
} = t0;
|
|
93
|
+
const muted = tokens.color.muted[useScheme()];
|
|
94
|
+
let t1;
|
|
95
|
+
if ($[0] !== detail || $[1] !== disabled || $[2] !== icon || $[3] !== leading || $[4] !== onPress || $[5] !== testID || $[6] !== title) {
|
|
96
|
+
t1 = <View className="min-w-0 flex-1"><SheetRow icon={icon} leading={leading} title={title} detail={detail} disabled={disabled} onPress={onPress} testID={testID} /></View>;
|
|
97
|
+
$[0] = detail;
|
|
98
|
+
$[1] = disabled;
|
|
99
|
+
$[2] = icon;
|
|
100
|
+
$[3] = leading;
|
|
101
|
+
$[4] = onPress;
|
|
102
|
+
$[5] = testID;
|
|
103
|
+
$[6] = title;
|
|
104
|
+
$[7] = t1;
|
|
105
|
+
} else {
|
|
106
|
+
t1 = $[7];
|
|
107
|
+
}
|
|
108
|
+
const t2 = disabled ? 0.5 : 1;
|
|
109
|
+
let t3;
|
|
110
|
+
if ($[8] !== t2) {
|
|
111
|
+
t3 = {
|
|
112
|
+
pointerEvents: "none",
|
|
113
|
+
opacity: t2
|
|
114
|
+
};
|
|
115
|
+
$[8] = t2;
|
|
116
|
+
$[9] = t3;
|
|
117
|
+
} else {
|
|
118
|
+
t3 = $[9];
|
|
119
|
+
}
|
|
120
|
+
let t4;
|
|
121
|
+
if ($[10] !== muted) {
|
|
122
|
+
t4 = <IconChevronRight size={16} color={muted} />;
|
|
123
|
+
$[10] = muted;
|
|
124
|
+
$[11] = t4;
|
|
125
|
+
} else {
|
|
126
|
+
t4 = $[11];
|
|
127
|
+
}
|
|
128
|
+
let t5;
|
|
129
|
+
if ($[12] !== t3 || $[13] !== t4) {
|
|
130
|
+
t5 = <View className="absolute right-4" style={t3}>{t4}</View>;
|
|
131
|
+
$[12] = t3;
|
|
132
|
+
$[13] = t4;
|
|
133
|
+
$[14] = t5;
|
|
134
|
+
} else {
|
|
135
|
+
t5 = $[14];
|
|
136
|
+
}
|
|
137
|
+
let t6;
|
|
138
|
+
if ($[15] !== t1 || $[16] !== t5) {
|
|
139
|
+
t6 = <View className="flex-row items-center">{t1}{t5}</View>;
|
|
140
|
+
$[15] = t1;
|
|
141
|
+
$[16] = t5;
|
|
142
|
+
$[17] = t6;
|
|
143
|
+
} else {
|
|
144
|
+
t6 = $[17];
|
|
145
|
+
}
|
|
146
|
+
return t6;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/** The web `DropdownMenuSeparator` between groups of menu rows. */
|
|
150
|
+
export function MenuDivider() {
|
|
151
|
+
const $ = _c(2);
|
|
152
|
+
const t0 = tokens.color.border[useScheme()];
|
|
153
|
+
let t1;
|
|
154
|
+
if ($[0] !== t0) {
|
|
155
|
+
t1 = <View className="mx-4 my-1 h-px" style={{
|
|
156
|
+
backgroundColor: t0
|
|
157
|
+
}} />;
|
|
158
|
+
$[0] = t0;
|
|
159
|
+
$[1] = t1;
|
|
160
|
+
} else {
|
|
161
|
+
t1 = $[1];
|
|
162
|
+
}
|
|
163
|
+
return t1;
|
|
164
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { Pressable, View } from "react-native";
|
|
3
|
+
import { palette, withAlpha } from "./palette";
|
|
4
|
+
import { useScheme } from "./useScheme";
|
|
5
|
+
|
|
6
|
+
/** One round toggle: its key, its screen-reader label, its content (an emoji `Text` or an icon) and whether it is on. */
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The quick reactions at the top of a hold menu (`MenuSheet`): round 44
|
|
10
|
+
* toggles, each one on or off. Emoji reactions use the tint, a reply's
|
|
11
|
+
* thumbs the solid fill.
|
|
12
|
+
*/
|
|
13
|
+
export function ReactionRow(t0) {
|
|
14
|
+
const $ = _c(17);
|
|
15
|
+
const {
|
|
16
|
+
items,
|
|
17
|
+
onPress,
|
|
18
|
+
selectedStyle: t1,
|
|
19
|
+
layout: t2,
|
|
20
|
+
trailing
|
|
21
|
+
} = t0;
|
|
22
|
+
const selectedStyle = t1 === undefined ? "tint" : t1;
|
|
23
|
+
const layout = t2 === undefined ? "spread" : t2;
|
|
24
|
+
const scheme = useScheme();
|
|
25
|
+
let t3;
|
|
26
|
+
if ($[0] !== scheme || $[1] !== selectedStyle) {
|
|
27
|
+
t3 = selected => !selected ? palette.default[scheme] : selectedStyle === "solid" ? palette.primary[scheme] : withAlpha(palette.primary[scheme], 0.12);
|
|
28
|
+
$[0] = scheme;
|
|
29
|
+
$[1] = selectedStyle;
|
|
30
|
+
$[2] = t3;
|
|
31
|
+
} else {
|
|
32
|
+
t3 = $[2];
|
|
33
|
+
}
|
|
34
|
+
const fill = t3;
|
|
35
|
+
const t4 = layout === "spread" ? "flex-row justify-between px-2 pb-2" : "flex-row gap-3 px-4 py-2";
|
|
36
|
+
let t5;
|
|
37
|
+
if ($[3] !== fill || $[4] !== items || $[5] !== onPress) {
|
|
38
|
+
let t6;
|
|
39
|
+
if ($[7] !== fill || $[8] !== onPress) {
|
|
40
|
+
t6 = item => {
|
|
41
|
+
const selected_0 = item.selected === true;
|
|
42
|
+
return <Pressable key={item.key} accessibilityRole="button" accessibilityLabel={item.label} accessibilityState={{
|
|
43
|
+
selected: selected_0
|
|
44
|
+
}} onPress={() => onPress(item.key)} className="size-11 items-center justify-center rounded-full active:opacity-70" style={{
|
|
45
|
+
backgroundColor: fill(selected_0)
|
|
46
|
+
}}>{item.render(selected_0)}</Pressable>;
|
|
47
|
+
};
|
|
48
|
+
$[7] = fill;
|
|
49
|
+
$[8] = onPress;
|
|
50
|
+
$[9] = t6;
|
|
51
|
+
} else {
|
|
52
|
+
t6 = $[9];
|
|
53
|
+
}
|
|
54
|
+
t5 = items.map(t6);
|
|
55
|
+
$[3] = fill;
|
|
56
|
+
$[4] = items;
|
|
57
|
+
$[5] = onPress;
|
|
58
|
+
$[6] = t5;
|
|
59
|
+
} else {
|
|
60
|
+
t5 = $[6];
|
|
61
|
+
}
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[10] !== fill || $[11] !== trailing) {
|
|
64
|
+
t6 = trailing ? <Pressable accessibilityRole="button" accessibilityLabel={trailing.label} onPress={trailing.onPress} className="size-11 items-center justify-center rounded-full active:opacity-70" style={{
|
|
65
|
+
backgroundColor: fill(false)
|
|
66
|
+
}}>{trailing.icon}</Pressable> : null;
|
|
67
|
+
$[10] = fill;
|
|
68
|
+
$[11] = trailing;
|
|
69
|
+
$[12] = t6;
|
|
70
|
+
} else {
|
|
71
|
+
t6 = $[12];
|
|
72
|
+
}
|
|
73
|
+
let t7;
|
|
74
|
+
if ($[13] !== t4 || $[14] !== t5 || $[15] !== t6) {
|
|
75
|
+
t7 = <View className={t4}>{t5}{t6}</View>;
|
|
76
|
+
$[13] = t4;
|
|
77
|
+
$[14] = t5;
|
|
78
|
+
$[15] = t6;
|
|
79
|
+
$[16] = t7;
|
|
80
|
+
} else {
|
|
81
|
+
t7 = $[16];
|
|
82
|
+
}
|
|
83
|
+
return t7;
|
|
84
|
+
}
|
package/dist/ai/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export { Collapsible, CollapsibleTrigger, CollapsibleContent, CollapsibleChevron
|
|
|
8
8
|
export { Conversation, ConversationContent, ConversationList, ConversationEmptyState, ConversationScrollButton, ConversationDock, useConversation, isScrolledToBottom, AT_BOTTOM_THRESHOLD } from "./conversation";
|
|
9
9
|
export { Message, MessageContent, MessageActionsBar, MessageAction, MessageMeta, MessageBotLabel, MESSAGE_ACTIONS, MESSAGE_HIGHLIGHT_MS, userBubbleStyle, tintBubbleStyle } from "./message";
|
|
10
10
|
export { MessageActionSheet } from "./message-action-sheet";
|
|
11
|
+
export { MessageContextMenu } from "./message-context-menu";
|
|
12
|
+
export { messageContextMenuLayout, MESSAGE_MENU } from "./message-menu-layout";
|
|
11
13
|
export { ReplyQuoteChip } from "./reply-quote-chip";
|
|
12
14
|
export { MessageQuote, QUOTE_MAX_LINES } from "./message-quote";
|
|
13
15
|
export { Reasoning, ReasoningTrigger, ReasoningContent, useReasoning, reasoningMessage } from "./reasoning";
|