@marktiderman/genesis-ui-native 2.4.1 → 2.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 +30 -0
- package/dist/{chunk-BPD5DCFP.js → chunk-3S5XVER4.js} +271 -6
- package/dist/chunk-3S5XVER4.js.map +1 -0
- package/dist/chunk-56QLEHHV.js +1231 -0
- package/dist/chunk-56QLEHHV.js.map +1 -0
- package/dist/chunk-6JBNSW4D.js +479 -0
- package/dist/chunk-6JBNSW4D.js.map +1 -0
- package/dist/{chunk-RARJGZA3.js → chunk-KZEIF4YI.js} +7 -741
- package/dist/chunk-KZEIF4YI.js.map +1 -0
- package/dist/{chunk-6TLBCRS6.js → chunk-VMSIKSU2.js} +13 -477
- package/dist/chunk-VMSIKSU2.js.map +1 -0
- package/dist/components/index.d.ts +29 -3
- package/dist/components/index.js +3 -4
- package/dist/data/index.d.ts +382 -4
- package/dist/data/index.js +1067 -19
- package/dist/data/index.js.map +1 -1
- package/dist/inbox-page-DZUR-PJ1.d.ts +199 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +5 -5
- package/dist/layouts/index.d.ts +4 -186
- package/dist/layouts/index.js +3 -3
- package/package.json +2 -2
- package/src/components/__tests__/loading-state.test.tsx +41 -0
- package/src/components/image.tsx +5 -0
- package/src/components/index.ts +3 -0
- package/src/components/loading-state.tsx +92 -0
- package/src/data/NativeDetailPanel.tsx +8 -1
- package/src/data/index.ts +1 -0
- package/src/data/resource-view/NativeResourceFormSheet.tsx +305 -0
- package/src/data/resource-view/NativeResourceView.tsx +528 -0
- package/src/data/resource-view/__tests__/native-resource-view.test.tsx +870 -0
- package/src/data/resource-view/display.tsx +256 -0
- package/src/data/resource-view/index.ts +50 -0
- package/src/data/resource-view/mapping.ts +326 -0
- package/src/data/resource-view/messages.ts +121 -0
- package/src/data/resource-view/use-native-resource-view.ts +307 -0
- package/src/layouts/__tests__/inbox-page.test.tsx +2 -1
- package/src/layouts/__tests__/screen-container.test.tsx +27 -0
- package/src/layouts/inbox-page.tsx +4 -7
- package/src/layouts/screen-container.tsx +18 -1
- package/dist/chunk-6TLBCRS6.js.map +0 -1
- package/dist/chunk-BPD5DCFP.js.map +0 -1
- package/dist/chunk-EFXCJ5AN.js +0 -234
- package/dist/chunk-EFXCJ5AN.js.map +0 -1
- package/dist/chunk-FIITITXO.js +0 -492
- package/dist/chunk-FIITITXO.js.map +0 -1
- package/dist/chunk-RARJGZA3.js.map +0 -1
|
@@ -1,230 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NativeText, NativeButton, useGenesisModules,
|
|
3
|
-
import {
|
|
1
|
+
import { composeHeaderOptions, ScreenContainer, NavBarSaveButton } from './chunk-6JBNSW4D.js';
|
|
2
|
+
import { NativeText, NativeListItem, NativeButton, useGenesisModules, NativeSectionListHeader, NativeEmptyState, NativeInput } from './chunk-3S5XVER4.js';
|
|
3
|
+
import { useThemeRoles, useThemeMode } from './chunk-Z3AQYVUA.js';
|
|
4
4
|
import { cn } from './chunk-OHZD7KRO.js';
|
|
5
|
-
import { ScrollView, View, StatusBar, Pressable, Text, TextInput, Platform, StyleSheet, Alert, KeyboardAvoidingView, RefreshControl, SectionList, ActivityIndicator, FlatList, Image } from 'react-native';
|
|
6
|
-
import { SafeAreaView, SafeAreaInsetsContext } from 'react-native-safe-area-context';
|
|
7
|
-
import { jsx, jsxs, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
8
|
-
import { nativeColors } from '@marktiderman/genesis-design-system/tokens/native';
|
|
9
5
|
import { createContext, Fragment, useState, useMemo, createElement, useContext, useCallback, useRef, useEffect } from 'react';
|
|
10
6
|
import { renderSlot } from '@marktiderman/genesis-core/slots';
|
|
7
|
+
import { Platform, View, StyleSheet, Alert, KeyboardAvoidingView, ScrollView, RefreshControl, SectionList, Pressable, Image, TextInput, ActivityIndicator, Text } from 'react-native';
|
|
8
|
+
import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
9
|
+
import { SafeAreaInsetsContext, SafeAreaView } from 'react-native-safe-area-context';
|
|
11
10
|
|
|
12
|
-
function composeHeaderOptions(props) {
|
|
13
|
-
const {
|
|
14
|
-
headerTitle,
|
|
15
|
-
headerLeft,
|
|
16
|
-
headerRight,
|
|
17
|
-
large,
|
|
18
|
-
scrollEdgeBehavior,
|
|
19
|
-
headerOptions
|
|
20
|
-
} = props;
|
|
21
|
-
const opts = {};
|
|
22
|
-
if (headerTitle !== void 0) opts.title = headerTitle;
|
|
23
|
-
if (headerLeft) opts.headerLeft = headerLeft;
|
|
24
|
-
if (headerRight) opts.headerRight = headerRight;
|
|
25
|
-
if (large) {
|
|
26
|
-
opts.headerLargeTitle = true;
|
|
27
|
-
if (scrollEdgeBehavior === "transparent") {
|
|
28
|
-
opts.headerTransparent = true;
|
|
29
|
-
} else if (scrollEdgeBehavior === "opaque") {
|
|
30
|
-
opts.headerLargeTitleShadowVisible = true;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (headerOptions) {
|
|
34
|
-
Object.assign(opts, headerOptions);
|
|
35
|
-
}
|
|
36
|
-
return opts;
|
|
37
|
-
}
|
|
38
|
-
var DEFAULT_EDGES = ["left", "right"];
|
|
39
|
-
var TRANSLUCENT_ANDROID_BAR = { translucent: true, backgroundColor: "transparent" };
|
|
40
|
-
function resolveBarStyle(statusBar, resolvedMode) {
|
|
41
|
-
if (statusBar === "auto") {
|
|
42
|
-
return resolvedMode === "dark" ? "light-content" : "dark-content";
|
|
43
|
-
}
|
|
44
|
-
if (statusBar === "light") return "light-content";
|
|
45
|
-
if (statusBar === "dark") return "dark-content";
|
|
46
|
-
return "default";
|
|
47
|
-
}
|
|
48
|
-
function ScreenContainer({
|
|
49
|
-
children,
|
|
50
|
-
scroll = false,
|
|
51
|
-
safeAreaEdges = DEFAULT_EDGES,
|
|
52
|
-
statusBar = "auto",
|
|
53
|
-
themeMode = "system",
|
|
54
|
-
className,
|
|
55
|
-
contentClassName,
|
|
56
|
-
keyboardShouldPersistTaps = "handled",
|
|
57
|
-
style,
|
|
58
|
-
testID
|
|
59
|
-
}) {
|
|
60
|
-
const osMode = useThemeMode();
|
|
61
|
-
const resolvedMode = themeMode === "system" ? osMode : themeMode;
|
|
62
|
-
const barStyle = resolveBarStyle(statusBar, resolvedMode);
|
|
63
|
-
const body = scroll ? /* @__PURE__ */ jsx(
|
|
64
|
-
ScrollView,
|
|
65
|
-
{
|
|
66
|
-
testID: testID ? `${testID}-scroll` : void 0,
|
|
67
|
-
keyboardShouldPersistTaps,
|
|
68
|
-
contentInsetAdjustmentBehavior: "automatic",
|
|
69
|
-
contentContainerClassName: cn("flex-grow", contentClassName),
|
|
70
|
-
children
|
|
71
|
-
}
|
|
72
|
-
) : /* @__PURE__ */ jsx(
|
|
73
|
-
View,
|
|
74
|
-
{
|
|
75
|
-
testID: testID ? `${testID}-body` : void 0,
|
|
76
|
-
className: cn("flex-1", contentClassName),
|
|
77
|
-
children
|
|
78
|
-
}
|
|
79
|
-
);
|
|
80
|
-
return /* @__PURE__ */ jsxs(
|
|
81
|
-
SafeAreaView,
|
|
82
|
-
{
|
|
83
|
-
testID: testID ?? "screen-container",
|
|
84
|
-
edges: safeAreaEdges,
|
|
85
|
-
className: cn("flex-1 bg-background", className),
|
|
86
|
-
style,
|
|
87
|
-
children: [
|
|
88
|
-
statusBar !== "hidden" ? /* @__PURE__ */ jsx(
|
|
89
|
-
StatusBar,
|
|
90
|
-
{
|
|
91
|
-
barStyle,
|
|
92
|
-
...TRANSLUCENT_ANDROID_BAR
|
|
93
|
-
}
|
|
94
|
-
) : /* @__PURE__ */ jsx(StatusBar, { hidden: true }),
|
|
95
|
-
body
|
|
96
|
-
]
|
|
97
|
-
}
|
|
98
|
-
);
|
|
99
|
-
}
|
|
100
|
-
function NavBarSaveButton({
|
|
101
|
-
onPress,
|
|
102
|
-
label = "Save",
|
|
103
|
-
disabled,
|
|
104
|
-
loading,
|
|
105
|
-
destructive,
|
|
106
|
-
className,
|
|
107
|
-
testID
|
|
108
|
-
}) {
|
|
109
|
-
const isDisabled = !!disabled || !!loading || !onPress;
|
|
110
|
-
return /* @__PURE__ */ jsx(
|
|
111
|
-
Pressable,
|
|
112
|
-
{
|
|
113
|
-
testID: testID ?? "nav-bar-save-button",
|
|
114
|
-
accessibilityRole: "button",
|
|
115
|
-
accessibilityLabel: label,
|
|
116
|
-
accessibilityState: { disabled: isDisabled, busy: !!loading },
|
|
117
|
-
onPress: isDisabled ? void 0 : onPress,
|
|
118
|
-
disabled: isDisabled,
|
|
119
|
-
className: cn("min-h-[44px] justify-center px-3", className),
|
|
120
|
-
hitSlop: 8,
|
|
121
|
-
children: /* @__PURE__ */ jsx(
|
|
122
|
-
Text,
|
|
123
|
-
{
|
|
124
|
-
className: cn(
|
|
125
|
-
"text-base font-semibold",
|
|
126
|
-
destructive ? "text-destructive" : "text-primary",
|
|
127
|
-
isDisabled && "opacity-40"
|
|
128
|
-
),
|
|
129
|
-
children: loading ? "\u2026" : label
|
|
130
|
-
}
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
function NavBarTitle({
|
|
136
|
-
title,
|
|
137
|
-
subtitle,
|
|
138
|
-
onPress,
|
|
139
|
-
className,
|
|
140
|
-
testID
|
|
141
|
-
}) {
|
|
142
|
-
const inner = /* @__PURE__ */ jsxs(View, { className: cn("items-center justify-center", className), children: [
|
|
143
|
-
/* @__PURE__ */ jsx(
|
|
144
|
-
Text,
|
|
145
|
-
{
|
|
146
|
-
testID: testID ? `${testID}-title` : void 0,
|
|
147
|
-
className: "text-base font-semibold text-foreground",
|
|
148
|
-
numberOfLines: 1,
|
|
149
|
-
children: title
|
|
150
|
-
}
|
|
151
|
-
),
|
|
152
|
-
subtitle ? /* @__PURE__ */ jsx(
|
|
153
|
-
Text,
|
|
154
|
-
{
|
|
155
|
-
testID: testID ? `${testID}-subtitle` : void 0,
|
|
156
|
-
className: "text-xs text-muted-foreground",
|
|
157
|
-
numberOfLines: 1,
|
|
158
|
-
children: subtitle
|
|
159
|
-
}
|
|
160
|
-
) : null
|
|
161
|
-
] });
|
|
162
|
-
if (onPress) {
|
|
163
|
-
return /* @__PURE__ */ jsx(
|
|
164
|
-
Pressable,
|
|
165
|
-
{
|
|
166
|
-
testID: testID ?? "nav-bar-title",
|
|
167
|
-
accessibilityRole: "button",
|
|
168
|
-
accessibilityLabel: subtitle ? `${title}, ${subtitle}` : title,
|
|
169
|
-
onPress,
|
|
170
|
-
hitSlop: 8,
|
|
171
|
-
children: inner
|
|
172
|
-
}
|
|
173
|
-
);
|
|
174
|
-
}
|
|
175
|
-
return /* @__PURE__ */ jsx(View, { testID: testID ?? "nav-bar-title", accessibilityRole: "header", children: inner });
|
|
176
|
-
}
|
|
177
|
-
function NavBarSearchBar({
|
|
178
|
-
value,
|
|
179
|
-
onChangeText,
|
|
180
|
-
placeholder = "Search",
|
|
181
|
-
onSubmit,
|
|
182
|
-
clearable = true,
|
|
183
|
-
className,
|
|
184
|
-
testID
|
|
185
|
-
}) {
|
|
186
|
-
return /* @__PURE__ */ jsxs(
|
|
187
|
-
View,
|
|
188
|
-
{
|
|
189
|
-
testID: testID ?? "nav-bar-search",
|
|
190
|
-
className: cn(
|
|
191
|
-
"min-h-[36px] flex-row items-center rounded-full bg-muted px-3",
|
|
192
|
-
className
|
|
193
|
-
),
|
|
194
|
-
children: [
|
|
195
|
-
/* @__PURE__ */ jsx(
|
|
196
|
-
TextInput,
|
|
197
|
-
{
|
|
198
|
-
testID: testID ? `${testID}-input` : void 0,
|
|
199
|
-
accessibilityLabel: placeholder,
|
|
200
|
-
value,
|
|
201
|
-
onChangeText,
|
|
202
|
-
onSubmitEditing: onSubmit,
|
|
203
|
-
placeholder,
|
|
204
|
-
placeholderTextColor: nativeColors.neutral[400],
|
|
205
|
-
returnKeyType: "search",
|
|
206
|
-
autoCorrect: false,
|
|
207
|
-
autoCapitalize: "none",
|
|
208
|
-
clearButtonMode: clearable ? "while-editing" : "never",
|
|
209
|
-
className: "flex-1 text-base text-foreground"
|
|
210
|
-
}
|
|
211
|
-
),
|
|
212
|
-
clearable && value.length > 0 ? /* @__PURE__ */ jsx(
|
|
213
|
-
Pressable,
|
|
214
|
-
{
|
|
215
|
-
testID: testID ? `${testID}-clear` : void 0,
|
|
216
|
-
accessibilityRole: "button",
|
|
217
|
-
accessibilityLabel: "Clear search",
|
|
218
|
-
onPress: () => onChangeText(""),
|
|
219
|
-
hitSlop: 8,
|
|
220
|
-
className: "ml-2 px-1",
|
|
221
|
-
children: /* @__PURE__ */ jsx(Text, { className: "text-base text-muted-foreground", children: "\xD7" })
|
|
222
|
-
}
|
|
223
|
-
) : null
|
|
224
|
-
]
|
|
225
|
-
}
|
|
226
|
-
);
|
|
227
|
-
}
|
|
228
11
|
function getSettingsPageStackOptions(props) {
|
|
229
12
|
return composeHeaderOptions({
|
|
230
13
|
headerTitle: props.headerTitle ?? "Settings",
|
|
@@ -759,253 +542,6 @@ function UnreadDot({
|
|
|
759
542
|
}
|
|
760
543
|
);
|
|
761
544
|
}
|
|
762
|
-
function getInboxPageStackOptions(props) {
|
|
763
|
-
return composeHeaderOptions({
|
|
764
|
-
headerTitle: props.headerTitle ?? "Inbox",
|
|
765
|
-
large: props.large ?? true,
|
|
766
|
-
scrollEdgeBehavior: props.scrollEdgeBehavior ?? "match",
|
|
767
|
-
headerLeft: props.headerLeft,
|
|
768
|
-
headerRight: props.headerRight,
|
|
769
|
-
headerOptions: props.headerOptions
|
|
770
|
-
});
|
|
771
|
-
}
|
|
772
|
-
var DAY_MS = 24 * 60 * 60 * 1e3;
|
|
773
|
-
function formatInboxTime(date, now) {
|
|
774
|
-
const start = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
775
|
-
const days = Math.round((start(now) - start(date)) / DAY_MS);
|
|
776
|
-
if (days <= 0) return date.toLocaleTimeString(void 0, { hour: "numeric", minute: "2-digit" });
|
|
777
|
-
if (days === 1) return "Yesterday";
|
|
778
|
-
if (days < 7) return date.toLocaleDateString(void 0, { weekday: "long" });
|
|
779
|
-
return date.toLocaleDateString(void 0, { day: "numeric", month: "short", year: date.getFullYear() === now.getFullYear() ? void 0 : "numeric" });
|
|
780
|
-
}
|
|
781
|
-
var ROW_PADDING = 16;
|
|
782
|
-
var LEADING_WIDTH = 18;
|
|
783
|
-
var DEFAULT_AVATAR = 40;
|
|
784
|
-
var AVATAR_GAP = 12;
|
|
785
|
-
var IOS_GROUP_MARGIN2 = 16;
|
|
786
|
-
function iosGroupRadius2() {
|
|
787
|
-
return Number.parseFloat(String(Platform.Version)) >= 26 ? 26 : 10;
|
|
788
|
-
}
|
|
789
|
-
function InboxPage({
|
|
790
|
-
items,
|
|
791
|
-
refreshing,
|
|
792
|
-
onRefresh,
|
|
793
|
-
onEndReached,
|
|
794
|
-
loadingMore = false,
|
|
795
|
-
header,
|
|
796
|
-
sectionTitle,
|
|
797
|
-
emptyTitle,
|
|
798
|
-
emptyBody,
|
|
799
|
-
emptyActionLabel,
|
|
800
|
-
onEmptyAction,
|
|
801
|
-
loading = false,
|
|
802
|
-
error = false,
|
|
803
|
-
errorTitle,
|
|
804
|
-
errorBody,
|
|
805
|
-
formatTime = formatInboxTime,
|
|
806
|
-
now = () => /* @__PURE__ */ new Date(),
|
|
807
|
-
slots = {},
|
|
808
|
-
slotProps = {},
|
|
809
|
-
testID = "inbox-page"
|
|
810
|
-
}) {
|
|
811
|
-
const colors = useThemeRoles();
|
|
812
|
-
const clock = now();
|
|
813
|
-
const rows = items.map((item, index) => ({
|
|
814
|
-
...item,
|
|
815
|
-
testID: item.testID ?? `${testID}-row-${item.id}`,
|
|
816
|
-
isFirst: index === 0,
|
|
817
|
-
isLast: index === items.length - 1,
|
|
818
|
-
timeLabel: item.timestamp ? formatTime(typeof item.timestamp === "string" ? new Date(item.timestamp) : item.timestamp, clock) : null
|
|
819
|
-
}));
|
|
820
|
-
const headerNode = /* @__PURE__ */ jsxs(View, { children: [
|
|
821
|
-
header ?? renderSlot(EmptyPart, slots.header, { testID: `${testID}-header` }, slotProps.header),
|
|
822
|
-
sectionTitle ? /* @__PURE__ */ jsx(SectionTitle, { title: sectionTitle, testID: `${testID}-section-title` }) : null
|
|
823
|
-
] });
|
|
824
|
-
const refreshControl = onRefresh ? /* @__PURE__ */ jsx(NativeRefreshControl, { testID: `${testID}-refresh`, refreshing: !!refreshing, onRefresh: () => void onRefresh() }) : void 0;
|
|
825
|
-
if (items.length === 0) {
|
|
826
|
-
return /* @__PURE__ */ jsx(SafeAreaView, { testID, edges: ["left", "right", "bottom"], style: { flex: 1, backgroundColor: colors.groupedBackground }, children: /* @__PURE__ */ jsxs(
|
|
827
|
-
ScrollView,
|
|
828
|
-
{
|
|
829
|
-
testID: `${testID}-empty-scroll`,
|
|
830
|
-
contentInsetAdjustmentBehavior: "automatic",
|
|
831
|
-
keyboardShouldPersistTaps: "handled",
|
|
832
|
-
contentContainerStyle: { flexGrow: 1, paddingTop: 8, paddingBottom: 32 },
|
|
833
|
-
refreshControl,
|
|
834
|
-
children: [
|
|
835
|
-
headerNode,
|
|
836
|
-
loading ? /* @__PURE__ */ jsx(View, { testID: `${testID}-loading`, style: { paddingVertical: 32 }, children: /* @__PURE__ */ jsx(ActivityIndicator, { accessibilityLabel: "Loading" }) }) : renderSlot(
|
|
837
|
-
DefaultEmpty2,
|
|
838
|
-
slots.empty,
|
|
839
|
-
error ? {
|
|
840
|
-
title: errorTitle ?? "Couldn't load this",
|
|
841
|
-
body: errorBody ?? "Check your connection, then pull to refresh.",
|
|
842
|
-
actionLabel: onRefresh ? "Try again" : void 0,
|
|
843
|
-
onAction: onRefresh ? () => void onRefresh() : void 0,
|
|
844
|
-
testID: `${testID}-error`
|
|
845
|
-
} : {
|
|
846
|
-
title: emptyTitle ?? "Nothing here yet",
|
|
847
|
-
body: emptyBody ?? "When there's something new, it shows up here.",
|
|
848
|
-
actionLabel: emptyActionLabel,
|
|
849
|
-
onAction: onEmptyAction,
|
|
850
|
-
testID: `${testID}-empty`
|
|
851
|
-
},
|
|
852
|
-
slotProps.empty
|
|
853
|
-
)
|
|
854
|
-
]
|
|
855
|
-
}
|
|
856
|
-
) });
|
|
857
|
-
}
|
|
858
|
-
return /* @__PURE__ */ jsx(SafeAreaView, { testID, edges: ["left", "right", "bottom"], style: { flex: 1, backgroundColor: colors.groupedBackground }, children: /* @__PURE__ */ jsx(
|
|
859
|
-
FlatList,
|
|
860
|
-
{
|
|
861
|
-
testID: `${testID}-list`,
|
|
862
|
-
data: rows,
|
|
863
|
-
keyExtractor: (row) => row.id,
|
|
864
|
-
contentInsetAdjustmentBehavior: "automatic",
|
|
865
|
-
keyboardShouldPersistTaps: "handled",
|
|
866
|
-
ListHeaderComponent: headerNode,
|
|
867
|
-
ListFooterComponent: renderSlot(DefaultFooter, slots.footer, { loadingMore, testID: `${testID}-footer` }, slotProps.footer),
|
|
868
|
-
contentContainerStyle: { paddingTop: 8, paddingBottom: 32 },
|
|
869
|
-
onEndReached,
|
|
870
|
-
onEndReachedThreshold: 0.5,
|
|
871
|
-
refreshControl,
|
|
872
|
-
renderItem: ({ item: row }) => {
|
|
873
|
-
const content = renderSlot(DefaultRow3, slots.row, row, slotProps.row);
|
|
874
|
-
const actions = row.swipeActions ?? [];
|
|
875
|
-
return /* @__PURE__ */ jsx(Fragment, { children: actions.length && slots.swipeable !== null ? renderSlot(PassThroughSwipeable, slots.swipeable, { actions, testID: `${row.testID}-swipe`, children: content }, slotProps.swipeable) : content });
|
|
876
|
-
}
|
|
877
|
-
}
|
|
878
|
-
) });
|
|
879
|
-
}
|
|
880
|
-
function EmptyPart(_props) {
|
|
881
|
-
return null;
|
|
882
|
-
}
|
|
883
|
-
function PassThroughSwipeable({ children }) {
|
|
884
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
885
|
-
}
|
|
886
|
-
function SectionTitle({ title, testID }) {
|
|
887
|
-
const colors = useThemeRoles();
|
|
888
|
-
const ios = Platform.OS === "ios";
|
|
889
|
-
return /* @__PURE__ */ jsx(
|
|
890
|
-
NativeText,
|
|
891
|
-
{
|
|
892
|
-
testID,
|
|
893
|
-
accessibilityRole: "header",
|
|
894
|
-
className: ios ? "px-4 pb-1.5 pt-2" : "px-4 pb-2 pt-4 text-primary",
|
|
895
|
-
style: ios ? { marginHorizontal: IOS_GROUP_MARGIN2, color: colors.secondaryLabel, fontSize: 13, lineHeight: 18, textTransform: "uppercase" } : { fontSize: 14, lineHeight: 20, fontWeight: "500" },
|
|
896
|
-
children: title
|
|
897
|
-
}
|
|
898
|
-
);
|
|
899
|
-
}
|
|
900
|
-
function showInboxActions(title, actions, cancelLabel = "Cancel") {
|
|
901
|
-
Alert.alert(title, void 0, [
|
|
902
|
-
...actions.map((a) => ({ text: a.label, style: a.destructive ? "destructive" : "default", onPress: a.onPress })),
|
|
903
|
-
{ text: cancelLabel, style: "cancel" }
|
|
904
|
-
]);
|
|
905
|
-
}
|
|
906
|
-
function DefaultRow3(row) {
|
|
907
|
-
const colors = useThemeRoles();
|
|
908
|
-
const ios = Platform.OS === "ios";
|
|
909
|
-
const [pressed, setPressed] = useState(false);
|
|
910
|
-
const actions = row.swipeActions ?? [];
|
|
911
|
-
const radius = iosGroupRadius2();
|
|
912
|
-
const unreadLabel = row.unreadCount && row.unreadCount > 0 ? `${row.unreadCount} unread` : row.unread ? "Unread" : null;
|
|
913
|
-
const label = [unreadLabel, row.avatar ? row.avatarLabel : null, row.title, row.timeLabel, row.preview, row.meta].filter(Boolean).join(", ");
|
|
914
|
-
const [avatarWidth, setAvatarWidth] = useState(0);
|
|
915
|
-
const separatorInset = ROW_PADDING + LEADING_WIDTH + (row.avatar ? (avatarWidth || DEFAULT_AVATAR) + AVATAR_GAP : 0);
|
|
916
|
-
return /* @__PURE__ */ jsxs(
|
|
917
|
-
View,
|
|
918
|
-
{
|
|
919
|
-
testID: `${row.testID}-cell`,
|
|
920
|
-
style: [
|
|
921
|
-
{ backgroundColor: colors.surface },
|
|
922
|
-
ios ? {
|
|
923
|
-
marginHorizontal: IOS_GROUP_MARGIN2,
|
|
924
|
-
borderTopLeftRadius: row.isFirst ? radius : 0,
|
|
925
|
-
borderTopRightRadius: row.isFirst ? radius : 0,
|
|
926
|
-
borderBottomLeftRadius: row.isLast ? radius : 0,
|
|
927
|
-
borderBottomRightRadius: row.isLast ? radius : 0,
|
|
928
|
-
overflow: "hidden"
|
|
929
|
-
} : null
|
|
930
|
-
],
|
|
931
|
-
children: [
|
|
932
|
-
/* @__PURE__ */ jsxs(
|
|
933
|
-
Pressable,
|
|
934
|
-
{
|
|
935
|
-
testID: row.testID,
|
|
936
|
-
accessibilityRole: row.onPress ? "button" : void 0,
|
|
937
|
-
accessibilityLabel: label,
|
|
938
|
-
accessibilityActions: actions.map((a) => ({ name: a.id, label: a.label })),
|
|
939
|
-
onAccessibilityAction: (event) => actions.find((a) => a.id === event.nativeEvent.actionName)?.onPress(),
|
|
940
|
-
onPress: row.onPress,
|
|
941
|
-
onLongPress: actions.length ? () => showInboxActions(row.title, actions) : void 0,
|
|
942
|
-
onPressIn: () => setPressed(true),
|
|
943
|
-
onPressOut: () => setPressed(false),
|
|
944
|
-
style: { flexDirection: "row", alignItems: "center", paddingHorizontal: ROW_PADDING, paddingVertical: 11, minHeight: 60, backgroundColor: pressed && row.onPress ? colors.fill : void 0 },
|
|
945
|
-
children: [
|
|
946
|
-
/* @__PURE__ */ jsx(View, { style: { width: LEADING_WIDTH, alignItems: "flex-start" }, children: row.leading ?? (row.unreadCount && row.unreadCount > 0 ? null : /* @__PURE__ */ jsx(UnreadDot2, { unread: !!row.unread, testID: `${row.testID}-unread`, color: colors.tint })) }),
|
|
947
|
-
row.avatar ? /* @__PURE__ */ jsx(
|
|
948
|
-
View,
|
|
949
|
-
{
|
|
950
|
-
testID: `${row.testID}-avatar`,
|
|
951
|
-
accessibilityElementsHidden: true,
|
|
952
|
-
importantForAccessibility: "no-hide-descendants",
|
|
953
|
-
onLayout: (e) => setAvatarWidth(Math.round(e.nativeEvent.layout.width)),
|
|
954
|
-
style: { marginRight: AVATAR_GAP },
|
|
955
|
-
children: row.avatar
|
|
956
|
-
}
|
|
957
|
-
) : null,
|
|
958
|
-
/* @__PURE__ */ jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [
|
|
959
|
-
/* @__PURE__ */ jsxs(View, { style: { flexDirection: "row", alignItems: "baseline" }, children: [
|
|
960
|
-
/* @__PURE__ */ jsx(
|
|
961
|
-
NativeText,
|
|
962
|
-
{
|
|
963
|
-
numberOfLines: 1,
|
|
964
|
-
style: { flex: 1, color: colors.label, fontSize: 17, lineHeight: 22, fontWeight: row.unread || (row.unreadCount ?? 0) > 0 ? "600" : "400" },
|
|
965
|
-
children: row.title
|
|
966
|
-
}
|
|
967
|
-
),
|
|
968
|
-
row.timeLabel ? /* @__PURE__ */ jsx(NativeText, { testID: `${row.testID}-time`, style: { marginLeft: 8, color: colors.secondaryLabel, fontSize: 15, lineHeight: 20 }, children: row.timeLabel }) : null
|
|
969
|
-
] }),
|
|
970
|
-
row.preview ? /* @__PURE__ */ jsx(NativeText, { numberOfLines: 2, style: { marginTop: 2, color: colors.secondaryLabel, fontSize: 15, lineHeight: 20 }, children: row.preview }) : null,
|
|
971
|
-
row.meta ? /* @__PURE__ */ jsx(NativeText, { testID: `${row.testID}-meta`, style: { marginTop: 4, color: colors.tertiaryLabel, fontSize: 13, lineHeight: 18 }, children: row.meta }) : null
|
|
972
|
-
] }),
|
|
973
|
-
row.unreadCount && row.unreadCount > 0 ? /* @__PURE__ */ jsx(View, { style: { marginLeft: 8 }, children: /* @__PURE__ */ jsx(NativeBadge, { testID: `${row.testID}-count`, children: String(row.unreadCount) }) }) : null,
|
|
974
|
-
row.trailing ? /* @__PURE__ */ jsx(View, { style: { marginLeft: 8 }, children: row.trailing }) : row.onPress ? /* @__PURE__ */ jsx(Chevron, { color: colors.tertiaryLabel }) : null
|
|
975
|
-
]
|
|
976
|
-
}
|
|
977
|
-
),
|
|
978
|
-
row.isLast ? null : /* @__PURE__ */ jsxs(View, { accessibilityElementsHidden: true, importantForAccessibility: "no-hide-descendants", style: { flexDirection: "row", height: StyleSheet.hairlineWidth }, children: [
|
|
979
|
-
/* @__PURE__ */ jsx(View, { testID: `${row.testID}-separator-inset`, style: { width: separatorInset } }),
|
|
980
|
-
/* @__PURE__ */ jsx(View, { testID: `${row.testID}-separator-line`, style: { flex: 1, backgroundColor: colors.separator } })
|
|
981
|
-
] })
|
|
982
|
-
]
|
|
983
|
-
}
|
|
984
|
-
);
|
|
985
|
-
}
|
|
986
|
-
function Chevron({ color }) {
|
|
987
|
-
return /* @__PURE__ */ jsx(NativeText, { accessibilityElementsHidden: true, importantForAccessibility: "no", style: { marginLeft: 8, color, fontSize: 20, lineHeight: 22 }, children: "\u203A" });
|
|
988
|
-
}
|
|
989
|
-
function UnreadDot2({ unread, testID, color }) {
|
|
990
|
-
if (!unread) return /* @__PURE__ */ jsx(View, { testID, style: { width: 10, height: 10 } });
|
|
991
|
-
return /* @__PURE__ */ jsx(View, { testID, style: { width: 10, height: 10, borderRadius: 5, backgroundColor: color } });
|
|
992
|
-
}
|
|
993
|
-
function DefaultFooter({ loadingMore, testID }) {
|
|
994
|
-
if (!loadingMore) return null;
|
|
995
|
-
return /* @__PURE__ */ jsx(View, { testID, style: { paddingVertical: 16 }, children: /* @__PURE__ */ jsx(ActivityIndicator, { accessibilityLabel: "Loading more" }) });
|
|
996
|
-
}
|
|
997
|
-
function DefaultEmpty2({ title, body, actionLabel, onAction, testID }) {
|
|
998
|
-
return /* @__PURE__ */ jsx(
|
|
999
|
-
NativeEmptyState,
|
|
1000
|
-
{
|
|
1001
|
-
variant: "first-run",
|
|
1002
|
-
title,
|
|
1003
|
-
body,
|
|
1004
|
-
testID,
|
|
1005
|
-
primaryAction: actionLabel && onAction ? /* @__PURE__ */ jsx(NativeButton, { onPress: onAction, testID: `${testID}-action`, children: actionLabel }) : void 0
|
|
1006
|
-
}
|
|
1007
|
-
);
|
|
1008
|
-
}
|
|
1009
545
|
var DEFAULT_LABELS = { you: "You", sending: "Sending", notSent: "Not sent. Tap to retry.", retryHint: "Double tap to send again" };
|
|
1010
546
|
function getThreadPageStackOptions(props) {
|
|
1011
547
|
return composeHeaderOptions({
|
|
@@ -1067,7 +603,7 @@ function ThreadPage({
|
|
|
1067
603
|
slotProps.earlier
|
|
1068
604
|
) : null,
|
|
1069
605
|
/* @__PURE__ */ jsx(View, { testID: `${testID}-messages`, accessibilityRole: "list", style: { flexGrow: 1, justifyContent: "flex-end", paddingHorizontal: 12, paddingVertical: 8, gap: 6 }, children: messages.length === 0 ? renderSlot(
|
|
1070
|
-
|
|
606
|
+
DefaultEmpty2,
|
|
1071
607
|
slots.empty,
|
|
1072
608
|
{ title: emptyTitle ?? "No messages yet", body: emptyBody ?? "Write the first one below.", testID: `${testID}-empty` },
|
|
1073
609
|
slotProps.empty
|
|
@@ -1143,7 +679,7 @@ function Nothing(_props) {
|
|
|
1143
679
|
function DefaultEarlier({ loading, onPress, label, testID }) {
|
|
1144
680
|
return /* @__PURE__ */ jsx(View, { style: { alignItems: "center", paddingTop: 8 }, children: /* @__PURE__ */ jsx(NativeButton, { variant: "ghost", size: "sm", onPress, loading, testID, children: label }) });
|
|
1145
681
|
}
|
|
1146
|
-
function
|
|
682
|
+
function DefaultEmpty2({ title, body, testID }) {
|
|
1147
683
|
return /* @__PURE__ */ jsx(NativeEmptyState, { variant: "first-run", title, body, testID });
|
|
1148
684
|
}
|
|
1149
685
|
var MINE_TEXT = { fontSize: 17, lineHeight: 22 };
|
|
@@ -1481,7 +1017,7 @@ function AuthScreen({
|
|
|
1481
1017
|
branding ? renderSlot(AuthBranding, slots.branding, { ...branding, testID: branding.testID ?? `${testID}-branding` }, slotProps.branding) : null,
|
|
1482
1018
|
providers?.length ? renderSlot(DefaultSocial, slots.social, { providers, testID: `${testID}-social` }, slotProps.social) : null,
|
|
1483
1019
|
renderSlot(AuthForm, slots.form, formProps, slotProps.form),
|
|
1484
|
-
footer ? renderSlot(
|
|
1020
|
+
footer ? renderSlot(DefaultFooter, slots.footer, { children: footer, testID: `${testID}-footer` }, slotProps.footer) : null
|
|
1485
1021
|
] });
|
|
1486
1022
|
if (KeyboardScroll) {
|
|
1487
1023
|
return /* @__PURE__ */ jsxs(ScreenContainer, { testID, children: [
|
|
@@ -1516,7 +1052,7 @@ function warnIfNoAppleSignIn(providers) {
|
|
|
1516
1052
|
function DefaultSocial({ providers, testID }) {
|
|
1517
1053
|
return /* @__PURE__ */ jsx(SocialAuthRow, { providers, testID });
|
|
1518
1054
|
}
|
|
1519
|
-
function
|
|
1055
|
+
function DefaultFooter({ children, testID }) {
|
|
1520
1056
|
return /* @__PURE__ */ jsx(View, { testID, className: "items-center", children });
|
|
1521
1057
|
}
|
|
1522
1058
|
function AppleSignInButton({
|
|
@@ -1582,6 +1118,6 @@ function googleProvider({ onPress, label = "Continue with Google", icon, disable
|
|
|
1582
1118
|
return { id: "google", label, icon, onPress, disabled };
|
|
1583
1119
|
}
|
|
1584
1120
|
|
|
1585
|
-
export { AppleSignInButton, AuthBranding, AuthForm, AuthScreen, ForgotPasswordLink,
|
|
1586
|
-
//# sourceMappingURL=chunk-
|
|
1587
|
-
//# sourceMappingURL=chunk-
|
|
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, readReceiptFor, useKeyboardScroll, useKeyboardToolbar };
|
|
1122
|
+
//# sourceMappingURL=chunk-VMSIKSU2.js.map
|
|
1123
|
+
//# sourceMappingURL=chunk-VMSIKSU2.js.map
|