@gaozh1024/rn-kit 0.2.0 → 0.3.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 +115 -1
- package/dist/index.d.mts +90 -2
- package/dist/index.d.ts +90 -2
- package/dist/index.js +616 -389
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +506 -282
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
package/dist/index.mjs
CHANGED
|
@@ -960,6 +960,29 @@ function resolveTextTone(tone, theme, isDark) {
|
|
|
960
960
|
return void 0;
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
|
+
var textUtilityTokens = /* @__PURE__ */ new Set([
|
|
964
|
+
"text-left",
|
|
965
|
+
"text-center",
|
|
966
|
+
"text-right",
|
|
967
|
+
"text-justify",
|
|
968
|
+
"text-auto",
|
|
969
|
+
"text-wrap",
|
|
970
|
+
"text-nowrap",
|
|
971
|
+
"text-balance",
|
|
972
|
+
"text-pretty",
|
|
973
|
+
"text-ellipsis",
|
|
974
|
+
"text-clip"
|
|
975
|
+
]);
|
|
976
|
+
var textSizePattern = /^text-(xs|sm|base|lg|xl|[2-9]xl)$/;
|
|
977
|
+
function hasExplicitTextColorClass(className) {
|
|
978
|
+
if (!className) return false;
|
|
979
|
+
return className.split(/\s+/).some((token) => {
|
|
980
|
+
if (!token.startsWith("text-")) return false;
|
|
981
|
+
if (textUtilityTokens.has(token)) return false;
|
|
982
|
+
if (textSizePattern.test(token)) return false;
|
|
983
|
+
return true;
|
|
984
|
+
});
|
|
985
|
+
}
|
|
963
986
|
|
|
964
987
|
// src/ui/primitives/AppView.tsx
|
|
965
988
|
import { jsx as jsx2 } from "nativewind/jsx-runtime";
|
|
@@ -1052,7 +1075,7 @@ function AppScrollView({
|
|
|
1052
1075
|
}
|
|
1053
1076
|
|
|
1054
1077
|
// src/ui/primitives/AppText.tsx
|
|
1055
|
-
import { Text } from "react-native";
|
|
1078
|
+
import { StyleSheet, Text } from "react-native";
|
|
1056
1079
|
import { jsx as jsx4 } from "nativewind/jsx-runtime";
|
|
1057
1080
|
function AppText({
|
|
1058
1081
|
size = "md",
|
|
@@ -1065,6 +1088,9 @@ function AppText({
|
|
|
1065
1088
|
...props
|
|
1066
1089
|
}) {
|
|
1067
1090
|
const { theme, isDark } = useOptionalTheme();
|
|
1091
|
+
const flattenedStyle = StyleSheet.flatten(style);
|
|
1092
|
+
const hasExplicitStyleColor = flattenedStyle?.color !== void 0;
|
|
1093
|
+
const hasExplicitClassColor = hasExplicitTextColorClass(className);
|
|
1068
1094
|
const sizeMap3 = {
|
|
1069
1095
|
xs: "text-xs",
|
|
1070
1096
|
sm: "text-sm",
|
|
@@ -1080,12 +1106,18 @@ function AppText({
|
|
|
1080
1106
|
semibold: "font-semibold",
|
|
1081
1107
|
bold: "font-bold"
|
|
1082
1108
|
};
|
|
1083
|
-
const
|
|
1109
|
+
const fallbackTone = tone ?? (color || hasExplicitStyleColor || hasExplicitClassColor ? void 0 : "default");
|
|
1110
|
+
const resolvedColor = resolveTextTone(fallbackTone, theme, isDark) ?? resolveNamedColor(color, theme, isDark);
|
|
1084
1111
|
const shouldUseClassColor = !!color && !resolvedColor;
|
|
1085
1112
|
return /* @__PURE__ */ jsx4(
|
|
1086
1113
|
Text,
|
|
1087
1114
|
{
|
|
1088
|
-
className: cn(
|
|
1115
|
+
className: cn(
|
|
1116
|
+
sizeMap3[size],
|
|
1117
|
+
weightMap[weight],
|
|
1118
|
+
shouldUseClassColor && `text-${color}`,
|
|
1119
|
+
className
|
|
1120
|
+
),
|
|
1089
1121
|
style: [resolvedColor ? { color: resolvedColor } : void 0, style],
|
|
1090
1122
|
...props,
|
|
1091
1123
|
children
|
|
@@ -1167,7 +1199,7 @@ function Center({ flex = true, ...props }) {
|
|
|
1167
1199
|
}
|
|
1168
1200
|
|
|
1169
1201
|
// src/ui/layout/SafeScreen.tsx
|
|
1170
|
-
import { View as View2, StyleSheet } from "react-native";
|
|
1202
|
+
import { View as View2, StyleSheet as StyleSheet2 } from "react-native";
|
|
1171
1203
|
import { useSafeAreaInsets } from "react-native-safe-area-context";
|
|
1172
1204
|
import { jsx as jsx9 } from "nativewind/jsx-runtime";
|
|
1173
1205
|
function SafeScreen({
|
|
@@ -1206,7 +1238,7 @@ function SafeScreen({
|
|
|
1206
1238
|
}
|
|
1207
1239
|
);
|
|
1208
1240
|
}
|
|
1209
|
-
var styles =
|
|
1241
|
+
var styles = StyleSheet2.create({
|
|
1210
1242
|
flex: {
|
|
1211
1243
|
flex: 1
|
|
1212
1244
|
}
|
|
@@ -1284,7 +1316,7 @@ function Toast({ message, type = "info", visible = true }) {
|
|
|
1284
1316
|
|
|
1285
1317
|
// src/ui/feedback/Alert.tsx
|
|
1286
1318
|
import { useCallback as useCallback9 } from "react";
|
|
1287
|
-
import { Modal, TouchableOpacity, StyleSheet as
|
|
1319
|
+
import { Modal, TouchableOpacity, StyleSheet as StyleSheet3 } from "react-native";
|
|
1288
1320
|
import { jsx as jsx12, jsxs } from "nativewind/jsx-runtime";
|
|
1289
1321
|
function Alert({ visible, title, message, buttons, onClose }) {
|
|
1290
1322
|
const { theme, isDark } = useTheme();
|
|
@@ -1433,7 +1465,7 @@ function Alert({ visible, title, message, buttons, onClose }) {
|
|
|
1433
1465
|
}
|
|
1434
1466
|
);
|
|
1435
1467
|
}
|
|
1436
|
-
var styles2 =
|
|
1468
|
+
var styles2 = StyleSheet3.create({
|
|
1437
1469
|
singleButton: {
|
|
1438
1470
|
borderBottomLeftRadius: 12,
|
|
1439
1471
|
borderBottomRightRadius: 12
|
|
@@ -1450,13 +1482,7 @@ var styles2 = StyleSheet2.create({
|
|
|
1450
1482
|
// src/ui/feedback/Loading.tsx
|
|
1451
1483
|
import { ActivityIndicator as ActivityIndicator2 } from "react-native";
|
|
1452
1484
|
import { jsx as jsx13, jsxs as jsxs2 } from "nativewind/jsx-runtime";
|
|
1453
|
-
function Loading({
|
|
1454
|
-
text,
|
|
1455
|
-
color,
|
|
1456
|
-
overlay = false,
|
|
1457
|
-
visible = true,
|
|
1458
|
-
testID
|
|
1459
|
-
}) {
|
|
1485
|
+
function Loading({ text, color, overlay = false, visible = true, testID }) {
|
|
1460
1486
|
if (!visible) return null;
|
|
1461
1487
|
const content = /* @__PURE__ */ jsxs2(AppView, { center: true, gap: 3, testID, children: [
|
|
1462
1488
|
/* @__PURE__ */ jsx13(ActivityIndicator2, { size: "large", color }),
|
|
@@ -1786,7 +1812,7 @@ import {
|
|
|
1786
1812
|
FlatList,
|
|
1787
1813
|
RefreshControl,
|
|
1788
1814
|
ActivityIndicator as ActivityIndicator4,
|
|
1789
|
-
StyleSheet as
|
|
1815
|
+
StyleSheet as StyleSheet4
|
|
1790
1816
|
} from "react-native";
|
|
1791
1817
|
import { Fragment, jsx as jsx18, jsxs as jsxs4 } from "nativewind/jsx-runtime";
|
|
1792
1818
|
function SkeletonItem2({ render }) {
|
|
@@ -1974,16 +2000,186 @@ function AppList({
|
|
|
1974
2000
|
}
|
|
1975
2001
|
);
|
|
1976
2002
|
}
|
|
1977
|
-
var styles3 =
|
|
2003
|
+
var styles3 = StyleSheet4.create({
|
|
1978
2004
|
retryButton: {
|
|
1979
2005
|
borderWidth: 0.5
|
|
1980
2006
|
}
|
|
1981
2007
|
});
|
|
1982
2008
|
|
|
2009
|
+
// src/ui/display/PageDrawer.tsx
|
|
2010
|
+
import React5 from "react";
|
|
2011
|
+
import { BackHandler, Modal as Modal2, PanResponder, StyleSheet as StyleSheet5 } from "react-native";
|
|
2012
|
+
import { jsx as jsx19, jsxs as jsxs5 } from "nativewind/jsx-runtime";
|
|
2013
|
+
function PageDrawer({
|
|
2014
|
+
visible,
|
|
2015
|
+
onClose,
|
|
2016
|
+
title,
|
|
2017
|
+
header,
|
|
2018
|
+
footer,
|
|
2019
|
+
placement = "right",
|
|
2020
|
+
width = 320,
|
|
2021
|
+
swipeEnabled = true,
|
|
2022
|
+
swipeThreshold = 80,
|
|
2023
|
+
closeOnBackdropPress = true,
|
|
2024
|
+
showCloseButton = true,
|
|
2025
|
+
children,
|
|
2026
|
+
testID,
|
|
2027
|
+
contentTestID = "page-drawer-content",
|
|
2028
|
+
backdropTestID = "page-drawer-backdrop"
|
|
2029
|
+
}) {
|
|
2030
|
+
const colors = useThemeColors();
|
|
2031
|
+
const [translateX, setTranslateX] = React5.useState(0);
|
|
2032
|
+
if (!visible) return null;
|
|
2033
|
+
const handleClose = React5.useCallback(() => {
|
|
2034
|
+
setTranslateX(0);
|
|
2035
|
+
onClose?.();
|
|
2036
|
+
}, [onClose]);
|
|
2037
|
+
React5.useEffect(() => {
|
|
2038
|
+
if (!visible) return;
|
|
2039
|
+
const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
2040
|
+
handleClose();
|
|
2041
|
+
return true;
|
|
2042
|
+
});
|
|
2043
|
+
return () => subscription.remove();
|
|
2044
|
+
}, [handleClose, visible]);
|
|
2045
|
+
const panResponder = React5.useMemo(
|
|
2046
|
+
() => PanResponder.create({
|
|
2047
|
+
onMoveShouldSetPanResponder: (_event, gestureState) => {
|
|
2048
|
+
if (!swipeEnabled) return false;
|
|
2049
|
+
const isHorizontal = Math.abs(gestureState.dx) > Math.abs(gestureState.dy);
|
|
2050
|
+
const reachesThreshold = Math.abs(gestureState.dx) > 8;
|
|
2051
|
+
return isHorizontal && reachesThreshold;
|
|
2052
|
+
},
|
|
2053
|
+
onPanResponderMove: (_event, gestureState) => {
|
|
2054
|
+
if (!swipeEnabled) return;
|
|
2055
|
+
const nextTranslateX = placement === "right" ? Math.min(0, Math.max(-width, gestureState.dx)) : Math.max(0, Math.min(width, gestureState.dx));
|
|
2056
|
+
setTranslateX(nextTranslateX);
|
|
2057
|
+
},
|
|
2058
|
+
onPanResponderRelease: (_event, gestureState) => {
|
|
2059
|
+
if (!swipeEnabled) {
|
|
2060
|
+
setTranslateX(0);
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
const reachedCloseThreshold = placement === "right" ? gestureState.dx <= -swipeThreshold : gestureState.dx >= swipeThreshold;
|
|
2064
|
+
if (reachedCloseThreshold) {
|
|
2065
|
+
handleClose();
|
|
2066
|
+
return;
|
|
2067
|
+
}
|
|
2068
|
+
setTranslateX(0);
|
|
2069
|
+
},
|
|
2070
|
+
onPanResponderTerminate: () => {
|
|
2071
|
+
setTranslateX(0);
|
|
2072
|
+
}
|
|
2073
|
+
}),
|
|
2074
|
+
[handleClose, placement, swipeEnabled, swipeThreshold, width]
|
|
2075
|
+
);
|
|
2076
|
+
const drawerContent = /* @__PURE__ */ jsxs5(
|
|
2077
|
+
AppView,
|
|
2078
|
+
{
|
|
2079
|
+
testID: contentTestID,
|
|
2080
|
+
className: "h-full",
|
|
2081
|
+
...panResponder.panHandlers,
|
|
2082
|
+
style: [
|
|
2083
|
+
styles4.drawer,
|
|
2084
|
+
{
|
|
2085
|
+
width,
|
|
2086
|
+
backgroundColor: colors.card,
|
|
2087
|
+
borderLeftWidth: placement === "right" ? 0.5 : 0,
|
|
2088
|
+
borderRightWidth: placement === "left" ? 0.5 : 0,
|
|
2089
|
+
borderLeftColor: colors.border,
|
|
2090
|
+
borderRightColor: colors.border,
|
|
2091
|
+
transform: [{ translateX }]
|
|
2092
|
+
}
|
|
2093
|
+
],
|
|
2094
|
+
children: [
|
|
2095
|
+
(header || title || showCloseButton) && /* @__PURE__ */ jsxs5(
|
|
2096
|
+
AppView,
|
|
2097
|
+
{
|
|
2098
|
+
row: true,
|
|
2099
|
+
items: "center",
|
|
2100
|
+
between: true,
|
|
2101
|
+
className: "px-4 py-4",
|
|
2102
|
+
style: [styles4.header, { borderBottomColor: colors.divider }],
|
|
2103
|
+
children: [
|
|
2104
|
+
/* @__PURE__ */ jsx19(AppView, { flex: true, children: header || (title ? /* @__PURE__ */ jsx19(AppText, { size: "lg", weight: "semibold", children: title }) : null) }),
|
|
2105
|
+
showCloseButton && /* @__PURE__ */ jsx19(
|
|
2106
|
+
AppPressable,
|
|
2107
|
+
{
|
|
2108
|
+
testID: "page-drawer-close",
|
|
2109
|
+
className: "p-1",
|
|
2110
|
+
pressedClassName: "opacity-70",
|
|
2111
|
+
onPress: handleClose,
|
|
2112
|
+
children: /* @__PURE__ */ jsx19(Icon, { name: "close", size: "md", color: colors.textSecondary })
|
|
2113
|
+
}
|
|
2114
|
+
)
|
|
2115
|
+
]
|
|
2116
|
+
}
|
|
2117
|
+
),
|
|
2118
|
+
/* @__PURE__ */ jsx19(AppScrollView, { flex: true, className: "px-4 py-4", children }),
|
|
2119
|
+
footer && /* @__PURE__ */ jsx19(
|
|
2120
|
+
AppView,
|
|
2121
|
+
{
|
|
2122
|
+
className: "px-4 py-4",
|
|
2123
|
+
style: [styles4.footer, { borderTopColor: colors.divider }],
|
|
2124
|
+
children: footer
|
|
2125
|
+
}
|
|
2126
|
+
)
|
|
2127
|
+
]
|
|
2128
|
+
}
|
|
2129
|
+
);
|
|
2130
|
+
return /* @__PURE__ */ jsx19(Modal2, { visible: true, transparent: true, animationType: "fade", onRequestClose: handleClose, children: /* @__PURE__ */ jsxs5(
|
|
2131
|
+
AppView,
|
|
2132
|
+
{
|
|
2133
|
+
testID,
|
|
2134
|
+
flex: true,
|
|
2135
|
+
row: true,
|
|
2136
|
+
style: { backgroundColor: "rgba(0,0,0,0.5)" },
|
|
2137
|
+
justify: placement === "right" ? "end" : "start",
|
|
2138
|
+
children: [
|
|
2139
|
+
placement === "left" && drawerContent,
|
|
2140
|
+
/* @__PURE__ */ jsx19(
|
|
2141
|
+
AppPressable,
|
|
2142
|
+
{
|
|
2143
|
+
testID: backdropTestID,
|
|
2144
|
+
className: "flex-1",
|
|
2145
|
+
onPress: closeOnBackdropPress ? handleClose : void 0
|
|
2146
|
+
}
|
|
2147
|
+
),
|
|
2148
|
+
placement === "right" && drawerContent
|
|
2149
|
+
]
|
|
2150
|
+
}
|
|
2151
|
+
) });
|
|
2152
|
+
}
|
|
2153
|
+
var styles4 = StyleSheet5.create({
|
|
2154
|
+
drawer: {
|
|
2155
|
+
height: "100%"
|
|
2156
|
+
},
|
|
2157
|
+
header: {
|
|
2158
|
+
borderBottomWidth: 0.5
|
|
2159
|
+
},
|
|
2160
|
+
footer: {
|
|
2161
|
+
borderTopWidth: 0.5
|
|
2162
|
+
}
|
|
2163
|
+
});
|
|
2164
|
+
|
|
2165
|
+
// src/ui/display/GradientView.tsx
|
|
2166
|
+
import { LinearGradient } from "expo-linear-gradient";
|
|
2167
|
+
import { jsx as jsx20 } from "nativewind/jsx-runtime";
|
|
2168
|
+
function GradientView({
|
|
2169
|
+
colors,
|
|
2170
|
+
start = { x: 0, y: 0 },
|
|
2171
|
+
end = { x: 1, y: 1 },
|
|
2172
|
+
children,
|
|
2173
|
+
style,
|
|
2174
|
+
...props
|
|
2175
|
+
}) {
|
|
2176
|
+
return /* @__PURE__ */ jsx20(LinearGradient, { colors: [...colors], start, end, style, ...props, children });
|
|
2177
|
+
}
|
|
2178
|
+
|
|
1983
2179
|
// src/ui/form/AppInput.tsx
|
|
1984
2180
|
import { forwardRef, useState as useState12 } from "react";
|
|
1985
|
-
import { TextInput, View as View5, StyleSheet as
|
|
1986
|
-
import { jsx as
|
|
2181
|
+
import { TextInput, View as View5, StyleSheet as StyleSheet6 } from "react-native";
|
|
2182
|
+
import { jsx as jsx21, jsxs as jsxs6 } from "nativewind/jsx-runtime";
|
|
1987
2183
|
var AppInput = forwardRef(
|
|
1988
2184
|
({ label, error, disabled = false, leftIcon, rightIcon, className, style, ...props }, ref) => {
|
|
1989
2185
|
const colors = useThemeColors();
|
|
@@ -1994,16 +2190,16 @@ var AppInput = forwardRef(
|
|
|
1994
2190
|
if (isFocused) return colors.primary;
|
|
1995
2191
|
return colors.border;
|
|
1996
2192
|
};
|
|
1997
|
-
return /* @__PURE__ */
|
|
1998
|
-
label && /* @__PURE__ */
|
|
1999
|
-
/* @__PURE__ */
|
|
2193
|
+
return /* @__PURE__ */ jsxs6(AppView, { className: cn("flex-col gap-1", className), children: [
|
|
2194
|
+
label && /* @__PURE__ */ jsx21(AppText, { size: "sm", weight: "medium", style: { color: colors.textSecondary }, children: label }),
|
|
2195
|
+
/* @__PURE__ */ jsxs6(
|
|
2000
2196
|
AppView,
|
|
2001
2197
|
{
|
|
2002
2198
|
row: true,
|
|
2003
2199
|
items: "center",
|
|
2004
2200
|
className: "rounded-lg px-3",
|
|
2005
2201
|
style: [
|
|
2006
|
-
|
|
2202
|
+
styles5.inputContainer,
|
|
2007
2203
|
{
|
|
2008
2204
|
backgroundColor: colors.card,
|
|
2009
2205
|
borderColor: getBorderColor(),
|
|
@@ -2011,13 +2207,13 @@ var AppInput = forwardRef(
|
|
|
2011
2207
|
}
|
|
2012
2208
|
],
|
|
2013
2209
|
children: [
|
|
2014
|
-
leftIcon && /* @__PURE__ */
|
|
2015
|
-
/* @__PURE__ */
|
|
2210
|
+
leftIcon && /* @__PURE__ */ jsx21(View5, { style: styles5.icon, children: leftIcon }),
|
|
2211
|
+
/* @__PURE__ */ jsx21(
|
|
2016
2212
|
TextInput,
|
|
2017
2213
|
{
|
|
2018
2214
|
ref,
|
|
2019
2215
|
className: "flex-1 py-3 text-base",
|
|
2020
|
-
style: [
|
|
2216
|
+
style: [styles5.input, { color: colors.text }, style],
|
|
2021
2217
|
placeholderTextColor: colors.textMuted,
|
|
2022
2218
|
editable: !disabled,
|
|
2023
2219
|
onFocus: (e) => {
|
|
@@ -2031,16 +2227,16 @@ var AppInput = forwardRef(
|
|
|
2031
2227
|
...props
|
|
2032
2228
|
}
|
|
2033
2229
|
),
|
|
2034
|
-
rightIcon && /* @__PURE__ */
|
|
2230
|
+
rightIcon && /* @__PURE__ */ jsx21(View5, { style: styles5.icon, children: rightIcon })
|
|
2035
2231
|
]
|
|
2036
2232
|
}
|
|
2037
2233
|
),
|
|
2038
|
-
error && /* @__PURE__ */
|
|
2234
|
+
error && /* @__PURE__ */ jsx21(AppText, { size: "xs", style: { color: errorColor }, children: error })
|
|
2039
2235
|
] });
|
|
2040
2236
|
}
|
|
2041
2237
|
);
|
|
2042
2238
|
AppInput.displayName = "AppInput";
|
|
2043
|
-
var
|
|
2239
|
+
var styles5 = StyleSheet6.create({
|
|
2044
2240
|
inputContainer: {
|
|
2045
2241
|
borderWidth: 0.5,
|
|
2046
2242
|
minHeight: 48
|
|
@@ -2056,8 +2252,8 @@ var styles4 = StyleSheet4.create({
|
|
|
2056
2252
|
|
|
2057
2253
|
// src/ui/form/Checkbox.tsx
|
|
2058
2254
|
import { useState as useState13 } from "react";
|
|
2059
|
-
import { TouchableOpacity as TouchableOpacity2, StyleSheet as
|
|
2060
|
-
import { jsx as
|
|
2255
|
+
import { TouchableOpacity as TouchableOpacity2, StyleSheet as StyleSheet7 } from "react-native";
|
|
2256
|
+
import { jsx as jsx22, jsxs as jsxs7 } from "nativewind/jsx-runtime";
|
|
2061
2257
|
function Checkbox({
|
|
2062
2258
|
checked,
|
|
2063
2259
|
defaultChecked,
|
|
@@ -2079,7 +2275,7 @@ function Checkbox({
|
|
|
2079
2275
|
onChange?.(newChecked);
|
|
2080
2276
|
};
|
|
2081
2277
|
const disabledOpacity = 0.4;
|
|
2082
|
-
return /* @__PURE__ */
|
|
2278
|
+
return /* @__PURE__ */ jsxs7(
|
|
2083
2279
|
TouchableOpacity2,
|
|
2084
2280
|
{
|
|
2085
2281
|
onPress: toggle,
|
|
@@ -2089,7 +2285,7 @@ function Checkbox({
|
|
|
2089
2285
|
testID,
|
|
2090
2286
|
activeOpacity: 0.7,
|
|
2091
2287
|
children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2288
|
+
/* @__PURE__ */ jsx22(
|
|
2093
2289
|
AppView,
|
|
2094
2290
|
{
|
|
2095
2291
|
className: cn(
|
|
@@ -2097,21 +2293,21 @@ function Checkbox({
|
|
|
2097
2293
|
isChecked ? "bg-primary-500" : "bg-white border"
|
|
2098
2294
|
),
|
|
2099
2295
|
style: [
|
|
2100
|
-
|
|
2296
|
+
styles6.checkbox,
|
|
2101
2297
|
{
|
|
2102
2298
|
backgroundColor: isChecked ? colors.primary : colors.cardElevated,
|
|
2103
2299
|
borderColor: isChecked ? colors.primary : colors.border
|
|
2104
2300
|
}
|
|
2105
2301
|
],
|
|
2106
|
-
children: isChecked && /* @__PURE__ */
|
|
2302
|
+
children: isChecked && /* @__PURE__ */ jsx22(AppView, { testID: `${testID}-icon`, children: /* @__PURE__ */ jsx22(Icon, { name: "check", size: "sm", color: "white" }) })
|
|
2107
2303
|
}
|
|
2108
2304
|
),
|
|
2109
|
-
children && /* @__PURE__ */
|
|
2305
|
+
children && /* @__PURE__ */ jsx22(AppText, { size: "sm", style: { color: colors.text }, children })
|
|
2110
2306
|
]
|
|
2111
2307
|
}
|
|
2112
2308
|
);
|
|
2113
2309
|
}
|
|
2114
|
-
var
|
|
2310
|
+
var styles6 = StyleSheet7.create({
|
|
2115
2311
|
checkbox: {
|
|
2116
2312
|
borderWidth: 0.5
|
|
2117
2313
|
}
|
|
@@ -2129,7 +2325,7 @@ var isGroupOptionDisabled = (groupDisabled, optionDisabled) => {
|
|
|
2129
2325
|
};
|
|
2130
2326
|
|
|
2131
2327
|
// src/ui/form/CheckboxGroup.tsx
|
|
2132
|
-
import { jsx as
|
|
2328
|
+
import { jsx as jsx23 } from "nativewind/jsx-runtime";
|
|
2133
2329
|
function CheckboxGroup({
|
|
2134
2330
|
value = [],
|
|
2135
2331
|
onChange,
|
|
@@ -2142,7 +2338,7 @@ function CheckboxGroup({
|
|
|
2142
2338
|
onChange(toggleGroupValue(value, optionValue, checked));
|
|
2143
2339
|
};
|
|
2144
2340
|
const isRow = direction === "row";
|
|
2145
|
-
return /* @__PURE__ */
|
|
2341
|
+
return /* @__PURE__ */ jsx23(AppView, { row: isRow, flex: isRow, gap: 4, children: options.map((option) => /* @__PURE__ */ jsx23(
|
|
2146
2342
|
Checkbox,
|
|
2147
2343
|
{
|
|
2148
2344
|
checked: value.includes(option.value),
|
|
@@ -2156,8 +2352,8 @@ function CheckboxGroup({
|
|
|
2156
2352
|
|
|
2157
2353
|
// src/ui/form/Radio.tsx
|
|
2158
2354
|
import { useState as useState14 } from "react";
|
|
2159
|
-
import { TouchableOpacity as TouchableOpacity3, StyleSheet as
|
|
2160
|
-
import { jsx as
|
|
2355
|
+
import { TouchableOpacity as TouchableOpacity3, StyleSheet as StyleSheet8 } from "react-native";
|
|
2356
|
+
import { jsx as jsx24, jsxs as jsxs8 } from "nativewind/jsx-runtime";
|
|
2161
2357
|
function Radio({
|
|
2162
2358
|
checked,
|
|
2163
2359
|
defaultChecked,
|
|
@@ -2179,7 +2375,7 @@ function Radio({
|
|
|
2179
2375
|
onChange?.(newChecked);
|
|
2180
2376
|
};
|
|
2181
2377
|
const disabledOpacity = 0.4;
|
|
2182
|
-
return /* @__PURE__ */
|
|
2378
|
+
return /* @__PURE__ */ jsxs8(
|
|
2183
2379
|
TouchableOpacity3,
|
|
2184
2380
|
{
|
|
2185
2381
|
onPress: toggle,
|
|
@@ -2189,33 +2385,33 @@ function Radio({
|
|
|
2189
2385
|
testID,
|
|
2190
2386
|
activeOpacity: 0.7,
|
|
2191
2387
|
children: [
|
|
2192
|
-
/* @__PURE__ */
|
|
2388
|
+
/* @__PURE__ */ jsx24(
|
|
2193
2389
|
AppView,
|
|
2194
2390
|
{
|
|
2195
2391
|
className: cn("w-5 h-5 rounded-full items-center justify-center", isChecked && "border-2"),
|
|
2196
2392
|
style: [
|
|
2197
|
-
|
|
2393
|
+
styles7.radio,
|
|
2198
2394
|
{
|
|
2199
2395
|
backgroundColor: colors.card,
|
|
2200
2396
|
borderColor: isChecked ? colors.primary : colors.border,
|
|
2201
2397
|
borderWidth: isChecked ? 0.5 : 0.5
|
|
2202
2398
|
}
|
|
2203
2399
|
],
|
|
2204
|
-
children: isChecked && /* @__PURE__ */
|
|
2400
|
+
children: isChecked && /* @__PURE__ */ jsx24(
|
|
2205
2401
|
AppView,
|
|
2206
2402
|
{
|
|
2207
2403
|
className: "rounded-full",
|
|
2208
|
-
style: [
|
|
2404
|
+
style: [styles7.inner, { backgroundColor: colors.primary }]
|
|
2209
2405
|
}
|
|
2210
2406
|
)
|
|
2211
2407
|
}
|
|
2212
2408
|
),
|
|
2213
|
-
children && /* @__PURE__ */
|
|
2409
|
+
children && /* @__PURE__ */ jsx24(AppText, { size: "sm", style: { color: colors.text }, children })
|
|
2214
2410
|
]
|
|
2215
2411
|
}
|
|
2216
2412
|
);
|
|
2217
2413
|
}
|
|
2218
|
-
var
|
|
2414
|
+
var styles7 = StyleSheet8.create({
|
|
2219
2415
|
radio: {
|
|
2220
2416
|
borderWidth: 0.5
|
|
2221
2417
|
},
|
|
@@ -2226,7 +2422,7 @@ var styles6 = StyleSheet6.create({
|
|
|
2226
2422
|
});
|
|
2227
2423
|
|
|
2228
2424
|
// src/ui/form/RadioGroup.tsx
|
|
2229
|
-
import { jsx as
|
|
2425
|
+
import { jsx as jsx25 } from "nativewind/jsx-runtime";
|
|
2230
2426
|
function RadioGroup({
|
|
2231
2427
|
value,
|
|
2232
2428
|
onChange,
|
|
@@ -2235,7 +2431,7 @@ function RadioGroup({
|
|
|
2235
2431
|
disabled = false
|
|
2236
2432
|
}) {
|
|
2237
2433
|
const isRow = direction === "row";
|
|
2238
|
-
return /* @__PURE__ */
|
|
2434
|
+
return /* @__PURE__ */ jsx25(AppView, { row: isRow, flex: isRow, gap: 4, children: options.map((option) => /* @__PURE__ */ jsx25(
|
|
2239
2435
|
Radio,
|
|
2240
2436
|
{
|
|
2241
2437
|
checked: value === option.value,
|
|
@@ -2249,8 +2445,8 @@ function RadioGroup({
|
|
|
2249
2445
|
|
|
2250
2446
|
// src/ui/form/Switch.tsx
|
|
2251
2447
|
import { useState as useState15 } from "react";
|
|
2252
|
-
import { TouchableOpacity as TouchableOpacity4, StyleSheet as
|
|
2253
|
-
import { jsx as
|
|
2448
|
+
import { TouchableOpacity as TouchableOpacity4, StyleSheet as StyleSheet9 } from "react-native";
|
|
2449
|
+
import { jsx as jsx26 } from "nativewind/jsx-runtime";
|
|
2254
2450
|
function Switch({
|
|
2255
2451
|
checked,
|
|
2256
2452
|
defaultChecked,
|
|
@@ -2282,7 +2478,7 @@ function Switch({
|
|
|
2282
2478
|
};
|
|
2283
2479
|
const config = sizes[size];
|
|
2284
2480
|
const thumbPosition = isChecked ? config.width - config.thumb - config.padding : config.padding;
|
|
2285
|
-
return /* @__PURE__ */
|
|
2481
|
+
return /* @__PURE__ */ jsx26(
|
|
2286
2482
|
TouchableOpacity4,
|
|
2287
2483
|
{
|
|
2288
2484
|
onPress: toggle,
|
|
@@ -2290,12 +2486,12 @@ function Switch({
|
|
|
2290
2486
|
className: cn(className),
|
|
2291
2487
|
testID,
|
|
2292
2488
|
activeOpacity: disabled ? 1 : 0.8,
|
|
2293
|
-
children: /* @__PURE__ */
|
|
2489
|
+
children: /* @__PURE__ */ jsx26(
|
|
2294
2490
|
AppView,
|
|
2295
2491
|
{
|
|
2296
2492
|
className: "rounded-full",
|
|
2297
2493
|
style: [
|
|
2298
|
-
|
|
2494
|
+
styles8.track,
|
|
2299
2495
|
{
|
|
2300
2496
|
width: config.width,
|
|
2301
2497
|
height: config.height,
|
|
@@ -2304,12 +2500,12 @@ function Switch({
|
|
|
2304
2500
|
},
|
|
2305
2501
|
style
|
|
2306
2502
|
],
|
|
2307
|
-
children: /* @__PURE__ */
|
|
2503
|
+
children: /* @__PURE__ */ jsx26(
|
|
2308
2504
|
AppView,
|
|
2309
2505
|
{
|
|
2310
2506
|
className: "rounded-full",
|
|
2311
2507
|
style: [
|
|
2312
|
-
|
|
2508
|
+
styles8.thumb,
|
|
2313
2509
|
{
|
|
2314
2510
|
width: config.thumb,
|
|
2315
2511
|
height: config.thumb,
|
|
@@ -2328,7 +2524,7 @@ function Switch({
|
|
|
2328
2524
|
}
|
|
2329
2525
|
);
|
|
2330
2526
|
}
|
|
2331
|
-
var
|
|
2527
|
+
var styles8 = StyleSheet9.create({
|
|
2332
2528
|
track: {
|
|
2333
2529
|
justifyContent: "center",
|
|
2334
2530
|
padding: 2
|
|
@@ -2346,8 +2542,8 @@ var styles7 = StyleSheet7.create({
|
|
|
2346
2542
|
import { useState as useState16, useCallback as useCallback12, useRef as useRef6 } from "react";
|
|
2347
2543
|
import {
|
|
2348
2544
|
View as View6,
|
|
2349
|
-
PanResponder,
|
|
2350
|
-
StyleSheet as
|
|
2545
|
+
PanResponder as PanResponder2,
|
|
2546
|
+
StyleSheet as StyleSheet10
|
|
2351
2547
|
} from "react-native";
|
|
2352
2548
|
|
|
2353
2549
|
// src/ui/form/useFormTheme.ts
|
|
@@ -2376,7 +2572,7 @@ function useFormThemeColors() {
|
|
|
2376
2572
|
}
|
|
2377
2573
|
|
|
2378
2574
|
// src/ui/form/Slider.tsx
|
|
2379
|
-
import { jsx as
|
|
2575
|
+
import { jsx as jsx27, jsxs as jsxs9 } from "nativewind/jsx-runtime";
|
|
2380
2576
|
function Slider({
|
|
2381
2577
|
value,
|
|
2382
2578
|
defaultValue = 0,
|
|
@@ -2416,7 +2612,7 @@ function Slider({
|
|
|
2416
2612
|
[value, min, max, onChange]
|
|
2417
2613
|
);
|
|
2418
2614
|
const panResponder = useRef6(
|
|
2419
|
-
|
|
2615
|
+
PanResponder2.create({
|
|
2420
2616
|
onStartShouldSetPanResponder: () => !disabled,
|
|
2421
2617
|
onMoveShouldSetPanResponder: () => !disabled,
|
|
2422
2618
|
onPanResponderGrant: () => {
|
|
@@ -2449,13 +2645,13 @@ function Slider({
|
|
|
2449
2645
|
const onLayout = useCallback12((event) => {
|
|
2450
2646
|
setTrackWidth(event.nativeEvent.layout.width);
|
|
2451
2647
|
}, []);
|
|
2452
|
-
return /* @__PURE__ */
|
|
2453
|
-
showTooltip && isDragging && /* @__PURE__ */
|
|
2648
|
+
return /* @__PURE__ */ jsxs9(AppView, { className: cn("py-2", className), children: [
|
|
2649
|
+
showTooltip && isDragging && /* @__PURE__ */ jsxs9(
|
|
2454
2650
|
AppView,
|
|
2455
2651
|
{
|
|
2456
2652
|
className: "absolute rounded px-2 py-1 -top-8",
|
|
2457
2653
|
style: [
|
|
2458
|
-
|
|
2654
|
+
styles9.tooltip,
|
|
2459
2655
|
{
|
|
2460
2656
|
backgroundColor: colors.surfaceMuted,
|
|
2461
2657
|
left: `${progress}%`,
|
|
@@ -2463,12 +2659,12 @@ function Slider({
|
|
|
2463
2659
|
}
|
|
2464
2660
|
],
|
|
2465
2661
|
children: [
|
|
2466
|
-
/* @__PURE__ */
|
|
2467
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ jsx27(AppText, { size: "xs", style: { color: colors.text }, children: Math.round(currentValue) }),
|
|
2663
|
+
/* @__PURE__ */ jsx27(
|
|
2468
2664
|
AppView,
|
|
2469
2665
|
{
|
|
2470
2666
|
style: [
|
|
2471
|
-
|
|
2667
|
+
styles9.tooltipArrow,
|
|
2472
2668
|
{
|
|
2473
2669
|
borderTopColor: colors.surfaceMuted
|
|
2474
2670
|
}
|
|
@@ -2478,23 +2674,23 @@ function Slider({
|
|
|
2478
2674
|
]
|
|
2479
2675
|
}
|
|
2480
2676
|
),
|
|
2481
|
-
/* @__PURE__ */
|
|
2677
|
+
/* @__PURE__ */ jsxs9(
|
|
2482
2678
|
View6,
|
|
2483
2679
|
{
|
|
2484
2680
|
onLayout,
|
|
2485
2681
|
className: "rounded-full",
|
|
2486
2682
|
style: [
|
|
2487
|
-
|
|
2683
|
+
styles9.track,
|
|
2488
2684
|
{ backgroundColor: colors.divider, opacity: disabled ? disabledOpacity : 1 }
|
|
2489
2685
|
],
|
|
2490
2686
|
onTouchEnd: handleTrackPress,
|
|
2491
2687
|
children: [
|
|
2492
|
-
/* @__PURE__ */
|
|
2688
|
+
/* @__PURE__ */ jsx27(
|
|
2493
2689
|
AppView,
|
|
2494
2690
|
{
|
|
2495
2691
|
className: "rounded-full",
|
|
2496
2692
|
style: [
|
|
2497
|
-
|
|
2693
|
+
styles9.filledTrack,
|
|
2498
2694
|
{
|
|
2499
2695
|
backgroundColor: colors.primary,
|
|
2500
2696
|
width: `${progress}%`
|
|
@@ -2502,12 +2698,12 @@ function Slider({
|
|
|
2502
2698
|
]
|
|
2503
2699
|
}
|
|
2504
2700
|
),
|
|
2505
|
-
/* @__PURE__ */
|
|
2701
|
+
/* @__PURE__ */ jsx27(
|
|
2506
2702
|
AppView,
|
|
2507
2703
|
{
|
|
2508
2704
|
className: "absolute rounded-full items-center justify-center",
|
|
2509
2705
|
style: [
|
|
2510
|
-
|
|
2706
|
+
styles9.thumb,
|
|
2511
2707
|
{
|
|
2512
2708
|
backgroundColor: colors.textInverse,
|
|
2513
2709
|
left: `${progress}%`,
|
|
@@ -2519,12 +2715,12 @@ function Slider({
|
|
|
2519
2715
|
}
|
|
2520
2716
|
],
|
|
2521
2717
|
...panResponder.panHandlers,
|
|
2522
|
-
children: /* @__PURE__ */
|
|
2718
|
+
children: /* @__PURE__ */ jsx27(
|
|
2523
2719
|
AppView,
|
|
2524
2720
|
{
|
|
2525
2721
|
className: "rounded-full",
|
|
2526
2722
|
style: [
|
|
2527
|
-
|
|
2723
|
+
styles9.thumbDot,
|
|
2528
2724
|
{
|
|
2529
2725
|
backgroundColor: colors.primary
|
|
2530
2726
|
}
|
|
@@ -2538,7 +2734,7 @@ function Slider({
|
|
|
2538
2734
|
)
|
|
2539
2735
|
] });
|
|
2540
2736
|
}
|
|
2541
|
-
var
|
|
2737
|
+
var styles9 = StyleSheet10.create({
|
|
2542
2738
|
track: {
|
|
2543
2739
|
height: 6,
|
|
2544
2740
|
width: "100%"
|
|
@@ -2581,14 +2777,14 @@ var styles8 = StyleSheet8.create({
|
|
|
2581
2777
|
// src/ui/form/Select.tsx
|
|
2582
2778
|
import { useState as useState17, useCallback as useCallback13, useMemo as useMemo5 } from "react";
|
|
2583
2779
|
import {
|
|
2584
|
-
Modal as
|
|
2780
|
+
Modal as Modal3,
|
|
2585
2781
|
View as View7,
|
|
2586
2782
|
TouchableOpacity as TouchableOpacity5,
|
|
2587
2783
|
FlatList as FlatList2,
|
|
2588
2784
|
TextInput as TextInput2,
|
|
2589
|
-
StyleSheet as
|
|
2785
|
+
StyleSheet as StyleSheet11
|
|
2590
2786
|
} from "react-native";
|
|
2591
|
-
import { Fragment as Fragment2, jsx as
|
|
2787
|
+
import { Fragment as Fragment2, jsx as jsx28, jsxs as jsxs10 } from "nativewind/jsx-runtime";
|
|
2592
2788
|
function Select({
|
|
2593
2789
|
value,
|
|
2594
2790
|
onChange,
|
|
@@ -2649,7 +2845,7 @@ function Select({
|
|
|
2649
2845
|
const renderOption = useCallback13(
|
|
2650
2846
|
({ item }) => {
|
|
2651
2847
|
const isSelected = selectedValues.includes(item.value);
|
|
2652
|
-
return /* @__PURE__ */
|
|
2848
|
+
return /* @__PURE__ */ jsxs10(
|
|
2653
2849
|
AppPressable,
|
|
2654
2850
|
{
|
|
2655
2851
|
className: cn(
|
|
@@ -2657,22 +2853,22 @@ function Select({
|
|
|
2657
2853
|
isSelected && "bg-primary-50"
|
|
2658
2854
|
),
|
|
2659
2855
|
style: [
|
|
2660
|
-
|
|
2856
|
+
styles10.optionItem,
|
|
2661
2857
|
{ borderBottomColor: colors.divider },
|
|
2662
2858
|
isSelected && { backgroundColor: colors.primarySurface }
|
|
2663
2859
|
],
|
|
2664
2860
|
onPress: () => handleSelect(item.value),
|
|
2665
2861
|
children: [
|
|
2666
|
-
/* @__PURE__ */
|
|
2667
|
-
isSelected && /* @__PURE__ */
|
|
2862
|
+
/* @__PURE__ */ jsx28(AppText, { style: { color: isSelected ? colors.primary : colors.text }, children: item.label }),
|
|
2863
|
+
isSelected && /* @__PURE__ */ jsx28(Icon, { name: "check", size: "sm", color: "primary-500" })
|
|
2668
2864
|
]
|
|
2669
2865
|
}
|
|
2670
2866
|
);
|
|
2671
2867
|
},
|
|
2672
2868
|
[selectedValues, handleSelect, colors]
|
|
2673
2869
|
);
|
|
2674
|
-
return /* @__PURE__ */
|
|
2675
|
-
/* @__PURE__ */
|
|
2870
|
+
return /* @__PURE__ */ jsxs10(Fragment2, { children: [
|
|
2871
|
+
/* @__PURE__ */ jsxs10(
|
|
2676
2872
|
AppPressable,
|
|
2677
2873
|
{
|
|
2678
2874
|
className: cn(
|
|
@@ -2680,11 +2876,11 @@ function Select({
|
|
|
2680
2876
|
disabled ? "opacity-60" : "",
|
|
2681
2877
|
className
|
|
2682
2878
|
),
|
|
2683
|
-
style: [
|
|
2879
|
+
style: [styles10.trigger, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
2684
2880
|
disabled,
|
|
2685
2881
|
onPress: () => setVisible(true),
|
|
2686
2882
|
children: [
|
|
2687
|
-
/* @__PURE__ */
|
|
2883
|
+
/* @__PURE__ */ jsx28(
|
|
2688
2884
|
AppText,
|
|
2689
2885
|
{
|
|
2690
2886
|
className: "flex-1",
|
|
@@ -2693,46 +2889,46 @@ function Select({
|
|
|
2693
2889
|
children: displayText
|
|
2694
2890
|
}
|
|
2695
2891
|
),
|
|
2696
|
-
/* @__PURE__ */
|
|
2697
|
-
clearable && selectedValues.length > 0 && !disabled && /* @__PURE__ */
|
|
2698
|
-
/* @__PURE__ */
|
|
2892
|
+
/* @__PURE__ */ jsxs10(View7, { className: "flex-row items-center", children: [
|
|
2893
|
+
clearable && selectedValues.length > 0 && !disabled && /* @__PURE__ */ jsx28(TouchableOpacity5, { onPress: handleClear, className: "mr-2 p-1", children: /* @__PURE__ */ jsx28(Icon, { name: "close", size: "sm", color: colors.icon }) }),
|
|
2894
|
+
/* @__PURE__ */ jsx28(Icon, { name: "keyboard-arrow-down", size: "md", color: colors.icon })
|
|
2699
2895
|
] })
|
|
2700
2896
|
]
|
|
2701
2897
|
}
|
|
2702
2898
|
),
|
|
2703
|
-
/* @__PURE__ */
|
|
2704
|
-
|
|
2899
|
+
/* @__PURE__ */ jsx28(
|
|
2900
|
+
Modal3,
|
|
2705
2901
|
{
|
|
2706
2902
|
visible,
|
|
2707
2903
|
transparent: true,
|
|
2708
2904
|
animationType: "slide",
|
|
2709
2905
|
onRequestClose: () => setVisible(false),
|
|
2710
|
-
children: /* @__PURE__ */
|
|
2906
|
+
children: /* @__PURE__ */ jsx28(AppView, { className: "flex-1", style: { backgroundColor: colors.overlay }, justify: "end", children: /* @__PURE__ */ jsxs10(
|
|
2711
2907
|
AppView,
|
|
2712
2908
|
{
|
|
2713
2909
|
className: "rounded-t-2xl max-h-[70%]",
|
|
2714
2910
|
style: { backgroundColor: colors.surface },
|
|
2715
2911
|
children: [
|
|
2716
|
-
/* @__PURE__ */
|
|
2912
|
+
/* @__PURE__ */ jsxs10(
|
|
2717
2913
|
AppView,
|
|
2718
2914
|
{
|
|
2719
2915
|
row: true,
|
|
2720
2916
|
between: true,
|
|
2721
2917
|
items: "center",
|
|
2722
2918
|
className: "px-4 py-3",
|
|
2723
|
-
style: [
|
|
2919
|
+
style: [styles10.header, { borderBottomColor: colors.divider }],
|
|
2724
2920
|
children: [
|
|
2725
|
-
/* @__PURE__ */
|
|
2726
|
-
/* @__PURE__ */
|
|
2921
|
+
/* @__PURE__ */ jsx28(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: multiple ? "\u9009\u62E9\u9009\u9879" : "\u8BF7\u9009\u62E9" }),
|
|
2922
|
+
/* @__PURE__ */ jsx28(TouchableOpacity5, { onPress: () => setVisible(false), children: /* @__PURE__ */ jsx28(Icon, { name: "close", size: "md", color: colors.icon }) })
|
|
2727
2923
|
]
|
|
2728
2924
|
}
|
|
2729
2925
|
),
|
|
2730
|
-
searchable && /* @__PURE__ */
|
|
2926
|
+
searchable && /* @__PURE__ */ jsx28(
|
|
2731
2927
|
AppView,
|
|
2732
2928
|
{
|
|
2733
2929
|
className: "px-4 py-3",
|
|
2734
|
-
style: [
|
|
2735
|
-
children: /* @__PURE__ */
|
|
2930
|
+
style: [styles10.searchBox, { borderBottomColor: colors.divider }],
|
|
2931
|
+
children: /* @__PURE__ */ jsxs10(
|
|
2736
2932
|
AppView,
|
|
2737
2933
|
{
|
|
2738
2934
|
row: true,
|
|
@@ -2740,8 +2936,8 @@ function Select({
|
|
|
2740
2936
|
className: "px-3 py-2 rounded-lg",
|
|
2741
2937
|
style: { backgroundColor: colors.surfaceMuted },
|
|
2742
2938
|
children: [
|
|
2743
|
-
/* @__PURE__ */
|
|
2744
|
-
/* @__PURE__ */
|
|
2939
|
+
/* @__PURE__ */ jsx28(View7, { style: { marginRight: 8 }, children: /* @__PURE__ */ jsx28(Icon, { name: "search", size: "sm", color: colors.icon }) }),
|
|
2940
|
+
/* @__PURE__ */ jsx28(
|
|
2745
2941
|
TextInput2,
|
|
2746
2942
|
{
|
|
2747
2943
|
className: "flex-1 text-base",
|
|
@@ -2753,42 +2949,42 @@ function Select({
|
|
|
2753
2949
|
autoFocus: true
|
|
2754
2950
|
}
|
|
2755
2951
|
),
|
|
2756
|
-
searchKeyword.length > 0 && /* @__PURE__ */
|
|
2952
|
+
searchKeyword.length > 0 && /* @__PURE__ */ jsx28(TouchableOpacity5, { onPress: () => setSearchKeyword(""), children: /* @__PURE__ */ jsx28(Icon, { name: "close", size: "sm", color: colors.icon }) })
|
|
2757
2953
|
]
|
|
2758
2954
|
}
|
|
2759
2955
|
)
|
|
2760
2956
|
}
|
|
2761
2957
|
),
|
|
2762
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ jsx28(
|
|
2763
2959
|
FlatList2,
|
|
2764
2960
|
{
|
|
2765
2961
|
data: filteredOptions,
|
|
2766
2962
|
keyExtractor: (item) => item.value,
|
|
2767
2963
|
renderItem: renderOption,
|
|
2768
|
-
ListEmptyComponent: /* @__PURE__ */
|
|
2964
|
+
ListEmptyComponent: /* @__PURE__ */ jsx28(AppView, { center: true, className: "py-8", children: /* @__PURE__ */ jsx28(AppText, { style: { color: colors.textMuted }, children: "\u6682\u65E0\u9009\u9879" }) })
|
|
2769
2965
|
}
|
|
2770
2966
|
),
|
|
2771
|
-
multiple && /* @__PURE__ */
|
|
2967
|
+
multiple && /* @__PURE__ */ jsxs10(
|
|
2772
2968
|
AppView,
|
|
2773
2969
|
{
|
|
2774
2970
|
row: true,
|
|
2775
2971
|
between: true,
|
|
2776
2972
|
items: "center",
|
|
2777
2973
|
className: "px-4 py-3",
|
|
2778
|
-
style: [
|
|
2974
|
+
style: [styles10.footer, { borderTopColor: colors.divider }],
|
|
2779
2975
|
children: [
|
|
2780
|
-
/* @__PURE__ */
|
|
2976
|
+
/* @__PURE__ */ jsxs10(AppText, { style: { color: colors.textMuted }, children: [
|
|
2781
2977
|
"\u5DF2\u9009\u62E9 ",
|
|
2782
2978
|
selectedValues.length,
|
|
2783
2979
|
" \u9879"
|
|
2784
2980
|
] }),
|
|
2785
|
-
/* @__PURE__ */
|
|
2981
|
+
/* @__PURE__ */ jsx28(
|
|
2786
2982
|
TouchableOpacity5,
|
|
2787
2983
|
{
|
|
2788
2984
|
className: "px-4 py-2 rounded-lg",
|
|
2789
2985
|
style: { backgroundColor: colors.primary },
|
|
2790
2986
|
onPress: () => setVisible(false),
|
|
2791
|
-
children: /* @__PURE__ */
|
|
2987
|
+
children: /* @__PURE__ */ jsx28(AppText, { className: "font-medium", style: { color: colors.textInverse }, children: "\u786E\u5B9A" })
|
|
2792
2988
|
}
|
|
2793
2989
|
)
|
|
2794
2990
|
]
|
|
@@ -2801,7 +2997,7 @@ function Select({
|
|
|
2801
2997
|
)
|
|
2802
2998
|
] });
|
|
2803
2999
|
}
|
|
2804
|
-
var
|
|
3000
|
+
var styles10 = StyleSheet11.create({
|
|
2805
3001
|
trigger: {
|
|
2806
3002
|
borderWidth: 0.5
|
|
2807
3003
|
},
|
|
@@ -2821,8 +3017,8 @@ var styles9 = StyleSheet9.create({
|
|
|
2821
3017
|
|
|
2822
3018
|
// src/ui/form/DatePicker.tsx
|
|
2823
3019
|
import { useState as useState18, useCallback as useCallback14, useMemo as useMemo6 } from "react";
|
|
2824
|
-
import { Modal as
|
|
2825
|
-
import { Fragment as Fragment3, jsx as
|
|
3020
|
+
import { Modal as Modal4, TouchableOpacity as TouchableOpacity6, StyleSheet as StyleSheet12 } from "react-native";
|
|
3021
|
+
import { Fragment as Fragment3, jsx as jsx29, jsxs as jsxs11 } from "nativewind/jsx-runtime";
|
|
2826
3022
|
function PickerColumn({
|
|
2827
3023
|
title,
|
|
2828
3024
|
values,
|
|
@@ -2833,27 +3029,27 @@ function PickerColumn({
|
|
|
2833
3029
|
showDivider = false,
|
|
2834
3030
|
colors
|
|
2835
3031
|
}) {
|
|
2836
|
-
return /* @__PURE__ */
|
|
3032
|
+
return /* @__PURE__ */ jsxs11(
|
|
2837
3033
|
AppView,
|
|
2838
3034
|
{
|
|
2839
3035
|
flex: true,
|
|
2840
3036
|
style: [
|
|
2841
|
-
showDivider &&
|
|
3037
|
+
showDivider && styles11.column,
|
|
2842
3038
|
showDivider ? { borderRightColor: colors.divider } : void 0
|
|
2843
3039
|
],
|
|
2844
3040
|
children: [
|
|
2845
|
-
/* @__PURE__ */
|
|
2846
|
-
/* @__PURE__ */
|
|
3041
|
+
/* @__PURE__ */ jsx29(AppView, { center: true, className: "py-2", style: { backgroundColor: colors.headerSurface }, children: /* @__PURE__ */ jsx29(AppText, { className: "text-sm font-medium", style: { color: colors.textMuted }, children: title }) }),
|
|
3042
|
+
/* @__PURE__ */ jsx29(AppView, { className: "flex-1", children: values.map((value) => {
|
|
2847
3043
|
const selected = selectedValue === value;
|
|
2848
3044
|
const disabled = isDisabled(value);
|
|
2849
|
-
return /* @__PURE__ */
|
|
3045
|
+
return /* @__PURE__ */ jsx29(
|
|
2850
3046
|
TouchableOpacity6,
|
|
2851
3047
|
{
|
|
2852
3048
|
className: cn("py-2 items-center", selected && "bg-primary-50"),
|
|
2853
3049
|
style: selected ? { backgroundColor: colors.primarySurface } : void 0,
|
|
2854
3050
|
disabled,
|
|
2855
3051
|
onPress: () => onSelect(value),
|
|
2856
|
-
children: /* @__PURE__ */
|
|
3052
|
+
children: /* @__PURE__ */ jsx29(
|
|
2857
3053
|
AppText,
|
|
2858
3054
|
{
|
|
2859
3055
|
className: cn(selected ? "font-semibold" : void 0, disabled && "opacity-30"),
|
|
@@ -2927,8 +3123,8 @@ function DatePicker({
|
|
|
2927
3123
|
},
|
|
2928
3124
|
[tempDate]
|
|
2929
3125
|
);
|
|
2930
|
-
return /* @__PURE__ */
|
|
2931
|
-
/* @__PURE__ */
|
|
3126
|
+
return /* @__PURE__ */ jsxs11(Fragment3, { children: [
|
|
3127
|
+
/* @__PURE__ */ jsxs11(
|
|
2932
3128
|
AppPressable,
|
|
2933
3129
|
{
|
|
2934
3130
|
className: cn(
|
|
@@ -2936,14 +3132,14 @@ function DatePicker({
|
|
|
2936
3132
|
disabled ? "opacity-60" : "",
|
|
2937
3133
|
className
|
|
2938
3134
|
),
|
|
2939
|
-
style: [
|
|
3135
|
+
style: [styles11.trigger, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
2940
3136
|
disabled,
|
|
2941
3137
|
onPress: () => {
|
|
2942
3138
|
setTempDate(value || /* @__PURE__ */ new Date());
|
|
2943
3139
|
setVisible(true);
|
|
2944
3140
|
},
|
|
2945
3141
|
children: [
|
|
2946
|
-
/* @__PURE__ */
|
|
3142
|
+
/* @__PURE__ */ jsx29(
|
|
2947
3143
|
AppText,
|
|
2948
3144
|
{
|
|
2949
3145
|
className: "flex-1",
|
|
@@ -2952,36 +3148,36 @@ function DatePicker({
|
|
|
2952
3148
|
children: displayText
|
|
2953
3149
|
}
|
|
2954
3150
|
),
|
|
2955
|
-
/* @__PURE__ */
|
|
3151
|
+
/* @__PURE__ */ jsx29(Icon, { name: "calendar-today", size: "md", color: colors.icon })
|
|
2956
3152
|
]
|
|
2957
3153
|
}
|
|
2958
3154
|
),
|
|
2959
|
-
/* @__PURE__ */
|
|
2960
|
-
|
|
3155
|
+
/* @__PURE__ */ jsx29(
|
|
3156
|
+
Modal4,
|
|
2961
3157
|
{
|
|
2962
3158
|
visible,
|
|
2963
3159
|
transparent: true,
|
|
2964
3160
|
animationType: "slide",
|
|
2965
3161
|
onRequestClose: () => setVisible(false),
|
|
2966
|
-
children: /* @__PURE__ */
|
|
2967
|
-
/* @__PURE__ */
|
|
3162
|
+
children: /* @__PURE__ */ jsx29(AppView, { className: "flex-1", style: { backgroundColor: colors.overlay }, justify: "end", children: /* @__PURE__ */ jsxs11(AppView, { className: "rounded-t-2xl", style: { backgroundColor: colors.surface }, children: [
|
|
3163
|
+
/* @__PURE__ */ jsxs11(
|
|
2968
3164
|
AppView,
|
|
2969
3165
|
{
|
|
2970
3166
|
row: true,
|
|
2971
3167
|
between: true,
|
|
2972
3168
|
items: "center",
|
|
2973
3169
|
className: "px-4 py-3",
|
|
2974
|
-
style: [
|
|
3170
|
+
style: [styles11.header, { borderBottomColor: colors.divider }],
|
|
2975
3171
|
children: [
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
3172
|
+
/* @__PURE__ */ jsx29(TouchableOpacity6, { onPress: () => setVisible(false), children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.textMuted }, children: "\u53D6\u6D88" }) }),
|
|
3173
|
+
/* @__PURE__ */ jsx29(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: "\u9009\u62E9\u65E5\u671F" }),
|
|
3174
|
+
/* @__PURE__ */ jsx29(TouchableOpacity6, { onPress: handleConfirm, children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.primary }, className: "font-medium", children: "\u786E\u5B9A" }) })
|
|
2979
3175
|
]
|
|
2980
3176
|
}
|
|
2981
3177
|
),
|
|
2982
|
-
/* @__PURE__ */
|
|
2983
|
-
/* @__PURE__ */
|
|
2984
|
-
/* @__PURE__ */
|
|
3178
|
+
/* @__PURE__ */ jsx29(AppView, { center: true, className: "py-4", style: { backgroundColor: colors.headerSurface }, children: /* @__PURE__ */ jsx29(AppText, { className: "text-2xl font-semibold", style: { color: colors.text }, children: formatDate(tempDate, "yyyy\u5E74MM\u6708dd\u65E5") }) }),
|
|
3179
|
+
/* @__PURE__ */ jsxs11(AppView, { row: true, className: "h-48", children: [
|
|
3180
|
+
/* @__PURE__ */ jsx29(
|
|
2985
3181
|
PickerColumn,
|
|
2986
3182
|
{
|
|
2987
3183
|
title: "\u5E74",
|
|
@@ -2993,7 +3189,7 @@ function DatePicker({
|
|
|
2993
3189
|
showDivider: true
|
|
2994
3190
|
}
|
|
2995
3191
|
),
|
|
2996
|
-
/* @__PURE__ */
|
|
3192
|
+
/* @__PURE__ */ jsx29(
|
|
2997
3193
|
PickerColumn,
|
|
2998
3194
|
{
|
|
2999
3195
|
title: "\u6708",
|
|
@@ -3006,7 +3202,7 @@ function DatePicker({
|
|
|
3006
3202
|
showDivider: true
|
|
3007
3203
|
}
|
|
3008
3204
|
),
|
|
3009
|
-
/* @__PURE__ */
|
|
3205
|
+
/* @__PURE__ */ jsx29(
|
|
3010
3206
|
PickerColumn,
|
|
3011
3207
|
{
|
|
3012
3208
|
title: "\u65E5",
|
|
@@ -3018,38 +3214,38 @@ function DatePicker({
|
|
|
3018
3214
|
}
|
|
3019
3215
|
)
|
|
3020
3216
|
] }),
|
|
3021
|
-
/* @__PURE__ */
|
|
3217
|
+
/* @__PURE__ */ jsxs11(
|
|
3022
3218
|
AppView,
|
|
3023
3219
|
{
|
|
3024
3220
|
row: true,
|
|
3025
3221
|
className: "px-4 py-3 gap-2",
|
|
3026
|
-
style: [
|
|
3222
|
+
style: [styles11.footer, { borderTopColor: colors.divider }],
|
|
3027
3223
|
children: [
|
|
3028
|
-
/* @__PURE__ */
|
|
3224
|
+
/* @__PURE__ */ jsx29(
|
|
3029
3225
|
TouchableOpacity6,
|
|
3030
3226
|
{
|
|
3031
3227
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3032
3228
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3033
3229
|
onPress: () => setTempDate(/* @__PURE__ */ new Date()),
|
|
3034
|
-
children: /* @__PURE__ */
|
|
3230
|
+
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children: "\u4ECA\u5929" })
|
|
3035
3231
|
}
|
|
3036
3232
|
),
|
|
3037
|
-
minDate && /* @__PURE__ */
|
|
3233
|
+
minDate && /* @__PURE__ */ jsx29(
|
|
3038
3234
|
TouchableOpacity6,
|
|
3039
3235
|
{
|
|
3040
3236
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3041
3237
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3042
3238
|
onPress: () => setTempDate(minDate),
|
|
3043
|
-
children: /* @__PURE__ */
|
|
3239
|
+
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children: "\u6700\u65E9" })
|
|
3044
3240
|
}
|
|
3045
3241
|
),
|
|
3046
|
-
maxDate && /* @__PURE__ */
|
|
3242
|
+
maxDate && /* @__PURE__ */ jsx29(
|
|
3047
3243
|
TouchableOpacity6,
|
|
3048
3244
|
{
|
|
3049
3245
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3050
3246
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3051
3247
|
onPress: () => setTempDate(maxDate),
|
|
3052
|
-
children: /* @__PURE__ */
|
|
3248
|
+
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children: "\u6700\u665A" })
|
|
3053
3249
|
}
|
|
3054
3250
|
)
|
|
3055
3251
|
]
|
|
@@ -3060,7 +3256,7 @@ function DatePicker({
|
|
|
3060
3256
|
)
|
|
3061
3257
|
] });
|
|
3062
3258
|
}
|
|
3063
|
-
var
|
|
3259
|
+
var styles11 = StyleSheet12.create({
|
|
3064
3260
|
trigger: {
|
|
3065
3261
|
borderWidth: 0.5
|
|
3066
3262
|
},
|
|
@@ -3076,7 +3272,7 @@ var styles10 = StyleSheet10.create({
|
|
|
3076
3272
|
});
|
|
3077
3273
|
|
|
3078
3274
|
// src/ui/form/FormItem.tsx
|
|
3079
|
-
import { jsx as
|
|
3275
|
+
import { jsx as jsx30, jsxs as jsxs12 } from "nativewind/jsx-runtime";
|
|
3080
3276
|
function FormItem({
|
|
3081
3277
|
name: _name,
|
|
3082
3278
|
label,
|
|
@@ -3088,14 +3284,14 @@ function FormItem({
|
|
|
3088
3284
|
labelClassName
|
|
3089
3285
|
}) {
|
|
3090
3286
|
const colors = useThemeColors();
|
|
3091
|
-
return /* @__PURE__ */
|
|
3092
|
-
label && /* @__PURE__ */
|
|
3093
|
-
/* @__PURE__ */
|
|
3094
|
-
required && /* @__PURE__ */
|
|
3287
|
+
return /* @__PURE__ */ jsxs12(AppView, { className: cn("mb-4", className), children: [
|
|
3288
|
+
label && /* @__PURE__ */ jsxs12(AppView, { row: true, items: "center", gap: 1, className: cn("mb-2", labelClassName), children: [
|
|
3289
|
+
/* @__PURE__ */ jsx30(AppText, { size: "sm", weight: "medium", style: { color: colors.textSecondary }, children: label }),
|
|
3290
|
+
required && /* @__PURE__ */ jsx30(AppText, { color: "error-500", children: "*" })
|
|
3095
3291
|
] }),
|
|
3096
3292
|
children,
|
|
3097
|
-
error && /* @__PURE__ */
|
|
3098
|
-
help && !error && /* @__PURE__ */
|
|
3293
|
+
error && /* @__PURE__ */ jsx30(AppText, { size: "sm", color: "error-500", className: "mt-1", children: error }),
|
|
3294
|
+
help && !error && /* @__PURE__ */ jsx30(AppText, { size: "sm", className: "mt-1", style: { color: colors.textMuted }, children: help })
|
|
3099
3295
|
] });
|
|
3100
3296
|
}
|
|
3101
3297
|
|
|
@@ -3228,10 +3424,35 @@ function useToggle(defaultValue = false) {
|
|
|
3228
3424
|
return [value, { toggle, set, setTrue, setFalse }];
|
|
3229
3425
|
}
|
|
3230
3426
|
|
|
3427
|
+
// src/ui/hooks/usePageDrawer.ts
|
|
3428
|
+
import { useCallback as useCallback17, useState as useState21 } from "react";
|
|
3429
|
+
function usePageDrawer(defaultVisible = false) {
|
|
3430
|
+
const [visible, setVisibleState] = useState21(defaultVisible);
|
|
3431
|
+
const open = useCallback17(() => {
|
|
3432
|
+
setVisibleState(true);
|
|
3433
|
+
}, []);
|
|
3434
|
+
const close = useCallback17(() => {
|
|
3435
|
+
setVisibleState(false);
|
|
3436
|
+
}, []);
|
|
3437
|
+
const toggle = useCallback17(() => {
|
|
3438
|
+
setVisibleState((current) => !current);
|
|
3439
|
+
}, []);
|
|
3440
|
+
const setVisible = useCallback17((nextVisible) => {
|
|
3441
|
+
setVisibleState(nextVisible);
|
|
3442
|
+
}, []);
|
|
3443
|
+
return {
|
|
3444
|
+
visible,
|
|
3445
|
+
open,
|
|
3446
|
+
close,
|
|
3447
|
+
toggle,
|
|
3448
|
+
setVisible
|
|
3449
|
+
};
|
|
3450
|
+
}
|
|
3451
|
+
|
|
3231
3452
|
// src/ui/hooks/useDebounce.ts
|
|
3232
|
-
import { useEffect as useEffect5, useState as
|
|
3453
|
+
import { useEffect as useEffect5, useState as useState22 } from "react";
|
|
3233
3454
|
function useDebounce(value, delay = 500) {
|
|
3234
|
-
const [debouncedValue, setDebouncedValue] =
|
|
3455
|
+
const [debouncedValue, setDebouncedValue] = useState22(value);
|
|
3235
3456
|
useEffect5(() => {
|
|
3236
3457
|
const timer = setTimeout(() => {
|
|
3237
3458
|
setDebouncedValue(value);
|
|
@@ -3244,9 +3465,9 @@ function useDebounce(value, delay = 500) {
|
|
|
3244
3465
|
}
|
|
3245
3466
|
|
|
3246
3467
|
// src/ui/hooks/useThrottle.ts
|
|
3247
|
-
import { useEffect as useEffect6, useRef as useRef7, useState as
|
|
3468
|
+
import { useEffect as useEffect6, useRef as useRef7, useState as useState23 } from "react";
|
|
3248
3469
|
function useThrottle(value, delay = 200) {
|
|
3249
|
-
const [throttledValue, setThrottledValue] =
|
|
3470
|
+
const [throttledValue, setThrottledValue] = useState23(value);
|
|
3250
3471
|
const lastUpdatedRef = useRef7(Date.now());
|
|
3251
3472
|
useEffect6(() => {
|
|
3252
3473
|
const now = Date.now();
|
|
@@ -3269,11 +3490,11 @@ function useThrottle(value, delay = 200) {
|
|
|
3269
3490
|
}
|
|
3270
3491
|
|
|
3271
3492
|
// src/ui/hooks/useKeyboard.ts
|
|
3272
|
-
import { useEffect as useEffect7, useState as
|
|
3493
|
+
import { useEffect as useEffect7, useState as useState24, useCallback as useCallback18 } from "react";
|
|
3273
3494
|
import { Keyboard, Platform } from "react-native";
|
|
3274
3495
|
function useKeyboard() {
|
|
3275
|
-
const [visible, setVisible] =
|
|
3276
|
-
const [height, setHeight] =
|
|
3496
|
+
const [visible, setVisible] = useState24(false);
|
|
3497
|
+
const [height, setHeight] = useState24(0);
|
|
3277
3498
|
useEffect7(() => {
|
|
3278
3499
|
const handleKeyboardWillShow = (event) => {
|
|
3279
3500
|
setVisible(true);
|
|
@@ -3304,17 +3525,17 @@ function useKeyboard() {
|
|
|
3304
3525
|
willHideSub.remove();
|
|
3305
3526
|
};
|
|
3306
3527
|
}, []);
|
|
3307
|
-
const dismiss =
|
|
3528
|
+
const dismiss = useCallback18(() => {
|
|
3308
3529
|
Keyboard.dismiss();
|
|
3309
3530
|
}, []);
|
|
3310
3531
|
return { visible, height, dismiss };
|
|
3311
3532
|
}
|
|
3312
3533
|
|
|
3313
3534
|
// src/ui/hooks/useDimensions.ts
|
|
3314
|
-
import { useEffect as useEffect8, useState as
|
|
3535
|
+
import { useEffect as useEffect8, useState as useState25 } from "react";
|
|
3315
3536
|
import { Dimensions } from "react-native";
|
|
3316
3537
|
function useDimensions() {
|
|
3317
|
-
const [dimensions, setDimensions] =
|
|
3538
|
+
const [dimensions, setDimensions] = useState25(() => {
|
|
3318
3539
|
const window = Dimensions.get("window");
|
|
3319
3540
|
return {
|
|
3320
3541
|
width: window.width,
|
|
@@ -3341,14 +3562,14 @@ function useDimensions() {
|
|
|
3341
3562
|
}
|
|
3342
3563
|
|
|
3343
3564
|
// src/ui/hooks/useOrientation.ts
|
|
3344
|
-
import { useEffect as useEffect9, useState as
|
|
3565
|
+
import { useEffect as useEffect9, useState as useState26 } from "react";
|
|
3345
3566
|
import { Dimensions as Dimensions2 } from "react-native";
|
|
3346
3567
|
function useOrientation() {
|
|
3347
3568
|
const getOrientation = () => {
|
|
3348
3569
|
const { width, height } = Dimensions2.get("window");
|
|
3349
3570
|
return width > height ? "landscape" : "portrait";
|
|
3350
3571
|
};
|
|
3351
|
-
const [orientation, setOrientation] =
|
|
3572
|
+
const [orientation, setOrientation] = useState26(getOrientation);
|
|
3352
3573
|
useEffect9(() => {
|
|
3353
3574
|
const handleChange = ({ window }) => {
|
|
3354
3575
|
const newOrientation = window.width > window.height ? "landscape" : "portrait";
|
|
@@ -3367,7 +3588,7 @@ function useOrientation() {
|
|
|
3367
3588
|
}
|
|
3368
3589
|
|
|
3369
3590
|
// src/navigation/provider.tsx
|
|
3370
|
-
import
|
|
3591
|
+
import React6 from "react";
|
|
3371
3592
|
import {
|
|
3372
3593
|
NavigationContainer
|
|
3373
3594
|
} from "@react-navigation/native";
|
|
@@ -3395,7 +3616,7 @@ function createNavigationTheme(pantherTheme, isDark) {
|
|
|
3395
3616
|
}
|
|
3396
3617
|
|
|
3397
3618
|
// src/navigation/provider.tsx
|
|
3398
|
-
import { jsx as
|
|
3619
|
+
import { jsx as jsx31 } from "nativewind/jsx-runtime";
|
|
3399
3620
|
function NavigationProvider({
|
|
3400
3621
|
children,
|
|
3401
3622
|
linking,
|
|
@@ -3406,11 +3627,11 @@ function NavigationProvider({
|
|
|
3406
3627
|
theme: customTheme
|
|
3407
3628
|
}) {
|
|
3408
3629
|
const { theme, isDark } = useTheme();
|
|
3409
|
-
const navigationTheme =
|
|
3630
|
+
const navigationTheme = React6.useMemo(
|
|
3410
3631
|
() => customTheme || createNavigationTheme(theme, isDark),
|
|
3411
3632
|
[customTheme, theme, isDark]
|
|
3412
3633
|
);
|
|
3413
|
-
return /* @__PURE__ */
|
|
3634
|
+
return /* @__PURE__ */ jsx31(
|
|
3414
3635
|
NavigationContainer,
|
|
3415
3636
|
{
|
|
3416
3637
|
theme: navigationTheme,
|
|
@@ -3428,14 +3649,14 @@ function NavigationProvider({
|
|
|
3428
3649
|
import { createStackNavigator, TransitionPresets } from "@react-navigation/stack";
|
|
3429
3650
|
|
|
3430
3651
|
// src/navigation/navigators/StackNavigator.tsx
|
|
3431
|
-
import { jsx as
|
|
3652
|
+
import { jsx as jsx32 } from "nativewind/jsx-runtime";
|
|
3432
3653
|
var NativeStack = createStackNavigator();
|
|
3433
3654
|
var defaultScreenOptions = {
|
|
3434
3655
|
headerShown: false,
|
|
3435
3656
|
...TransitionPresets.SlideFromRightIOS
|
|
3436
3657
|
};
|
|
3437
3658
|
function StackNavigator({ initialRouteName, screenOptions, children }) {
|
|
3438
|
-
return /* @__PURE__ */
|
|
3659
|
+
return /* @__PURE__ */ jsx32(
|
|
3439
3660
|
NativeStack.Navigator,
|
|
3440
3661
|
{
|
|
3441
3662
|
initialRouteName,
|
|
@@ -3447,7 +3668,7 @@ function StackNavigator({ initialRouteName, screenOptions, children }) {
|
|
|
3447
3668
|
StackNavigator.Screen = NativeStack.Screen;
|
|
3448
3669
|
StackNavigator.Group = NativeStack.Group;
|
|
3449
3670
|
function createStackScreens(routes) {
|
|
3450
|
-
return routes.map((route) => /* @__PURE__ */
|
|
3671
|
+
return routes.map((route) => /* @__PURE__ */ jsx32(
|
|
3451
3672
|
StackNavigator.Screen,
|
|
3452
3673
|
{
|
|
3453
3674
|
name: route.name,
|
|
@@ -3460,13 +3681,13 @@ function createStackScreens(routes) {
|
|
|
3460
3681
|
}
|
|
3461
3682
|
|
|
3462
3683
|
// src/navigation/navigators/TabNavigator.tsx
|
|
3463
|
-
import
|
|
3684
|
+
import React7 from "react";
|
|
3464
3685
|
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
|
|
3465
3686
|
|
|
3466
3687
|
// src/navigation/components/BottomTabBar.tsx
|
|
3467
|
-
import { View as View8, TouchableOpacity as TouchableOpacity7, StyleSheet as
|
|
3688
|
+
import { View as View8, TouchableOpacity as TouchableOpacity7, StyleSheet as StyleSheet13 } from "react-native";
|
|
3468
3689
|
import { useSafeAreaInsets as useSafeAreaInsets2 } from "react-native-safe-area-context";
|
|
3469
|
-
import { jsx as
|
|
3690
|
+
import { jsx as jsx33, jsxs as jsxs13 } from "nativewind/jsx-runtime";
|
|
3470
3691
|
var DEFAULT_TAB_BAR_HEIGHT = 65;
|
|
3471
3692
|
function BottomTabBar({
|
|
3472
3693
|
state,
|
|
@@ -3488,11 +3709,11 @@ function BottomTabBar({
|
|
|
3488
3709
|
const inactiveColor = inactiveTintColor || colors.textMuted;
|
|
3489
3710
|
const backgroundColor = style?.backgroundColor || colors.card;
|
|
3490
3711
|
const borderTopColor = colors.divider;
|
|
3491
|
-
return /* @__PURE__ */
|
|
3712
|
+
return /* @__PURE__ */ jsx33(
|
|
3492
3713
|
View8,
|
|
3493
3714
|
{
|
|
3494
3715
|
style: [
|
|
3495
|
-
|
|
3716
|
+
styles12.container,
|
|
3496
3717
|
{ borderTopColor },
|
|
3497
3718
|
{ backgroundColor, height: height + insets.bottom, paddingBottom: insets.bottom },
|
|
3498
3719
|
style
|
|
@@ -3523,7 +3744,7 @@ function BottomTabBar({
|
|
|
3523
3744
|
size: 24
|
|
3524
3745
|
}) : null;
|
|
3525
3746
|
const badge = options.tabBarBadge;
|
|
3526
|
-
return /* @__PURE__ */
|
|
3747
|
+
return /* @__PURE__ */ jsxs13(
|
|
3527
3748
|
TouchableOpacity7,
|
|
3528
3749
|
{
|
|
3529
3750
|
accessibilityRole: "button",
|
|
@@ -3533,21 +3754,21 @@ function BottomTabBar({
|
|
|
3533
3754
|
onPress,
|
|
3534
3755
|
onLongPress,
|
|
3535
3756
|
style: [
|
|
3536
|
-
|
|
3757
|
+
styles12.tab,
|
|
3537
3758
|
{
|
|
3538
3759
|
backgroundColor: isFocused ? activeBackgroundColor : inactiveBackgroundColor
|
|
3539
3760
|
}
|
|
3540
3761
|
],
|
|
3541
3762
|
children: [
|
|
3542
|
-
/* @__PURE__ */
|
|
3763
|
+
/* @__PURE__ */ jsxs13(View8, { style: [styles12.iconContainer, iconStyle], children: [
|
|
3543
3764
|
iconName,
|
|
3544
|
-
badge != null && /* @__PURE__ */
|
|
3765
|
+
badge != null && /* @__PURE__ */ jsx33(View8, { style: [styles12.badge, { backgroundColor: activeColor }], children: /* @__PURE__ */ jsx33(AppText, { style: styles12.badgeText, children: typeof badge === "number" && badge > 99 ? "99+" : badge }) })
|
|
3545
3766
|
] }),
|
|
3546
|
-
showLabel && /* @__PURE__ */
|
|
3767
|
+
showLabel && /* @__PURE__ */ jsx33(
|
|
3547
3768
|
AppText,
|
|
3548
3769
|
{
|
|
3549
3770
|
style: [
|
|
3550
|
-
|
|
3771
|
+
styles12.label,
|
|
3551
3772
|
{ color: isFocused ? activeColor : inactiveColor },
|
|
3552
3773
|
labelStyle
|
|
3553
3774
|
],
|
|
@@ -3563,7 +3784,7 @@ function BottomTabBar({
|
|
|
3563
3784
|
}
|
|
3564
3785
|
);
|
|
3565
3786
|
}
|
|
3566
|
-
var
|
|
3787
|
+
var styles12 = StyleSheet13.create({
|
|
3567
3788
|
container: {
|
|
3568
3789
|
flexDirection: "row",
|
|
3569
3790
|
borderTopWidth: 0.5,
|
|
@@ -3606,7 +3827,7 @@ var styles11 = StyleSheet11.create({
|
|
|
3606
3827
|
});
|
|
3607
3828
|
|
|
3608
3829
|
// src/navigation/navigators/TabNavigator.tsx
|
|
3609
|
-
import { jsx as
|
|
3830
|
+
import { jsx as jsx34 } from "nativewind/jsx-runtime";
|
|
3610
3831
|
var NativeTab = createBottomTabNavigator();
|
|
3611
3832
|
var defaultScreenOptions2 = {
|
|
3612
3833
|
headerShown: false,
|
|
@@ -3619,7 +3840,7 @@ function TabNavigator({
|
|
|
3619
3840
|
screenOptions,
|
|
3620
3841
|
children
|
|
3621
3842
|
}) {
|
|
3622
|
-
const mergedScreenOptions =
|
|
3843
|
+
const mergedScreenOptions = React7.useMemo(() => {
|
|
3623
3844
|
const options = { ...defaultScreenOptions2, ...screenOptions };
|
|
3624
3845
|
if (tabBarOptions) {
|
|
3625
3846
|
if (tabBarOptions.showLabel !== void 0) {
|
|
@@ -3652,9 +3873,9 @@ function TabNavigator({
|
|
|
3652
3873
|
}
|
|
3653
3874
|
return options;
|
|
3654
3875
|
}, [tabBarOptions, screenOptions]);
|
|
3655
|
-
const resolvedTabBar =
|
|
3876
|
+
const resolvedTabBar = React7.useMemo(() => {
|
|
3656
3877
|
if (tabBar) return tabBar;
|
|
3657
|
-
return (props) => /* @__PURE__ */
|
|
3878
|
+
return (props) => /* @__PURE__ */ jsx34(
|
|
3658
3879
|
BottomTabBar,
|
|
3659
3880
|
{
|
|
3660
3881
|
...props,
|
|
@@ -3681,7 +3902,7 @@ function TabNavigator({
|
|
|
3681
3902
|
tabBarOptions?.style,
|
|
3682
3903
|
tabBarOptions?.height
|
|
3683
3904
|
]);
|
|
3684
|
-
return /* @__PURE__ */
|
|
3905
|
+
return /* @__PURE__ */ jsx34(
|
|
3685
3906
|
NativeTab.Navigator,
|
|
3686
3907
|
{
|
|
3687
3908
|
initialRouteName,
|
|
@@ -3693,7 +3914,7 @@ function TabNavigator({
|
|
|
3693
3914
|
}
|
|
3694
3915
|
TabNavigator.Screen = NativeTab.Screen;
|
|
3695
3916
|
function createTabScreens(routes) {
|
|
3696
|
-
return routes.map((route) => /* @__PURE__ */
|
|
3917
|
+
return routes.map((route) => /* @__PURE__ */ jsx34(
|
|
3697
3918
|
TabNavigator.Screen,
|
|
3698
3919
|
{
|
|
3699
3920
|
name: route.name,
|
|
@@ -3706,9 +3927,9 @@ function createTabScreens(routes) {
|
|
|
3706
3927
|
}
|
|
3707
3928
|
|
|
3708
3929
|
// src/navigation/navigators/DrawerNavigator.tsx
|
|
3709
|
-
import
|
|
3930
|
+
import React8 from "react";
|
|
3710
3931
|
import { createDrawerNavigator } from "@react-navigation/drawer";
|
|
3711
|
-
import { jsx as
|
|
3932
|
+
import { jsx as jsx35 } from "nativewind/jsx-runtime";
|
|
3712
3933
|
var NativeDrawer = createDrawerNavigator();
|
|
3713
3934
|
function DrawerNavigator({
|
|
3714
3935
|
initialRouteName,
|
|
@@ -3719,7 +3940,7 @@ function DrawerNavigator({
|
|
|
3719
3940
|
}) {
|
|
3720
3941
|
const { theme, isDark } = useTheme();
|
|
3721
3942
|
const navigationTheme = createNavigationTheme(theme, isDark);
|
|
3722
|
-
const mergedScreenOptions =
|
|
3943
|
+
const mergedScreenOptions = React8.useMemo(() => {
|
|
3723
3944
|
return {
|
|
3724
3945
|
headerShown: false,
|
|
3725
3946
|
drawerStyle: {
|
|
@@ -3738,7 +3959,7 @@ function DrawerNavigator({
|
|
|
3738
3959
|
...screenOptions
|
|
3739
3960
|
};
|
|
3740
3961
|
}, [screenOptions, drawerOptions, navigationTheme, theme]);
|
|
3741
|
-
return /* @__PURE__ */
|
|
3962
|
+
return /* @__PURE__ */ jsx35(
|
|
3742
3963
|
NativeDrawer.Navigator,
|
|
3743
3964
|
{
|
|
3744
3965
|
initialRouteName,
|
|
@@ -3750,7 +3971,7 @@ function DrawerNavigator({
|
|
|
3750
3971
|
}
|
|
3751
3972
|
DrawerNavigator.Screen = NativeDrawer.Screen;
|
|
3752
3973
|
function createDrawerScreens(routes) {
|
|
3753
|
-
return routes.map((route) => /* @__PURE__ */
|
|
3974
|
+
return routes.map((route) => /* @__PURE__ */ jsx35(
|
|
3754
3975
|
DrawerNavigator.Screen,
|
|
3755
3976
|
{
|
|
3756
3977
|
name: route.name,
|
|
@@ -3763,9 +3984,9 @@ function createDrawerScreens(routes) {
|
|
|
3763
3984
|
}
|
|
3764
3985
|
|
|
3765
3986
|
// src/navigation/components/AppHeader.tsx
|
|
3766
|
-
import { StyleSheet as
|
|
3987
|
+
import { StyleSheet as StyleSheet14 } from "react-native";
|
|
3767
3988
|
import { useSafeAreaInsets as useSafeAreaInsets3 } from "react-native-safe-area-context";
|
|
3768
|
-
import { jsx as
|
|
3989
|
+
import { jsx as jsx36, jsxs as jsxs14 } from "nativewind/jsx-runtime";
|
|
3769
3990
|
function AppHeader({
|
|
3770
3991
|
title,
|
|
3771
3992
|
subtitle,
|
|
@@ -3779,7 +4000,7 @@ function AppHeader({
|
|
|
3779
4000
|
const colors = useThemeColors();
|
|
3780
4001
|
const insets = useSafeAreaInsets3();
|
|
3781
4002
|
const backgroundColor = transparent ? "transparent" : colors.card;
|
|
3782
|
-
return /* @__PURE__ */
|
|
4003
|
+
return /* @__PURE__ */ jsx36(
|
|
3783
4004
|
AppView,
|
|
3784
4005
|
{
|
|
3785
4006
|
style: [
|
|
@@ -3789,38 +4010,38 @@ function AppHeader({
|
|
|
3789
4010
|
},
|
|
3790
4011
|
style
|
|
3791
4012
|
],
|
|
3792
|
-
children: /* @__PURE__ */
|
|
3793
|
-
/* @__PURE__ */
|
|
3794
|
-
/* @__PURE__ */
|
|
3795
|
-
title && /* @__PURE__ */
|
|
4013
|
+
children: /* @__PURE__ */ jsxs14(AppView, { row: true, items: "center", px: 4, style: styles13.container, children: [
|
|
4014
|
+
/* @__PURE__ */ jsx36(AppView, { style: [styles13.sideContainer, styles13.leftContainer], children: leftIcon && /* @__PURE__ */ jsx36(AppPressable, { onPress: onLeftPress, style: styles13.iconButton, children: /* @__PURE__ */ jsx36(Icon, { name: leftIcon, size: 24, color: colors.text }) }) }),
|
|
4015
|
+
/* @__PURE__ */ jsxs14(AppView, { style: styles13.centerContainer, children: [
|
|
4016
|
+
title && /* @__PURE__ */ jsx36(
|
|
3796
4017
|
AppText,
|
|
3797
4018
|
{
|
|
3798
4019
|
size: "lg",
|
|
3799
4020
|
weight: "semibold",
|
|
3800
|
-
style: [
|
|
4021
|
+
style: [styles13.title, { color: colors.text }],
|
|
3801
4022
|
numberOfLines: 1,
|
|
3802
4023
|
children: title
|
|
3803
4024
|
}
|
|
3804
4025
|
),
|
|
3805
|
-
subtitle && /* @__PURE__ */
|
|
4026
|
+
subtitle && /* @__PURE__ */ jsx36(
|
|
3806
4027
|
AppText,
|
|
3807
4028
|
{
|
|
3808
4029
|
size: "xs",
|
|
3809
|
-
style: [
|
|
4030
|
+
style: [styles13.subtitle, { color: colors.textMuted }],
|
|
3810
4031
|
numberOfLines: 1,
|
|
3811
4032
|
children: subtitle
|
|
3812
4033
|
}
|
|
3813
4034
|
)
|
|
3814
4035
|
] }),
|
|
3815
|
-
/* @__PURE__ */
|
|
3816
|
-
/* @__PURE__ */
|
|
3817
|
-
icon.badge ? /* @__PURE__ */
|
|
4036
|
+
/* @__PURE__ */ jsx36(AppView, { row: true, items: "center", style: [styles13.sideContainer, styles13.rightContainer], children: rightIcons.map((icon, index) => /* @__PURE__ */ jsx36(AppPressable, { onPress: icon.onPress, style: styles13.iconButton, children: /* @__PURE__ */ jsxs14(AppView, { children: [
|
|
4037
|
+
/* @__PURE__ */ jsx36(Icon, { name: icon.icon, size: 24, color: colors.text }),
|
|
4038
|
+
icon.badge ? /* @__PURE__ */ jsx36(AppView, { style: styles13.badge, children: /* @__PURE__ */ jsx36(AppText, { size: "xs", color: "white", style: styles13.badgeText, children: icon.badge > 99 ? "99+" : icon.badge }) }) : null
|
|
3818
4039
|
] }) }, index)) })
|
|
3819
4040
|
] })
|
|
3820
4041
|
}
|
|
3821
4042
|
);
|
|
3822
4043
|
}
|
|
3823
|
-
var
|
|
4044
|
+
var styles13 = StyleSheet14.create({
|
|
3824
4045
|
container: {
|
|
3825
4046
|
height: 44
|
|
3826
4047
|
// iOS 标准导航栏高度
|
|
@@ -3871,9 +4092,9 @@ var styles12 = StyleSheet12.create({
|
|
|
3871
4092
|
});
|
|
3872
4093
|
|
|
3873
4094
|
// src/navigation/components/DrawerContent.tsx
|
|
3874
|
-
import { View as View9, TouchableOpacity as TouchableOpacity8, StyleSheet as
|
|
4095
|
+
import { View as View9, TouchableOpacity as TouchableOpacity8, StyleSheet as StyleSheet15 } from "react-native";
|
|
3875
4096
|
import { DrawerContentScrollView } from "@react-navigation/drawer";
|
|
3876
|
-
import { jsx as
|
|
4097
|
+
import { jsx as jsx37, jsxs as jsxs15 } from "nativewind/jsx-runtime";
|
|
3877
4098
|
function DrawerContent({
|
|
3878
4099
|
state,
|
|
3879
4100
|
descriptors,
|
|
@@ -3902,20 +4123,20 @@ function DrawerContent({
|
|
|
3902
4123
|
badge: options.tabBarBadge
|
|
3903
4124
|
};
|
|
3904
4125
|
});
|
|
3905
|
-
return /* @__PURE__ */
|
|
3906
|
-
header && /* @__PURE__ */
|
|
3907
|
-
/* @__PURE__ */
|
|
4126
|
+
return /* @__PURE__ */ jsxs15(DrawerContentScrollView, { style: [styles14.container, { backgroundColor }], children: [
|
|
4127
|
+
header && /* @__PURE__ */ jsx37(View9, { style: [styles14.header, { borderBottomColor: dividerColor }], children: header }),
|
|
4128
|
+
/* @__PURE__ */ jsx37(AppView, { className: "py-2", children: drawerItems.map((item) => {
|
|
3908
4129
|
const isFocused = state.routes[state.index].name === item.name;
|
|
3909
4130
|
const onPress = () => {
|
|
3910
4131
|
navigation.navigate(item.name);
|
|
3911
4132
|
};
|
|
3912
|
-
return /* @__PURE__ */
|
|
4133
|
+
return /* @__PURE__ */ jsxs15(
|
|
3913
4134
|
TouchableOpacity8,
|
|
3914
4135
|
{
|
|
3915
4136
|
onPress,
|
|
3916
|
-
style: [
|
|
4137
|
+
style: [styles14.item, isFocused && { backgroundColor: activeBgColor }],
|
|
3917
4138
|
children: [
|
|
3918
|
-
item.icon && /* @__PURE__ */
|
|
4139
|
+
item.icon && /* @__PURE__ */ jsx37(View9, { style: styles14.iconContainer, children: /* @__PURE__ */ jsx37(
|
|
3919
4140
|
Icon,
|
|
3920
4141
|
{
|
|
3921
4142
|
name: item.icon,
|
|
@@ -3923,28 +4144,28 @@ function DrawerContent({
|
|
|
3923
4144
|
color: isFocused ? activeColor : inactiveColor
|
|
3924
4145
|
}
|
|
3925
4146
|
) }),
|
|
3926
|
-
/* @__PURE__ */
|
|
4147
|
+
/* @__PURE__ */ jsx37(
|
|
3927
4148
|
AppText,
|
|
3928
4149
|
{
|
|
3929
4150
|
style: [
|
|
3930
|
-
|
|
4151
|
+
styles14.label,
|
|
3931
4152
|
{ color: isFocused ? activeColor : inactiveColor },
|
|
3932
|
-
isFocused &&
|
|
4153
|
+
isFocused && styles14.activeLabel
|
|
3933
4154
|
],
|
|
3934
4155
|
numberOfLines: 1,
|
|
3935
4156
|
children: item.label
|
|
3936
4157
|
}
|
|
3937
4158
|
),
|
|
3938
|
-
item.badge != null && /* @__PURE__ */
|
|
4159
|
+
item.badge != null && /* @__PURE__ */ jsx37(View9, { style: [styles14.badge, { backgroundColor: activeColor }], children: /* @__PURE__ */ jsx37(AppText, { style: styles14.badgeText, children: typeof item.badge === "number" && item.badge > 99 ? "99+" : item.badge }) })
|
|
3939
4160
|
]
|
|
3940
4161
|
},
|
|
3941
4162
|
item.name
|
|
3942
4163
|
);
|
|
3943
4164
|
}) }),
|
|
3944
|
-
footer && /* @__PURE__ */
|
|
4165
|
+
footer && /* @__PURE__ */ jsx37(View9, { style: [styles14.footer, { borderTopColor: dividerColor }], children: footer })
|
|
3945
4166
|
] });
|
|
3946
4167
|
}
|
|
3947
|
-
var
|
|
4168
|
+
var styles14 = StyleSheet15.create({
|
|
3948
4169
|
container: {
|
|
3949
4170
|
flex: 1
|
|
3950
4171
|
},
|
|
@@ -4047,7 +4268,7 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
|
4047
4268
|
|
|
4048
4269
|
// src/overlay/AppStatusBar.tsx
|
|
4049
4270
|
import { StatusBar } from "react-native";
|
|
4050
|
-
import { jsx as
|
|
4271
|
+
import { jsx as jsx38 } from "nativewind/jsx-runtime";
|
|
4051
4272
|
function AppStatusBar({
|
|
4052
4273
|
barStyle = "auto",
|
|
4053
4274
|
backgroundColor,
|
|
@@ -4057,7 +4278,7 @@ function AppStatusBar({
|
|
|
4057
4278
|
const { theme, isDark } = useTheme();
|
|
4058
4279
|
const resolvedBarStyle = barStyle === "auto" ? isDark ? "light-content" : "dark-content" : barStyle;
|
|
4059
4280
|
const resolvedBackgroundColor = backgroundColor ?? (translucent ? "transparent" : theme.colors.background?.[500] || "#ffffff");
|
|
4060
|
-
return /* @__PURE__ */
|
|
4281
|
+
return /* @__PURE__ */ jsx38(
|
|
4061
4282
|
StatusBar,
|
|
4062
4283
|
{
|
|
4063
4284
|
barStyle: resolvedBarStyle,
|
|
@@ -4069,7 +4290,7 @@ function AppStatusBar({
|
|
|
4069
4290
|
}
|
|
4070
4291
|
|
|
4071
4292
|
// src/overlay/loading/provider.tsx
|
|
4072
|
-
import { useState as
|
|
4293
|
+
import { useState as useState27, useCallback as useCallback19 } from "react";
|
|
4073
4294
|
|
|
4074
4295
|
// src/overlay/loading/context.ts
|
|
4075
4296
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
@@ -4081,15 +4302,15 @@ function useLoadingContext() {
|
|
|
4081
4302
|
}
|
|
4082
4303
|
|
|
4083
4304
|
// src/overlay/loading/component.tsx
|
|
4084
|
-
import { View as View10, Modal as
|
|
4085
|
-
import { jsx as
|
|
4305
|
+
import { View as View10, Modal as Modal5, ActivityIndicator as ActivityIndicator5, StyleSheet as StyleSheet16 } from "react-native";
|
|
4306
|
+
import { jsx as jsx39, jsxs as jsxs16 } from "nativewind/jsx-runtime";
|
|
4086
4307
|
function LoadingModal({ visible, text }) {
|
|
4087
|
-
return /* @__PURE__ */
|
|
4088
|
-
/* @__PURE__ */
|
|
4089
|
-
text && /* @__PURE__ */
|
|
4308
|
+
return /* @__PURE__ */ jsx39(Modal5, { transparent: true, visible, animationType: "fade", children: /* @__PURE__ */ jsx39(View10, { style: styles15.overlay, children: /* @__PURE__ */ jsxs16(View10, { style: [styles15.loadingBox, { backgroundColor: "rgba(0,0,0,0.8)" }], children: [
|
|
4309
|
+
/* @__PURE__ */ jsx39(ActivityIndicator5, { size: "large", color: "#fff" }),
|
|
4310
|
+
text && /* @__PURE__ */ jsx39(AppText, { className: "text-white mt-3 text-sm", children: text })
|
|
4090
4311
|
] }) }) });
|
|
4091
4312
|
}
|
|
4092
|
-
var
|
|
4313
|
+
var styles15 = StyleSheet16.create({
|
|
4093
4314
|
overlay: {
|
|
4094
4315
|
flex: 1,
|
|
4095
4316
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4105,24 +4326,24 @@ var styles14 = StyleSheet14.create({
|
|
|
4105
4326
|
});
|
|
4106
4327
|
|
|
4107
4328
|
// src/overlay/loading/provider.tsx
|
|
4108
|
-
import { jsx as
|
|
4329
|
+
import { jsx as jsx40, jsxs as jsxs17 } from "nativewind/jsx-runtime";
|
|
4109
4330
|
function LoadingProvider({ children }) {
|
|
4110
|
-
const [state, setState] =
|
|
4111
|
-
const show =
|
|
4331
|
+
const [state, setState] = useState27({ visible: false });
|
|
4332
|
+
const show = useCallback19((text) => {
|
|
4112
4333
|
setState({ visible: true, text });
|
|
4113
4334
|
}, []);
|
|
4114
|
-
const hide =
|
|
4335
|
+
const hide = useCallback19(() => {
|
|
4115
4336
|
setState({ visible: false });
|
|
4116
4337
|
}, []);
|
|
4117
|
-
return /* @__PURE__ */
|
|
4338
|
+
return /* @__PURE__ */ jsxs17(LoadingContext.Provider, { value: { show, hide }, children: [
|
|
4118
4339
|
children,
|
|
4119
|
-
/* @__PURE__ */
|
|
4340
|
+
/* @__PURE__ */ jsx40(LoadingModal, { ...state })
|
|
4120
4341
|
] });
|
|
4121
4342
|
}
|
|
4122
4343
|
|
|
4123
4344
|
// src/overlay/toast/provider.tsx
|
|
4124
|
-
import { useState as
|
|
4125
|
-
import { View as View11, StyleSheet as
|
|
4345
|
+
import { useState as useState28, useCallback as useCallback20, useRef as useRef9 } from "react";
|
|
4346
|
+
import { View as View11, StyleSheet as StyleSheet17 } from "react-native";
|
|
4126
4347
|
|
|
4127
4348
|
// src/overlay/toast/context.ts
|
|
4128
4349
|
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
@@ -4136,7 +4357,7 @@ function useToastContext() {
|
|
|
4136
4357
|
// src/overlay/toast/component.tsx
|
|
4137
4358
|
import { useRef as useRef8, useEffect as useEffect11 } from "react";
|
|
4138
4359
|
import { Animated } from "react-native";
|
|
4139
|
-
import { jsx as
|
|
4360
|
+
import { jsx as jsx41 } from "nativewind/jsx-runtime";
|
|
4140
4361
|
function ToastItemView({ message, type, onHide }) {
|
|
4141
4362
|
const fadeAnim = useRef8(new Animated.Value(0)).current;
|
|
4142
4363
|
useEffect11(() => {
|
|
@@ -4152,7 +4373,7 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4152
4373
|
warning: "bg-warning-500",
|
|
4153
4374
|
info: "bg-primary-500"
|
|
4154
4375
|
};
|
|
4155
|
-
return /* @__PURE__ */
|
|
4376
|
+
return /* @__PURE__ */ jsx41(
|
|
4156
4377
|
Animated.View,
|
|
4157
4378
|
{
|
|
4158
4379
|
style: {
|
|
@@ -4166,17 +4387,17 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4166
4387
|
}
|
|
4167
4388
|
]
|
|
4168
4389
|
},
|
|
4169
|
-
children: /* @__PURE__ */
|
|
4390
|
+
children: /* @__PURE__ */ jsx41(AppView, { className: `${bgColors[type]} px-4 py-3 rounded-lg mb-2 mx-4 shadow-lg`, children: /* @__PURE__ */ jsx41(AppText, { className: "text-white text-center", children: message }) })
|
|
4170
4391
|
}
|
|
4171
4392
|
);
|
|
4172
4393
|
}
|
|
4173
4394
|
|
|
4174
4395
|
// src/overlay/toast/provider.tsx
|
|
4175
|
-
import { jsx as
|
|
4396
|
+
import { jsx as jsx42, jsxs as jsxs18 } from "nativewind/jsx-runtime";
|
|
4176
4397
|
function ToastProvider({ children }) {
|
|
4177
|
-
const [toasts, setToasts] =
|
|
4398
|
+
const [toasts, setToasts] = useState28([]);
|
|
4178
4399
|
const timersRef = useRef9(/* @__PURE__ */ new Map());
|
|
4179
|
-
const remove =
|
|
4400
|
+
const remove = useCallback20((id) => {
|
|
4180
4401
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
4181
4402
|
const timer = timersRef.current.get(id);
|
|
4182
4403
|
if (timer) {
|
|
@@ -4184,7 +4405,7 @@ function ToastProvider({ children }) {
|
|
|
4184
4405
|
timersRef.current.delete(id);
|
|
4185
4406
|
}
|
|
4186
4407
|
}, []);
|
|
4187
|
-
const show =
|
|
4408
|
+
const show = useCallback20(
|
|
4188
4409
|
(message, type = "info", duration = 3e3) => {
|
|
4189
4410
|
const id = Math.random().toString(36).substring(7);
|
|
4190
4411
|
const toast = { id, message, type, duration };
|
|
@@ -4194,28 +4415,28 @@ function ToastProvider({ children }) {
|
|
|
4194
4415
|
},
|
|
4195
4416
|
[remove]
|
|
4196
4417
|
);
|
|
4197
|
-
const success =
|
|
4418
|
+
const success = useCallback20(
|
|
4198
4419
|
(message, duration) => show(message, "success", duration),
|
|
4199
4420
|
[show]
|
|
4200
4421
|
);
|
|
4201
|
-
const error =
|
|
4422
|
+
const error = useCallback20(
|
|
4202
4423
|
(message, duration) => show(message, "error", duration),
|
|
4203
4424
|
[show]
|
|
4204
4425
|
);
|
|
4205
|
-
const info =
|
|
4426
|
+
const info = useCallback20(
|
|
4206
4427
|
(message, duration) => show(message, "info", duration),
|
|
4207
4428
|
[show]
|
|
4208
4429
|
);
|
|
4209
|
-
const warning =
|
|
4430
|
+
const warning = useCallback20(
|
|
4210
4431
|
(message, duration) => show(message, "warning", duration),
|
|
4211
4432
|
[show]
|
|
4212
4433
|
);
|
|
4213
|
-
return /* @__PURE__ */
|
|
4434
|
+
return /* @__PURE__ */ jsxs18(ToastContext.Provider, { value: { show, success, error, info, warning }, children: [
|
|
4214
4435
|
children,
|
|
4215
|
-
/* @__PURE__ */
|
|
4436
|
+
/* @__PURE__ */ jsx42(View11, { style: styles16.toastContainer, pointerEvents: "none", children: toasts.map((toast) => /* @__PURE__ */ jsx42(ToastItemView, { ...toast, onHide: () => remove(toast.id) }, toast.id)) })
|
|
4216
4437
|
] });
|
|
4217
4438
|
}
|
|
4218
|
-
var
|
|
4439
|
+
var styles16 = StyleSheet17.create({
|
|
4219
4440
|
toastContainer: {
|
|
4220
4441
|
position: "absolute",
|
|
4221
4442
|
top: 60,
|
|
@@ -4226,7 +4447,7 @@ var styles15 = StyleSheet15.create({
|
|
|
4226
4447
|
});
|
|
4227
4448
|
|
|
4228
4449
|
// src/overlay/alert/provider.tsx
|
|
4229
|
-
import { useState as
|
|
4450
|
+
import { useState as useState29, useCallback as useCallback21 } from "react";
|
|
4230
4451
|
|
|
4231
4452
|
// src/overlay/alert/context.ts
|
|
4232
4453
|
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
@@ -4238,8 +4459,8 @@ function useAlertContext() {
|
|
|
4238
4459
|
}
|
|
4239
4460
|
|
|
4240
4461
|
// src/overlay/alert/component.tsx
|
|
4241
|
-
import { View as View12, Modal as
|
|
4242
|
-
import { jsx as
|
|
4462
|
+
import { View as View12, Modal as Modal6, StyleSheet as StyleSheet18 } from "react-native";
|
|
4463
|
+
import { jsx as jsx43, jsxs as jsxs19 } from "nativewind/jsx-runtime";
|
|
4243
4464
|
function AlertModal({
|
|
4244
4465
|
visible,
|
|
4245
4466
|
title,
|
|
@@ -4251,16 +4472,16 @@ function AlertModal({
|
|
|
4251
4472
|
onCancel
|
|
4252
4473
|
}) {
|
|
4253
4474
|
if (!visible) return null;
|
|
4254
|
-
return /* @__PURE__ */
|
|
4255
|
-
title && /* @__PURE__ */
|
|
4256
|
-
message && /* @__PURE__ */
|
|
4257
|
-
/* @__PURE__ */
|
|
4258
|
-
showCancel && /* @__PURE__ */
|
|
4259
|
-
/* @__PURE__ */
|
|
4475
|
+
return /* @__PURE__ */ jsx43(Modal6, { transparent: true, visible: true, animationType: "fade", children: /* @__PURE__ */ jsx43(View12, { style: styles17.overlay, children: /* @__PURE__ */ jsxs19(View12, { style: styles17.alertBox, children: [
|
|
4476
|
+
title && /* @__PURE__ */ jsx43(AppText, { className: "text-lg font-semibold text-center mb-2", children: title }),
|
|
4477
|
+
message && /* @__PURE__ */ jsx43(AppText, { className: "text-gray-600 text-center mb-4", children: message }),
|
|
4478
|
+
/* @__PURE__ */ jsxs19(AppView, { row: true, gap: 3, className: "mt-2", children: [
|
|
4479
|
+
showCancel && /* @__PURE__ */ jsx43(AppPressable, { onPress: onCancel, className: "flex-1 py-3 bg-gray-100 rounded-lg", children: /* @__PURE__ */ jsx43(AppText, { className: "text-center text-gray-700", children: cancelText || "\u53D6\u6D88" }) }),
|
|
4480
|
+
/* @__PURE__ */ jsx43(AppPressable, { onPress: onConfirm, className: "flex-1 py-3 bg-primary-500 rounded-lg", children: /* @__PURE__ */ jsx43(AppText, { className: "text-center text-white", children: confirmText || "\u786E\u5B9A" }) })
|
|
4260
4481
|
] })
|
|
4261
4482
|
] }) }) });
|
|
4262
4483
|
}
|
|
4263
|
-
var
|
|
4484
|
+
var styles17 = StyleSheet18.create({
|
|
4264
4485
|
overlay: {
|
|
4265
4486
|
flex: 1,
|
|
4266
4487
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4282,32 +4503,32 @@ var styles16 = StyleSheet16.create({
|
|
|
4282
4503
|
});
|
|
4283
4504
|
|
|
4284
4505
|
// src/overlay/alert/provider.tsx
|
|
4285
|
-
import { jsx as
|
|
4506
|
+
import { jsx as jsx44, jsxs as jsxs20 } from "nativewind/jsx-runtime";
|
|
4286
4507
|
function AlertProvider({ children }) {
|
|
4287
|
-
const [alert, setAlert] =
|
|
4288
|
-
const showAlert =
|
|
4508
|
+
const [alert, setAlert] = useState29(null);
|
|
4509
|
+
const showAlert = useCallback21((options) => {
|
|
4289
4510
|
setAlert({ ...options, visible: true });
|
|
4290
4511
|
}, []);
|
|
4291
|
-
const confirm =
|
|
4512
|
+
const confirm = useCallback21(
|
|
4292
4513
|
(options) => {
|
|
4293
4514
|
showAlert({ ...options, showCancel: true });
|
|
4294
4515
|
},
|
|
4295
4516
|
[showAlert]
|
|
4296
4517
|
);
|
|
4297
|
-
const hide =
|
|
4518
|
+
const hide = useCallback21(() => {
|
|
4298
4519
|
setAlert(null);
|
|
4299
4520
|
}, []);
|
|
4300
|
-
const handleConfirm =
|
|
4521
|
+
const handleConfirm = useCallback21(() => {
|
|
4301
4522
|
alert?.onConfirm?.();
|
|
4302
4523
|
hide();
|
|
4303
4524
|
}, [alert, hide]);
|
|
4304
|
-
const handleCancel =
|
|
4525
|
+
const handleCancel = useCallback21(() => {
|
|
4305
4526
|
alert?.onCancel?.();
|
|
4306
4527
|
hide();
|
|
4307
4528
|
}, [alert, hide]);
|
|
4308
|
-
return /* @__PURE__ */
|
|
4529
|
+
return /* @__PURE__ */ jsxs20(AlertContext.Provider, { value: { alert: showAlert, confirm }, children: [
|
|
4309
4530
|
children,
|
|
4310
|
-
/* @__PURE__ */
|
|
4531
|
+
/* @__PURE__ */ jsx44(
|
|
4311
4532
|
AlertModal,
|
|
4312
4533
|
{
|
|
4313
4534
|
visible: alert?.visible ?? false,
|
|
@@ -4324,13 +4545,13 @@ function AlertProvider({ children }) {
|
|
|
4324
4545
|
}
|
|
4325
4546
|
|
|
4326
4547
|
// src/overlay/provider.tsx
|
|
4327
|
-
import { jsx as
|
|
4548
|
+
import { jsx as jsx45 } from "nativewind/jsx-runtime";
|
|
4328
4549
|
function OverlayProvider({ children }) {
|
|
4329
|
-
return /* @__PURE__ */
|
|
4550
|
+
return /* @__PURE__ */ jsx45(LoadingProvider, { children: /* @__PURE__ */ jsx45(ToastProvider, { children: /* @__PURE__ */ jsx45(AlertProvider, { children }) }) });
|
|
4330
4551
|
}
|
|
4331
4552
|
|
|
4332
4553
|
// src/overlay/AppProvider.tsx
|
|
4333
|
-
import { Fragment as Fragment4, jsx as
|
|
4554
|
+
import { Fragment as Fragment4, jsx as jsx46, jsxs as jsxs21 } from "nativewind/jsx-runtime";
|
|
4334
4555
|
var defaultLightTheme = {
|
|
4335
4556
|
colors: {
|
|
4336
4557
|
primary: "#f38b32",
|
|
@@ -4367,21 +4588,21 @@ function AppProvider({
|
|
|
4367
4588
|
}) {
|
|
4368
4589
|
let content = children;
|
|
4369
4590
|
if (enableOverlay) {
|
|
4370
|
-
content = /* @__PURE__ */
|
|
4591
|
+
content = /* @__PURE__ */ jsx46(OverlayProvider, { children: content });
|
|
4371
4592
|
}
|
|
4372
4593
|
if (enableNavigation) {
|
|
4373
|
-
content = /* @__PURE__ */
|
|
4594
|
+
content = /* @__PURE__ */ jsx46(NavigationProvider, { ...navigationProps, children: content });
|
|
4374
4595
|
}
|
|
4375
4596
|
if (enableTheme) {
|
|
4376
|
-
content = /* @__PURE__ */
|
|
4377
|
-
enableStatusBar && /* @__PURE__ */
|
|
4597
|
+
content = /* @__PURE__ */ jsx46(ThemeProvider, { light: lightTheme, dark: darkTheme, defaultDark, isDark, children: /* @__PURE__ */ jsxs21(Fragment4, { children: [
|
|
4598
|
+
enableStatusBar && /* @__PURE__ */ jsx46(AppStatusBar, { testID: "status-bar", ...statusBarProps }),
|
|
4378
4599
|
content
|
|
4379
4600
|
] }) });
|
|
4380
4601
|
}
|
|
4381
4602
|
if (enableSafeArea) {
|
|
4382
|
-
content = /* @__PURE__ */
|
|
4603
|
+
content = /* @__PURE__ */ jsx46(SafeAreaProvider, { children: content });
|
|
4383
4604
|
}
|
|
4384
|
-
return /* @__PURE__ */
|
|
4605
|
+
return /* @__PURE__ */ jsx46(Fragment4, { children: content });
|
|
4385
4606
|
}
|
|
4386
4607
|
|
|
4387
4608
|
// src/overlay/loading/hooks.ts
|
|
@@ -4427,6 +4648,7 @@ export {
|
|
|
4427
4648
|
ErrorCode,
|
|
4428
4649
|
FileIcons,
|
|
4429
4650
|
FormItem,
|
|
4651
|
+
GradientView,
|
|
4430
4652
|
Icon,
|
|
4431
4653
|
Loading,
|
|
4432
4654
|
MemoryStorage,
|
|
@@ -4435,6 +4657,7 @@ export {
|
|
|
4435
4657
|
NavigationProvider,
|
|
4436
4658
|
OverlayProvider,
|
|
4437
4659
|
Page,
|
|
4660
|
+
PageDrawer,
|
|
4438
4661
|
Progress,
|
|
4439
4662
|
Radio,
|
|
4440
4663
|
RadioGroup,
|
|
@@ -4500,6 +4723,7 @@ export {
|
|
|
4500
4723
|
useNavigation,
|
|
4501
4724
|
useNavigationState,
|
|
4502
4725
|
useOrientation,
|
|
4726
|
+
usePageDrawer,
|
|
4503
4727
|
usePagination,
|
|
4504
4728
|
usePrevious,
|
|
4505
4729
|
useQuery,
|