@marktiderman/genesis-ui-native 3.5.0 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -7
- package/dist/{chunk-LBVD7XXL.js → chunk-2Z72MYHB.js} +627 -20
- package/dist/chunk-2Z72MYHB.js.map +1 -0
- package/dist/chunk-4OQOJ2OC.js +80 -0
- package/dist/chunk-4OQOJ2OC.js.map +1 -0
- package/dist/{chunk-6KWEAGRD.js → chunk-6PGLX6ET.js} +101 -6
- package/dist/chunk-6PGLX6ET.js.map +1 -0
- package/dist/{chunk-ONH2PCGH.js → chunk-AGTBABAH.js} +9 -15
- package/dist/chunk-AGTBABAH.js.map +1 -0
- package/dist/{chunk-ABVSSJNT.js → chunk-FUMSL7VZ.js} +198 -168
- package/dist/chunk-FUMSL7VZ.js.map +1 -0
- package/dist/{chunk-GHYUNNNU.js → chunk-NDXNSSM6.js} +175 -93
- package/dist/chunk-NDXNSSM6.js.map +1 -0
- package/dist/chunk-SEJ6RBP7.js +361 -0
- package/dist/chunk-SEJ6RBP7.js.map +1 -0
- package/dist/{chunk-D5RKSPMH.js → chunk-ZRQAFFTN.js} +4 -3
- package/dist/chunk-ZRQAFFTN.js.map +1 -0
- package/dist/components/index.d.ts +331 -4
- package/dist/components/index.js +5 -5
- package/dist/data/index.d.ts +68 -4
- package/dist/data/index.js +235 -31
- package/dist/data/index.js.map +1 -1
- package/dist/hooks/index.d.ts +60 -1
- package/dist/hooks/index.js +2 -3
- package/dist/icons/lucide.d.ts +1 -1
- package/dist/icons/lucide.js +7 -1
- package/dist/icons/lucide.js.map +1 -1
- package/dist/{inbox-page-BEarNEIP.d.ts → inbox-page-B7_Oi2fS.d.ts} +2 -44
- package/dist/index.d.ts +8 -5
- package/dist/index.js +8 -8
- package/dist/layouts/index.d.ts +40 -51
- package/dist/layouts/index.js +5 -4
- package/dist/{native-modules-PwnGltOU.d.ts → native-modules-Cl3zw3kh.d.ts} +27 -1
- package/package.json +78 -4
- package/src/__tests__/doctor-rules.test.ts +60 -0
- package/src/__tests__/native-modules-lists.test.tsx +1 -0
- package/src/components/__tests__/composer-bar.test.tsx +55 -0
- package/src/components/__tests__/gallery-card.test.tsx +59 -0
- package/src/components/__tests__/gallery-grid.test.tsx +160 -0
- package/src/components/__tests__/lightbox-resnap.test.tsx +50 -0
- package/src/components/__tests__/lightbox-zoom.test.ts +33 -0
- package/src/components/__tests__/lightbox.test.tsx +141 -0
- package/src/components/__tests__/live-indicator.test.tsx +72 -0
- package/src/components/__tests__/rating.test.tsx +82 -0
- package/src/components/__tests__/thread-list.test.tsx +156 -0
- package/src/components/composer-bar.tsx +198 -0
- package/src/components/drawer.tsx +15 -9
- package/src/components/gallery-card.tsx +109 -0
- package/src/components/gallery-grid.tsx +285 -0
- package/src/components/gallery-layout.ts +2 -0
- package/src/components/gallery-types.ts +2 -0
- package/src/components/index.ts +44 -0
- package/src/components/lightbox-zoom.tsx +282 -0
- package/src/components/lightbox.tsx +342 -0
- package/src/components/live-indicator.tsx +139 -0
- package/src/components/rating.tsx +128 -0
- package/src/components/skeleton.tsx +9 -4
- package/src/components/thread-list.tsx +427 -0
- package/src/components/toast.tsx +7 -4
- package/src/data/NativeConflictSheet.tsx +181 -0
- package/src/data/NativeResourceForm.tsx +15 -1
- package/src/data/index.ts +2 -0
- package/src/data/resource-view/NativeLinkPicker.tsx +1 -1
- package/src/data/resource-view/NativeRecordView.tsx +85 -8
- package/src/data/resource-view/NativeResourceView.tsx +79 -32
- package/src/data/resource-view/__tests__/native-link-picker.test.tsx +16 -0
- package/src/data/resource-view/__tests__/native-record-view.test.tsx +95 -1
- package/src/data/resource-view/__tests__/native-resource-gallery.test.tsx +125 -0
- package/src/data/resource-view/mapping.ts +3 -0
- package/src/hooks/__tests__/use-motion.test.tsx +106 -0
- package/src/hooks/__tests__/use-thread-jump.test.tsx +88 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/use-motion.ts +128 -0
- package/src/hooks/use-thread-jump.ts +110 -0
- package/src/icon-names.ts +6 -0
- package/src/icons/lucide.ts +12 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +6 -0
- package/src/layouts/__tests__/thread-page.test.tsx +114 -14
- package/src/layouts/inbox-page.tsx +6 -55
- package/src/layouts/index.ts +2 -0
- package/src/layouts/thread-page.tsx +326 -262
- package/src/native-modules.tsx +16 -2
- package/dist/chunk-6KWEAGRD.js.map +0 -1
- package/dist/chunk-7PCWEY6R.js +0 -27
- package/dist/chunk-7PCWEY6R.js.map +0 -1
- package/dist/chunk-ABVSSJNT.js.map +0 -1
- package/dist/chunk-D5RKSPMH.js.map +0 -1
- package/dist/chunk-GHYUNNNU.js.map +0 -1
- package/dist/chunk-LBVD7XXL.js.map +0 -1
- package/dist/chunk-ONH2PCGH.js.map +0 -1
- package/dist/chunk-Z3AQYVUA.js +0 -36
- package/dist/chunk-Z3AQYVUA.js.map +0 -1
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { NativeThreadList, NativeComposerBar } from './chunk-SEJ6RBP7.js';
|
|
2
|
+
import { composeHeaderOptions, ScreenContainer, NavBarSaveButton } from './chunk-AGTBABAH.js';
|
|
3
|
+
import { NativeText, NativeListItem, NativeButton, useGenesisModules, NativeSectionListHeader, NativeEmptyState, NativeInput } from './chunk-6PGLX6ET.js';
|
|
4
|
+
import { useThemeRoles, useThemeMode } from './chunk-4OQOJ2OC.js';
|
|
4
5
|
import { cn } from './chunk-OHZD7KRO.js';
|
|
5
|
-
import { createContext, Fragment, useState, useMemo, createElement, useContext, useCallback, useRef, useEffect } from 'react';
|
|
6
|
+
import { createContext, memo, Fragment, useState, useMemo, createElement, useContext, useCallback, useRef, useEffect } from 'react';
|
|
6
7
|
import { renderSlot } from '@marktiderman/genesis-core/slots';
|
|
7
|
-
import {
|
|
8
|
+
import { View, Pressable, Platform, StyleSheet, Alert, KeyboardAvoidingView, ScrollView, RefreshControl, SectionList, Image, Text, AccessibilityInfo } from 'react-native';
|
|
8
9
|
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
9
10
|
import { SafeAreaInsetsContext, SafeAreaView } from 'react-native-safe-area-context';
|
|
11
|
+
import { readReceiptFor, DEFAULT_THREAD_LABELS, formatMessageTime } from '@marktiderman/genesis-core/conversation';
|
|
12
|
+
export { readReceiptFor } from '@marktiderman/genesis-core/conversation';
|
|
10
13
|
|
|
11
14
|
function getSettingsPageStackOptions(props) {
|
|
12
15
|
return composeHeaderOptions({
|
|
@@ -542,7 +545,7 @@ function UnreadDot({
|
|
|
542
545
|
}
|
|
543
546
|
);
|
|
544
547
|
}
|
|
545
|
-
var
|
|
548
|
+
var announce = (text) => AccessibilityInfo.announceForAccessibility?.(text);
|
|
546
549
|
function getThreadPageStackOptions(props) {
|
|
547
550
|
return composeHeaderOptions({
|
|
548
551
|
headerTitle: props.headerTitle ?? "Conversation",
|
|
@@ -554,17 +557,18 @@ function getThreadPageStackOptions(props) {
|
|
|
554
557
|
});
|
|
555
558
|
}
|
|
556
559
|
var toDate = (value) => typeof value === "string" ? new Date(value) : value;
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
560
|
+
var NO_SLOTS2 = {};
|
|
561
|
+
var NO_SLOT_PROPS = {};
|
|
562
|
+
var messageKey = (m) => m.id;
|
|
563
|
+
var messageType = (m) => m.kind === "event" ? "event" : m.mine ? "mine" : "theirs";
|
|
564
|
+
var warnedNoKeyboardModule = false;
|
|
565
|
+
function warnNoKeyboardModule() {
|
|
566
|
+
const dev = typeof __DEV__ !== "undefined" ? __DEV__ : typeof process !== "undefined" && process.env.NODE_ENV !== "production";
|
|
567
|
+
if (!dev || warnedNoKeyboardModule) return;
|
|
568
|
+
warnedNoKeyboardModule = true;
|
|
569
|
+
console.warn(
|
|
570
|
+
"[genesis] ThreadPage: react-native-keyboard-controller is set up (keyboardScroll) but GenesisModules.keyboardAvoidingView isn't, so the composer falls back to React Native's KeyboardAvoidingView. Pass keyboard-controller's KeyboardAvoidingView as `keyboardAvoidingView` in your Genesis modules."
|
|
571
|
+
);
|
|
568
572
|
}
|
|
569
573
|
function ThreadPage({
|
|
570
574
|
messages,
|
|
@@ -577,117 +581,186 @@ function ThreadPage({
|
|
|
577
581
|
onLoadEarlier,
|
|
578
582
|
loadingEarlier = false,
|
|
579
583
|
earlierLabel = "Load earlier messages",
|
|
584
|
+
firstUnreadId,
|
|
585
|
+
jumpTo,
|
|
586
|
+
onLoadUntil,
|
|
587
|
+
onJumpFailed,
|
|
588
|
+
loading = false,
|
|
589
|
+
updating = false,
|
|
590
|
+
keyboardVerticalOffset,
|
|
580
591
|
emptyTitle,
|
|
581
592
|
emptyBody,
|
|
582
|
-
formatTime =
|
|
593
|
+
formatTime = formatMessageTime,
|
|
583
594
|
labels: labelOverrides,
|
|
584
|
-
slots =
|
|
585
|
-
slotProps =
|
|
595
|
+
slots = NO_SLOTS2,
|
|
596
|
+
slotProps = NO_SLOT_PROPS,
|
|
586
597
|
testID = "thread-page"
|
|
587
598
|
}) {
|
|
588
599
|
const colors = useThemeRoles();
|
|
589
|
-
const
|
|
590
|
-
const
|
|
600
|
+
const genesis = useGenesisModules();
|
|
601
|
+
const listRef = useRef(null);
|
|
602
|
+
const [atBottom, setAtBottom] = useState(true);
|
|
591
603
|
const receiptFor = readReceiptFor(messages, readAt);
|
|
592
|
-
const
|
|
593
|
-
const
|
|
604
|
+
const labelsKey = labelOverrides ? JSON.stringify(labelOverrides) : "";
|
|
605
|
+
const labels = useMemo(() => ({ ...DEFAULT_THREAD_LABELS, ...labelOverrides }), [labelsKey]);
|
|
606
|
+
const keyboardScroll = useKeyboardScroll();
|
|
594
607
|
useEffect(() => {
|
|
595
|
-
|
|
596
|
-
}, [
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
slotProps.
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
...message,
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
608
|
+
if (keyboardScroll && !genesis.keyboardAvoidingView) warnNoKeyboardModule();
|
|
609
|
+
}, [keyboardScroll, genesis.keyboardAvoidingView]);
|
|
610
|
+
useEffect(() => {
|
|
611
|
+
if (updating && Platform.OS === "ios") announce(labels.updating);
|
|
612
|
+
}, [updating]);
|
|
613
|
+
const renderRow = useCallback(
|
|
614
|
+
(message, { highlighted }) => {
|
|
615
|
+
const timeLabel = formatTime(toDate(message.timestamp));
|
|
616
|
+
const divider = message.id === firstUnreadId ? renderSlot(DefaultUnreadDivider, slots.unreadDivider, { label: labels.newMessages, testID: `${testID}-unread` }, slotProps.unreadDivider) : null;
|
|
617
|
+
if (message.kind === "event") {
|
|
618
|
+
return /* @__PURE__ */ jsxs(View, { style: { paddingVertical: 3 }, children: [
|
|
619
|
+
divider,
|
|
620
|
+
renderSlot(DefaultEvent, slots.event, { ...message, testID: `${testID}-event-${message.id}`, timeLabel }, slotProps.event)
|
|
621
|
+
] });
|
|
622
|
+
}
|
|
623
|
+
return /* @__PURE__ */ jsxs(View, { style: { paddingVertical: 3 }, children: [
|
|
624
|
+
divider,
|
|
625
|
+
renderSlot(
|
|
626
|
+
DefaultMessage,
|
|
627
|
+
slots.message,
|
|
628
|
+
{ ...message, testID: `${testID}-message-${message.id}`, timeLabel, showReadReceipt: message.id === receiptFor, labels, highlighted },
|
|
629
|
+
slotProps.message
|
|
630
|
+
),
|
|
631
|
+
message.attachments?.length ? /* @__PURE__ */ jsx(View, { style: { flexDirection: "row", flexWrap: "wrap", gap: 6, justifyContent: message.mine ? "flex-end" : "flex-start", marginTop: 4 }, children: message.attachments.map((attachment) => /* @__PURE__ */ jsx(View, { children: renderSlot(
|
|
632
|
+
DefaultAttachment,
|
|
633
|
+
slots.attachment,
|
|
634
|
+
{ ...attachment, mine: message.mine, testID: `${testID}-attachment-${attachment.id}` },
|
|
635
|
+
slotProps.attachment
|
|
636
|
+
) }, attachment.id)) }) : null,
|
|
637
|
+
message.id === receiptFor ? renderSlot(DefaultReadReceipt, slots.readReceipt, { label: readLabel, testID: `${testID}-read-receipt` }, slotProps.readReceipt) : null
|
|
638
|
+
] });
|
|
639
|
+
},
|
|
640
|
+
[firstUnreadId, formatTime, receiptFor, readLabel, slots, slotProps, testID, labels]
|
|
641
|
+
);
|
|
642
|
+
const send = composer ? () => {
|
|
643
|
+
composer.onSend();
|
|
644
|
+
listRef.current?.scrollToEnd({ animated: true });
|
|
645
|
+
} : void 0;
|
|
632
646
|
const footer = composer ? renderSlot(
|
|
633
647
|
DefaultComposer,
|
|
634
648
|
slots.composer,
|
|
635
649
|
{
|
|
636
650
|
...composer,
|
|
651
|
+
sendingLabel: composer.sendingLabel ?? labels.sending,
|
|
652
|
+
onSend: send,
|
|
637
653
|
testID: `${testID}-composer`,
|
|
638
654
|
accessory: renderSlot(Nothing, slots.composerAccessory, { testID: `${testID}-composer-accessory` }, slotProps.composerAccessory)
|
|
639
655
|
},
|
|
640
656
|
slotProps.composer
|
|
641
657
|
) : closedNotice ? /* @__PURE__ */ jsx(NativeText, { testID: `${testID}-closed`, style: { textAlign: "center", padding: 16, color: colors.secondaryLabel, fontSize: 13, lineHeight: 18 }, children: closedNotice }) : null;
|
|
642
|
-
const
|
|
643
|
-
const
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
658
|
+
const listHeader = header ?? renderSlot(Nothing, slots.header, { testID: `${testID}-header` }, slotProps.header);
|
|
659
|
+
const KeyboardAvoiding = genesis.keyboardAvoidingView ?? KeyboardAvoidingView;
|
|
660
|
+
const keyboardProps = genesis.keyboardAvoidingView ? { behavior: "translate-with-padding", automaticOffset: true, keyboardVerticalOffset: keyboardVerticalOffset ?? 0 } : { behavior: Platform.OS === "ios" ? "padding" : "height", keyboardVerticalOffset: keyboardVerticalOffset ?? (Platform.OS === "ios" ? 100 : 0) };
|
|
661
|
+
return /* @__PURE__ */ jsxs(SafeAreaView, { testID, edges: ["left", "right", "bottom"], style: { flex: 1, backgroundColor: colors.groupedBackground }, children: [
|
|
662
|
+
renderSlot(Nothing, slots.headerRegion, { testID: `${testID}-header-region` }, slotProps.headerRegion),
|
|
663
|
+
updating ? /* @__PURE__ */ jsx(View, { testID: `${testID}-updating`, accessibilityLiveRegion: "polite", accessible: true, accessibilityLabel: labels.updating, children: /* @__PURE__ */ jsx(NativeText, { style: { textAlign: "center", paddingVertical: 4, color: colors.tertiaryLabel, fontSize: 12, lineHeight: 16 }, children: labels.updating }) }) : null,
|
|
664
|
+
/* @__PURE__ */ jsxs(KeyboardAvoiding, { testID: `${testID}-keyboard`, style: { flex: 1 }, ...keyboardProps, children: [
|
|
665
|
+
/* @__PURE__ */ jsxs(View, { style: { flex: 1 }, children: [
|
|
666
|
+
/* @__PURE__ */ jsx(
|
|
667
|
+
NativeThreadList,
|
|
668
|
+
{
|
|
669
|
+
ref: listRef,
|
|
670
|
+
testID: `${testID}-messages`,
|
|
671
|
+
data: messages,
|
|
672
|
+
keyExtractor: messageKey,
|
|
673
|
+
getItemType: messageType,
|
|
674
|
+
renderItem: renderRow,
|
|
675
|
+
loading,
|
|
676
|
+
hasEarlier,
|
|
677
|
+
onLoadEarlier,
|
|
678
|
+
loadingEarlier,
|
|
679
|
+
earlierLabel,
|
|
680
|
+
renderEarlier: (p) => renderSlot(DefaultEarlierButton, slots.earlier, { ...p, testID: `${testID}-earlier` }, slotProps.earlier),
|
|
681
|
+
jumpTo,
|
|
682
|
+
onLoadUntil,
|
|
683
|
+
jumpAnnouncement: (m) => [m.mine ? labels.you : m.authorName, m.body].filter(Boolean).join(", "),
|
|
684
|
+
onJumpFailed: onJumpFailed ?? (() => announce(labels.messageGone)),
|
|
685
|
+
onAtBottomChange: setAtBottom,
|
|
686
|
+
header: listHeader,
|
|
687
|
+
empty: renderSlot(
|
|
688
|
+
DefaultEmpty2,
|
|
689
|
+
slots.empty,
|
|
690
|
+
{ title: emptyTitle ?? "No messages yet", body: emptyBody ?? "Write the first one below.", testID: `${testID}-empty` },
|
|
691
|
+
slotProps.empty
|
|
692
|
+
)
|
|
693
|
+
}
|
|
694
|
+
),
|
|
695
|
+
!atBottom && messages.length > 0 ? /* @__PURE__ */ jsx(
|
|
696
|
+
Pressable,
|
|
697
|
+
{
|
|
698
|
+
testID: `${testID}-jump-latest`,
|
|
699
|
+
accessibilityRole: "button",
|
|
700
|
+
accessibilityLabel: labels.jumpToLatest,
|
|
701
|
+
onPress: () => listRef.current?.scrollToEnd({ animated: true }),
|
|
702
|
+
style: { position: "absolute", bottom: 8, alignSelf: "center", minHeight: 44, justifyContent: "center", paddingHorizontal: 16, borderRadius: 22, backgroundColor: colors.surface },
|
|
703
|
+
children: /* @__PURE__ */ jsx(NativeText, { preset: "label", style: { color: colors.tint }, children: labels.jumpToLatest })
|
|
704
|
+
}
|
|
705
|
+
) : null
|
|
706
|
+
] }),
|
|
657
707
|
footer
|
|
658
|
-
|
|
659
|
-
}
|
|
660
|
-
return /* @__PURE__ */ jsx(SafeAreaView, { testID, edges: ["left", "right", "bottom"], style: page, children: /* @__PURE__ */ jsxs(KeyboardAvoidingView, { testID: `${testID}-kav`, style: { flex: 1 }, behavior: Platform.OS === "ios" ? "padding" : void 0, keyboardVerticalOffset: Platform.OS === "ios" ? 100 : 0, children: [
|
|
661
|
-
/* @__PURE__ */ jsx(
|
|
662
|
-
ScrollView,
|
|
663
|
-
{
|
|
664
|
-
ref: scrollRef,
|
|
665
|
-
testID: `${testID}-scroll`,
|
|
666
|
-
keyboardShouldPersistTaps: "handled",
|
|
667
|
-
contentInsetAdjustmentBehavior: "automatic",
|
|
668
|
-
contentContainerStyle: { flexGrow: 1 },
|
|
669
|
-
onContentSizeChange,
|
|
670
|
-
children: body
|
|
671
|
-
}
|
|
672
|
-
),
|
|
673
|
-
footer
|
|
674
|
-
] }) });
|
|
708
|
+
] })
|
|
709
|
+
] });
|
|
675
710
|
}
|
|
676
711
|
function Nothing(_props) {
|
|
677
712
|
return null;
|
|
678
713
|
}
|
|
679
|
-
function
|
|
680
|
-
|
|
714
|
+
function DefaultEarlierButton({ loading, onPress, label, testID }) {
|
|
715
|
+
const colors = useThemeRoles();
|
|
716
|
+
return /* @__PURE__ */ jsx(Pressable, { testID, accessibilityRole: "button", accessibilityLabel: label, accessibilityState: { busy: loading }, onPress, disabled: loading, style: { minHeight: 44, alignItems: "center", justifyContent: "center" }, children: /* @__PURE__ */ jsx(NativeText, { preset: "label", style: { color: colors.tint }, children: label }) });
|
|
681
717
|
}
|
|
682
718
|
function DefaultEmpty2({ title, body, testID }) {
|
|
683
719
|
return /* @__PURE__ */ jsx(NativeEmptyState, { variant: "first-run", title, body, testID });
|
|
684
720
|
}
|
|
721
|
+
function DefaultUnreadDivider({ label, testID }) {
|
|
722
|
+
const colors = useThemeRoles();
|
|
723
|
+
return /* @__PURE__ */ jsxs(View, { testID, accessible: true, accessibilityRole: "header", accessibilityLabel: label, style: { flexDirection: "row", alignItems: "center", gap: 8, paddingVertical: 8 }, children: [
|
|
724
|
+
/* @__PURE__ */ jsx(View, { style: { flex: 1, height: 1, backgroundColor: colors.tint } }),
|
|
725
|
+
/* @__PURE__ */ jsx(NativeText, { style: { color: colors.tint, fontSize: 12, lineHeight: 16 }, children: label }),
|
|
726
|
+
/* @__PURE__ */ jsx(View, { style: { flex: 1, height: 1, backgroundColor: colors.tint } })
|
|
727
|
+
] });
|
|
728
|
+
}
|
|
729
|
+
function DefaultEvent({ body, timeLabel, testID }) {
|
|
730
|
+
const colors = useThemeRoles();
|
|
731
|
+
return /* @__PURE__ */ jsx(View, { testID, accessible: true, accessibilityLabel: `${body}, ${timeLabel}`, style: { alignSelf: "center", paddingHorizontal: 12, paddingVertical: 4, borderRadius: 12, backgroundColor: colors.fill }, children: /* @__PURE__ */ jsx(NativeText, { style: { color: colors.secondaryLabel, fontSize: 12, lineHeight: 16, textAlign: "center" }, children: body }) });
|
|
732
|
+
}
|
|
685
733
|
var MINE_TEXT = { fontSize: 17, lineHeight: 22 };
|
|
686
|
-
function
|
|
734
|
+
function stateLabel(message) {
|
|
735
|
+
const { labels } = message;
|
|
736
|
+
switch (message.status) {
|
|
737
|
+
case "sending":
|
|
738
|
+
return labels.sending;
|
|
739
|
+
case "pending":
|
|
740
|
+
return labels.pending;
|
|
741
|
+
case "paused":
|
|
742
|
+
return labels.paused;
|
|
743
|
+
case "failed":
|
|
744
|
+
return labels.notSent;
|
|
745
|
+
case "conflict":
|
|
746
|
+
return labels.conflict;
|
|
747
|
+
default:
|
|
748
|
+
return null;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
var DefaultMessage = memo(function DefaultMessage2(message) {
|
|
687
752
|
const colors = useThemeRoles();
|
|
688
|
-
const failed = message.status === "failed";
|
|
689
753
|
const { labels } = message;
|
|
690
|
-
const
|
|
754
|
+
const broken = message.status === "failed" || message.status === "conflict";
|
|
755
|
+
const waiting = message.status === "sending" || message.status === "pending" || message.status === "paused";
|
|
756
|
+
const internal = message.tone === "internal";
|
|
757
|
+
const state = stateLabel(message);
|
|
758
|
+
const label = [message.mine ? labels.you : message.authorName ?? "", internal ? labels.internal : null, message.body, message.timeLabel, state].filter(Boolean).join(", ");
|
|
759
|
+
const canDiscard = Boolean(message.onDiscard) && (broken || message.status === "pending" || message.status === "paused");
|
|
760
|
+
const actions = [
|
|
761
|
+
...broken && message.onRetry ? [{ name: "activate", label: labels.retryHint }] : [],
|
|
762
|
+
...canDiscard ? [{ name: "discard", label: labels.discard }] : []
|
|
763
|
+
];
|
|
691
764
|
return /* @__PURE__ */ jsxs(View, { style: { alignItems: message.mine ? "flex-end" : "flex-start" }, children: [
|
|
692
765
|
!message.mine && message.authorName ? /* @__PURE__ */ jsx(NativeText, { style: { marginLeft: 12, marginBottom: 2, color: colors.secondaryLabel, fontSize: 12, lineHeight: 16 }, children: message.authorName }) : null,
|
|
693
766
|
/* @__PURE__ */ jsx(
|
|
@@ -695,90 +768,47 @@ function DefaultMessage(message) {
|
|
|
695
768
|
{
|
|
696
769
|
testID: message.testID,
|
|
697
770
|
accessible: true,
|
|
771
|
+
accessibilityRole: broken && message.onRetry ? "button" : void 0,
|
|
698
772
|
accessibilityLabel: label,
|
|
699
|
-
accessibilityHint:
|
|
700
|
-
|
|
773
|
+
accessibilityHint: broken && message.onRetry ? labels.retryHint : void 0,
|
|
774
|
+
accessibilityActions: actions.length ? actions : void 0,
|
|
775
|
+
onAccessibilityAction: (e) => {
|
|
776
|
+
if (e.nativeEvent.actionName === "discard" && canDiscard) message.onDiscard?.();
|
|
777
|
+
else if (e.nativeEvent.actionName === "activate" && broken) message.onRetry?.();
|
|
778
|
+
},
|
|
779
|
+
onPress: broken ? message.onRetry : void 0,
|
|
701
780
|
style: {
|
|
702
781
|
maxWidth: "80%",
|
|
703
782
|
paddingHorizontal: 14,
|
|
704
783
|
paddingVertical: 8,
|
|
705
784
|
borderRadius: 18,
|
|
706
|
-
backgroundColor: message.mine ? colors.tint : colors.surface,
|
|
707
|
-
|
|
785
|
+
backgroundColor: internal ? colors.surface : message.mine ? colors.tint : colors.surface,
|
|
786
|
+
borderWidth: internal || message.highlighted ? 2 : 0,
|
|
787
|
+
borderColor: internal ? colors.warning : colors.tint,
|
|
788
|
+
opacity: waiting ? 0.6 : 1
|
|
708
789
|
},
|
|
709
|
-
children: /* @__PURE__ */ jsx(NativeText, { className: message.mine ? "text-primary-foreground" : void 0, style: message.mine ? MINE_TEXT : { ...MINE_TEXT, color: colors.label }, children: message.body })
|
|
790
|
+
children: /* @__PURE__ */ jsx(NativeText, { className: message.mine && !internal ? "text-primary-foreground" : void 0, style: message.mine && !internal ? MINE_TEXT : { ...MINE_TEXT, color: colors.label }, children: message.body })
|
|
710
791
|
}
|
|
711
792
|
),
|
|
712
|
-
/* @__PURE__ */
|
|
713
|
-
NativeText,
|
|
714
|
-
{
|
|
715
|
-
|
|
716
|
-
style: { marginTop: 2, marginHorizontal: 12, color: failed ? colors.destructive : colors.tertiaryLabel, fontSize: 11, lineHeight: 14 },
|
|
717
|
-
children: failed ? labels.notSent : message.timeLabel
|
|
718
|
-
}
|
|
719
|
-
)
|
|
793
|
+
/* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "center", gap: 8, marginTop: 2, marginHorizontal: 12 }, children: [
|
|
794
|
+
/* @__PURE__ */ jsx(NativeText, { testID: `${message.testID}-time`, style: { color: broken ? colors.destructive : colors.tertiaryLabel, fontSize: 11, lineHeight: 14 }, children: state ?? message.timeLabel }),
|
|
795
|
+
canDiscard ? /* @__PURE__ */ jsx(Pressable, { testID: `${message.testID}-discard`, accessibilityRole: "button", accessibilityLabel: labels.discard, onPress: message.onDiscard, hitSlop: { top: 15, bottom: 15, left: 12, right: 12 }, children: /* @__PURE__ */ jsx(NativeText, { style: { color: colors.secondaryLabel, fontSize: 11, lineHeight: 14 }, children: labels.discard }) }) : null
|
|
796
|
+
] })
|
|
720
797
|
] });
|
|
721
|
-
}
|
|
722
|
-
function DefaultAttachment({ uri, width, height, accessibilityLabel, onPress, testID }) {
|
|
798
|
+
});
|
|
799
|
+
function DefaultAttachment({ id, uri, width, height, accessibilityLabel, onPress, testID }) {
|
|
800
|
+
const { image: ExpoImage } = useGenesisModules();
|
|
723
801
|
const ratio = width && height ? width / height : 0.6;
|
|
724
802
|
const w = 140;
|
|
725
|
-
|
|
803
|
+
const style = { width: w, height: Math.round(w / ratio), borderRadius: 12 };
|
|
804
|
+
return /* @__PURE__ */ jsx(Pressable, { testID, accessibilityRole: "image", accessibilityLabel: accessibilityLabel ?? "Attachment", onPress, disabled: !onPress, children: ExpoImage ? /* @__PURE__ */ jsx(ExpoImage, { source: { uri }, style, contentFit: "cover", recyclingKey: id }) : /* @__PURE__ */ jsx(Image, { source: { uri }, style, resizeMode: "cover" }, uri) });
|
|
726
805
|
}
|
|
727
806
|
function DefaultReadReceipt({ label, testID }) {
|
|
728
807
|
const colors = useThemeRoles();
|
|
729
808
|
return /* @__PURE__ */ jsx(NativeText, { testID, style: { alignSelf: "flex-end", marginHorizontal: 12, color: colors.secondaryLabel, fontSize: 11, lineHeight: 14 }, children: label });
|
|
730
809
|
}
|
|
731
|
-
function DefaultComposer({
|
|
732
|
-
|
|
733
|
-
onChangeText,
|
|
734
|
-
onSend,
|
|
735
|
-
sending = false,
|
|
736
|
-
placeholder = "Message",
|
|
737
|
-
sendLabel = "Send",
|
|
738
|
-
disabled = false,
|
|
739
|
-
maxLength,
|
|
740
|
-
testID,
|
|
741
|
-
accessory
|
|
742
|
-
}) {
|
|
743
|
-
const colors = useThemeRoles();
|
|
744
|
-
const blank = !value.trim();
|
|
745
|
-
return /* @__PURE__ */ jsxs(
|
|
746
|
-
View,
|
|
747
|
-
{
|
|
748
|
-
testID,
|
|
749
|
-
style: { flexDirection: "row", alignItems: "flex-end", gap: 8, paddingHorizontal: 12, paddingTop: 8, paddingBottom: 8, backgroundColor: colors.groupedBackground },
|
|
750
|
-
children: [
|
|
751
|
-
accessory,
|
|
752
|
-
/* @__PURE__ */ jsx(
|
|
753
|
-
TextInput,
|
|
754
|
-
{
|
|
755
|
-
testID: `${testID}-input`,
|
|
756
|
-
value,
|
|
757
|
-
onChangeText,
|
|
758
|
-
placeholder,
|
|
759
|
-
placeholderTextColor: colors.tertiaryLabel,
|
|
760
|
-
accessibilityLabel: placeholder,
|
|
761
|
-
multiline: true,
|
|
762
|
-
maxLength,
|
|
763
|
-
editable: !sending,
|
|
764
|
-
style: {
|
|
765
|
-
flex: 1,
|
|
766
|
-
minHeight: 36,
|
|
767
|
-
maxHeight: 120,
|
|
768
|
-
paddingHorizontal: 14,
|
|
769
|
-
paddingTop: 8,
|
|
770
|
-
paddingBottom: 8,
|
|
771
|
-
borderRadius: 18,
|
|
772
|
-
fontSize: 17,
|
|
773
|
-
color: colors.label,
|
|
774
|
-
backgroundColor: colors.surface
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
),
|
|
778
|
-
sending ? /* @__PURE__ */ jsx(View, { style: { height: 36, justifyContent: "center", paddingHorizontal: 8 }, children: /* @__PURE__ */ jsx(ActivityIndicator, { testID: `${testID}-sending`, accessibilityLabel: "Sending" }) }) : /* @__PURE__ */ jsx(NativeButton, { size: "sm", onPress: onSend, disabled: disabled || blank, testID: `${testID}-send`, children: sendLabel })
|
|
779
|
-
]
|
|
780
|
-
}
|
|
781
|
-
);
|
|
810
|
+
function DefaultComposer({ accessory, testID, ...composer }) {
|
|
811
|
+
return /* @__PURE__ */ jsx(NativeComposerBar, { ...composer, leading: accessory, testID });
|
|
782
812
|
}
|
|
783
813
|
function AuthBranding({
|
|
784
814
|
logo,
|
|
@@ -1118,6 +1148,6 @@ function googleProvider({ onPress, label = "Continue with Google", icon, disable
|
|
|
1118
1148
|
return { id: "google", label, icon, onPress, disabled };
|
|
1119
1149
|
}
|
|
1120
1150
|
|
|
1121
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight,
|
|
1122
|
-
//# sourceMappingURL=chunk-
|
|
1123
|
-
//# sourceMappingURL=chunk-
|
|
1151
|
+
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink, KEYBOARD_TOOLBAR_HEIGHT, KeyboardScrollProvider, NotificationsPage, SettingsPage, SettingsSubPage, SocialAuthRow, ThreadPage, appleProvider, confirmDiscardChanges, defaultStickyHeaderOffset, getNotificationsPageStackOptions, getSettingsPageStackOptions, getSettingsSubPageStackOptions, getThreadPageStackOptions, googleProvider, iosCompactNavigationBarHeight, useKeyboardScroll, useKeyboardToolbar };
|
|
1152
|
+
//# sourceMappingURL=chunk-FUMSL7VZ.js.map
|
|
1153
|
+
//# sourceMappingURL=chunk-FUMSL7VZ.js.map
|