@gaozh1024/rn-kit 0.2.0 → 0.3.1
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 +116 -1
- package/dist/index.d.mts +90 -2
- package/dist/index.d.ts +90 -2
- package/dist/index.js +657 -405
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +534 -285
- package/dist/index.mjs.map +1 -1
- package/package.json +9 -3
package/dist/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __export(index_exports, {
|
|
|
55
55
|
ErrorCode: () => ErrorCode,
|
|
56
56
|
FileIcons: () => FileIcons,
|
|
57
57
|
FormItem: () => FormItem,
|
|
58
|
+
GradientView: () => GradientView,
|
|
58
59
|
Icon: () => Icon,
|
|
59
60
|
Loading: () => Loading,
|
|
60
61
|
MemoryStorage: () => MemoryStorage,
|
|
@@ -63,6 +64,7 @@ __export(index_exports, {
|
|
|
63
64
|
NavigationProvider: () => NavigationProvider,
|
|
64
65
|
OverlayProvider: () => OverlayProvider,
|
|
65
66
|
Page: () => Page,
|
|
67
|
+
PageDrawer: () => PageDrawer,
|
|
66
68
|
Progress: () => Progress,
|
|
67
69
|
Radio: () => Radio,
|
|
68
70
|
RadioGroup: () => RadioGroup,
|
|
@@ -128,6 +130,7 @@ __export(index_exports, {
|
|
|
128
130
|
useNavigation: () => useNavigation,
|
|
129
131
|
useNavigationState: () => useNavigationState,
|
|
130
132
|
useOrientation: () => useOrientation,
|
|
133
|
+
usePageDrawer: () => usePageDrawer,
|
|
131
134
|
usePagination: () => usePagination,
|
|
132
135
|
usePrevious: () => usePrevious,
|
|
133
136
|
useQuery: () => import_react_query.useQuery,
|
|
@@ -1111,6 +1114,29 @@ function resolveTextTone(tone, theme, isDark) {
|
|
|
1111
1114
|
return void 0;
|
|
1112
1115
|
}
|
|
1113
1116
|
}
|
|
1117
|
+
var textUtilityTokens = /* @__PURE__ */ new Set([
|
|
1118
|
+
"text-left",
|
|
1119
|
+
"text-center",
|
|
1120
|
+
"text-right",
|
|
1121
|
+
"text-justify",
|
|
1122
|
+
"text-auto",
|
|
1123
|
+
"text-wrap",
|
|
1124
|
+
"text-nowrap",
|
|
1125
|
+
"text-balance",
|
|
1126
|
+
"text-pretty",
|
|
1127
|
+
"text-ellipsis",
|
|
1128
|
+
"text-clip"
|
|
1129
|
+
]);
|
|
1130
|
+
var textSizePattern = /^text-(xs|sm|base|lg|xl|[2-9]xl)$/;
|
|
1131
|
+
function hasExplicitTextColorClass(className) {
|
|
1132
|
+
if (!className) return false;
|
|
1133
|
+
return className.split(/\s+/).some((token) => {
|
|
1134
|
+
if (!token.startsWith("text-")) return false;
|
|
1135
|
+
if (textUtilityTokens.has(token)) return false;
|
|
1136
|
+
if (textSizePattern.test(token)) return false;
|
|
1137
|
+
return true;
|
|
1138
|
+
});
|
|
1139
|
+
}
|
|
1114
1140
|
|
|
1115
1141
|
// src/ui/primitives/AppView.tsx
|
|
1116
1142
|
var import_jsx_runtime2 = require("nativewind/jsx-runtime");
|
|
@@ -1216,6 +1242,9 @@ function AppText({
|
|
|
1216
1242
|
...props
|
|
1217
1243
|
}) {
|
|
1218
1244
|
const { theme, isDark } = useOptionalTheme();
|
|
1245
|
+
const flattenedStyle = import_react_native3.StyleSheet.flatten(style);
|
|
1246
|
+
const hasExplicitStyleColor = flattenedStyle?.color !== void 0;
|
|
1247
|
+
const hasExplicitClassColor = hasExplicitTextColorClass(className);
|
|
1219
1248
|
const sizeMap3 = {
|
|
1220
1249
|
xs: "text-xs",
|
|
1221
1250
|
sm: "text-sm",
|
|
@@ -1231,12 +1260,18 @@ function AppText({
|
|
|
1231
1260
|
semibold: "font-semibold",
|
|
1232
1261
|
bold: "font-bold"
|
|
1233
1262
|
};
|
|
1234
|
-
const
|
|
1263
|
+
const fallbackTone = tone ?? (color || hasExplicitStyleColor || hasExplicitClassColor ? void 0 : "default");
|
|
1264
|
+
const resolvedColor = resolveTextTone(fallbackTone, theme, isDark) ?? resolveNamedColor(color, theme, isDark);
|
|
1235
1265
|
const shouldUseClassColor = !!color && !resolvedColor;
|
|
1236
1266
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
1237
1267
|
import_react_native3.Text,
|
|
1238
1268
|
{
|
|
1239
|
-
className: cn(
|
|
1269
|
+
className: cn(
|
|
1270
|
+
sizeMap3[size],
|
|
1271
|
+
weightMap[weight],
|
|
1272
|
+
shouldUseClassColor && `text-${color}`,
|
|
1273
|
+
className
|
|
1274
|
+
),
|
|
1240
1275
|
style: [resolvedColor ? { color: resolvedColor } : void 0, style],
|
|
1241
1276
|
...props,
|
|
1242
1277
|
children
|
|
@@ -1601,13 +1636,7 @@ var styles2 = import_react_native7.StyleSheet.create({
|
|
|
1601
1636
|
// src/ui/feedback/Loading.tsx
|
|
1602
1637
|
var import_react_native8 = require("react-native");
|
|
1603
1638
|
var import_jsx_runtime13 = require("nativewind/jsx-runtime");
|
|
1604
|
-
function Loading({
|
|
1605
|
-
text,
|
|
1606
|
-
color,
|
|
1607
|
-
overlay = false,
|
|
1608
|
-
visible = true,
|
|
1609
|
-
testID
|
|
1610
|
-
}) {
|
|
1639
|
+
function Loading({ text, color, overlay = false, visible = true, testID }) {
|
|
1611
1640
|
if (!visible) return null;
|
|
1612
1641
|
const content = /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(AppView, { center: true, gap: 3, testID, children: [
|
|
1613
1642
|
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react_native8.ActivityIndicator, { size: "large", color }),
|
|
@@ -1694,7 +1723,8 @@ function Card({
|
|
|
1694
1723
|
}
|
|
1695
1724
|
|
|
1696
1725
|
// src/ui/display/Icon.tsx
|
|
1697
|
-
var
|
|
1726
|
+
var import_react_native10 = require("react-native");
|
|
1727
|
+
var import_vector_icons = require("@expo/vector-icons");
|
|
1698
1728
|
var import_jsx_runtime16 = require("nativewind/jsx-runtime");
|
|
1699
1729
|
var sizeMap2 = {
|
|
1700
1730
|
xs: 16,
|
|
@@ -1703,6 +1733,12 @@ var sizeMap2 = {
|
|
|
1703
1733
|
lg: 32,
|
|
1704
1734
|
xl: 48
|
|
1705
1735
|
};
|
|
1736
|
+
function isComponentLike(value) {
|
|
1737
|
+
if (typeof value === "function") return true;
|
|
1738
|
+
if (typeof value !== "object" || value === null) return false;
|
|
1739
|
+
return "$$typeof" in value;
|
|
1740
|
+
}
|
|
1741
|
+
var MaterialIconComponent = isComponentLike(import_vector_icons.MaterialIcons) ? import_vector_icons.MaterialIcons : void 0;
|
|
1706
1742
|
function resolveSize(size = "md") {
|
|
1707
1743
|
if (typeof size === "number") return size;
|
|
1708
1744
|
return sizeMap2[size] || 24;
|
|
@@ -1711,11 +1747,29 @@ function Icon({ name, size = "md", color = "gray-600", style, onPress, testID })
|
|
|
1711
1747
|
const { theme, isDark } = useOptionalTheme();
|
|
1712
1748
|
const resolvedSize = resolveSize(size);
|
|
1713
1749
|
const resolvedColor = resolveNamedColor(color, theme, isDark) ?? color;
|
|
1750
|
+
const fallback = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1751
|
+
import_react_native10.Text,
|
|
1752
|
+
{
|
|
1753
|
+
style: [
|
|
1754
|
+
{
|
|
1755
|
+
color: resolvedColor,
|
|
1756
|
+
fontSize: resolvedSize,
|
|
1757
|
+
lineHeight: resolvedSize
|
|
1758
|
+
},
|
|
1759
|
+
style
|
|
1760
|
+
],
|
|
1761
|
+
testID,
|
|
1762
|
+
children: "\u25A1"
|
|
1763
|
+
}
|
|
1764
|
+
);
|
|
1765
|
+
if (!MaterialIconComponent) {
|
|
1766
|
+
return onPress ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppPressable, { onPress, children: fallback }) : fallback;
|
|
1767
|
+
}
|
|
1714
1768
|
if (onPress) {
|
|
1715
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppPressable, { onPress, testID, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1769
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AppPressable, { onPress, testID, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(MaterialIconComponent, { name, size: resolvedSize, color: resolvedColor, style }) });
|
|
1716
1770
|
}
|
|
1717
1771
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1718
|
-
|
|
1772
|
+
MaterialIconComponent,
|
|
1719
1773
|
{
|
|
1720
1774
|
name,
|
|
1721
1775
|
size: resolvedSize,
|
|
@@ -1771,7 +1825,7 @@ var FileIcons = {
|
|
|
1771
1825
|
|
|
1772
1826
|
// src/ui/display/AppImage.tsx
|
|
1773
1827
|
var import_react14 = require("react");
|
|
1774
|
-
var
|
|
1828
|
+
var import_react_native11 = require("react-native");
|
|
1775
1829
|
var import_jsx_runtime17 = require("nativewind/jsx-runtime");
|
|
1776
1830
|
var radiusMap = {
|
|
1777
1831
|
none: 0,
|
|
@@ -1834,7 +1888,7 @@ function AppImage({
|
|
|
1834
1888
|
if (!isLoading) return null;
|
|
1835
1889
|
if (placeholder) {
|
|
1836
1890
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1837
|
-
|
|
1891
|
+
import_react_native11.Image,
|
|
1838
1892
|
{
|
|
1839
1893
|
source: placeholder,
|
|
1840
1894
|
style: {
|
|
@@ -1855,7 +1909,7 @@ function AppImage({
|
|
|
1855
1909
|
center: true,
|
|
1856
1910
|
className: "absolute inset-0 bg-gray-100",
|
|
1857
1911
|
style: { borderRadius: resolvedRadius },
|
|
1858
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1912
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_native11.ActivityIndicator, { color: theme.colors.primary?.[500] })
|
|
1859
1913
|
}
|
|
1860
1914
|
);
|
|
1861
1915
|
}
|
|
@@ -1867,7 +1921,7 @@ function AppImage({
|
|
|
1867
1921
|
if (!hasError) return null;
|
|
1868
1922
|
if (errorPlaceholder) {
|
|
1869
1923
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1870
|
-
|
|
1924
|
+
import_react_native11.Image,
|
|
1871
1925
|
{
|
|
1872
1926
|
source: errorPlaceholder,
|
|
1873
1927
|
style: {
|
|
@@ -1896,7 +1950,7 @@ function AppImage({
|
|
|
1896
1950
|
const isNumberWidth = typeof width === "number";
|
|
1897
1951
|
const isNumberHeight = typeof height === "number";
|
|
1898
1952
|
const content = /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1899
|
-
|
|
1953
|
+
import_react_native11.View,
|
|
1900
1954
|
{
|
|
1901
1955
|
className: cn("overflow-hidden", className),
|
|
1902
1956
|
style: {
|
|
@@ -1908,7 +1962,7 @@ function AppImage({
|
|
|
1908
1962
|
children: [
|
|
1909
1963
|
renderLoading(),
|
|
1910
1964
|
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1911
|
-
|
|
1965
|
+
import_react_native11.Image,
|
|
1912
1966
|
{
|
|
1913
1967
|
source,
|
|
1914
1968
|
style: imageStyle,
|
|
@@ -1929,7 +1983,7 @@ function AppImage({
|
|
|
1929
1983
|
|
|
1930
1984
|
// src/ui/display/AppList.tsx
|
|
1931
1985
|
var import_react15 = require("react");
|
|
1932
|
-
var
|
|
1986
|
+
var import_react_native12 = require("react-native");
|
|
1933
1987
|
var import_jsx_runtime18 = require("nativewind/jsx-runtime");
|
|
1934
1988
|
function SkeletonItem2({ render }) {
|
|
1935
1989
|
const colors = useThemeColors();
|
|
@@ -1978,7 +2032,7 @@ function ErrorState({ error, onRetry }) {
|
|
|
1978
2032
|
}
|
|
1979
2033
|
function LoadMoreFooter({ loading }) {
|
|
1980
2034
|
if (!loading) return null;
|
|
1981
|
-
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Center, { py: 4, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2035
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Center, { py: 4, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_native12.ActivityIndicator, { size: "small" }) });
|
|
1982
2036
|
}
|
|
1983
2037
|
function Divider({ style }) {
|
|
1984
2038
|
const colors = useThemeColors();
|
|
@@ -2057,7 +2111,7 @@ function AppList({
|
|
|
2057
2111
|
);
|
|
2058
2112
|
if (loading && data.length === 0) {
|
|
2059
2113
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2060
|
-
|
|
2114
|
+
import_react_native12.FlatList,
|
|
2061
2115
|
{
|
|
2062
2116
|
data: skeletonData,
|
|
2063
2117
|
renderItem: skeletonRenderItem,
|
|
@@ -2083,13 +2137,13 @@ function AppList({
|
|
|
2083
2137
|
] });
|
|
2084
2138
|
}, [isLoadingMore, ListFooterComponent]);
|
|
2085
2139
|
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2086
|
-
|
|
2140
|
+
import_react_native12.FlatList,
|
|
2087
2141
|
{
|
|
2088
2142
|
data,
|
|
2089
2143
|
renderItem: wrappedRenderItem,
|
|
2090
2144
|
keyExtractor: defaultKeyExtractor,
|
|
2091
2145
|
refreshControl: onRefresh ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2092
|
-
|
|
2146
|
+
import_react_native12.RefreshControl,
|
|
2093
2147
|
{
|
|
2094
2148
|
refreshing,
|
|
2095
2149
|
onRefresh,
|
|
@@ -2116,36 +2170,206 @@ function AppList({
|
|
|
2116
2170
|
}
|
|
2117
2171
|
);
|
|
2118
2172
|
}
|
|
2119
|
-
var styles3 =
|
|
2173
|
+
var styles3 = import_react_native12.StyleSheet.create({
|
|
2120
2174
|
retryButton: {
|
|
2121
2175
|
borderWidth: 0.5
|
|
2122
2176
|
}
|
|
2123
2177
|
});
|
|
2124
2178
|
|
|
2125
|
-
// src/ui/
|
|
2126
|
-
var import_react16 = require("react");
|
|
2127
|
-
var
|
|
2179
|
+
// src/ui/display/PageDrawer.tsx
|
|
2180
|
+
var import_react16 = __toESM(require("react"));
|
|
2181
|
+
var import_react_native13 = require("react-native");
|
|
2128
2182
|
var import_jsx_runtime19 = require("nativewind/jsx-runtime");
|
|
2129
|
-
|
|
2183
|
+
function PageDrawer({
|
|
2184
|
+
visible,
|
|
2185
|
+
onClose,
|
|
2186
|
+
title,
|
|
2187
|
+
header,
|
|
2188
|
+
footer,
|
|
2189
|
+
placement = "right",
|
|
2190
|
+
width = 320,
|
|
2191
|
+
swipeEnabled = true,
|
|
2192
|
+
swipeThreshold = 80,
|
|
2193
|
+
closeOnBackdropPress = true,
|
|
2194
|
+
showCloseButton = true,
|
|
2195
|
+
children,
|
|
2196
|
+
testID,
|
|
2197
|
+
contentTestID = "page-drawer-content",
|
|
2198
|
+
backdropTestID = "page-drawer-backdrop"
|
|
2199
|
+
}) {
|
|
2200
|
+
const colors = useThemeColors();
|
|
2201
|
+
const [translateX, setTranslateX] = import_react16.default.useState(0);
|
|
2202
|
+
if (!visible) return null;
|
|
2203
|
+
const handleClose = import_react16.default.useCallback(() => {
|
|
2204
|
+
setTranslateX(0);
|
|
2205
|
+
onClose?.();
|
|
2206
|
+
}, [onClose]);
|
|
2207
|
+
import_react16.default.useEffect(() => {
|
|
2208
|
+
if (!visible) return;
|
|
2209
|
+
const subscription = import_react_native13.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
2210
|
+
handleClose();
|
|
2211
|
+
return true;
|
|
2212
|
+
});
|
|
2213
|
+
return () => subscription.remove();
|
|
2214
|
+
}, [handleClose, visible]);
|
|
2215
|
+
const panResponder = import_react16.default.useMemo(
|
|
2216
|
+
() => import_react_native13.PanResponder.create({
|
|
2217
|
+
onMoveShouldSetPanResponder: (_event, gestureState) => {
|
|
2218
|
+
if (!swipeEnabled) return false;
|
|
2219
|
+
const isHorizontal = Math.abs(gestureState.dx) > Math.abs(gestureState.dy);
|
|
2220
|
+
const reachesThreshold = Math.abs(gestureState.dx) > 8;
|
|
2221
|
+
return isHorizontal && reachesThreshold;
|
|
2222
|
+
},
|
|
2223
|
+
onPanResponderMove: (_event, gestureState) => {
|
|
2224
|
+
if (!swipeEnabled) return;
|
|
2225
|
+
const nextTranslateX = placement === "right" ? Math.min(0, Math.max(-width, gestureState.dx)) : Math.max(0, Math.min(width, gestureState.dx));
|
|
2226
|
+
setTranslateX(nextTranslateX);
|
|
2227
|
+
},
|
|
2228
|
+
onPanResponderRelease: (_event, gestureState) => {
|
|
2229
|
+
if (!swipeEnabled) {
|
|
2230
|
+
setTranslateX(0);
|
|
2231
|
+
return;
|
|
2232
|
+
}
|
|
2233
|
+
const reachedCloseThreshold = placement === "right" ? gestureState.dx <= -swipeThreshold : gestureState.dx >= swipeThreshold;
|
|
2234
|
+
if (reachedCloseThreshold) {
|
|
2235
|
+
handleClose();
|
|
2236
|
+
return;
|
|
2237
|
+
}
|
|
2238
|
+
setTranslateX(0);
|
|
2239
|
+
},
|
|
2240
|
+
onPanResponderTerminate: () => {
|
|
2241
|
+
setTranslateX(0);
|
|
2242
|
+
}
|
|
2243
|
+
}),
|
|
2244
|
+
[handleClose, placement, swipeEnabled, swipeThreshold, width]
|
|
2245
|
+
);
|
|
2246
|
+
const drawerContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2247
|
+
AppView,
|
|
2248
|
+
{
|
|
2249
|
+
testID: contentTestID,
|
|
2250
|
+
className: "h-full",
|
|
2251
|
+
...panResponder.panHandlers,
|
|
2252
|
+
style: [
|
|
2253
|
+
styles4.drawer,
|
|
2254
|
+
{
|
|
2255
|
+
width,
|
|
2256
|
+
backgroundColor: colors.card,
|
|
2257
|
+
borderLeftWidth: placement === "right" ? 0.5 : 0,
|
|
2258
|
+
borderRightWidth: placement === "left" ? 0.5 : 0,
|
|
2259
|
+
borderLeftColor: colors.border,
|
|
2260
|
+
borderRightColor: colors.border,
|
|
2261
|
+
transform: [{ translateX }]
|
|
2262
|
+
}
|
|
2263
|
+
],
|
|
2264
|
+
children: [
|
|
2265
|
+
(header || title || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2266
|
+
AppView,
|
|
2267
|
+
{
|
|
2268
|
+
row: true,
|
|
2269
|
+
items: "center",
|
|
2270
|
+
between: true,
|
|
2271
|
+
className: "px-4 py-4",
|
|
2272
|
+
style: [styles4.header, { borderBottomColor: colors.divider }],
|
|
2273
|
+
children: [
|
|
2274
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AppView, { flex: true, children: header || (title ? /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AppText, { size: "lg", weight: "semibold", children: title }) : null) }),
|
|
2275
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2276
|
+
AppPressable,
|
|
2277
|
+
{
|
|
2278
|
+
testID: "page-drawer-close",
|
|
2279
|
+
className: "p-1",
|
|
2280
|
+
pressedClassName: "opacity-70",
|
|
2281
|
+
onPress: handleClose,
|
|
2282
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "close", size: "md", color: colors.textSecondary })
|
|
2283
|
+
}
|
|
2284
|
+
)
|
|
2285
|
+
]
|
|
2286
|
+
}
|
|
2287
|
+
),
|
|
2288
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AppScrollView, { flex: true, className: "px-4 py-4", children }),
|
|
2289
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2290
|
+
AppView,
|
|
2291
|
+
{
|
|
2292
|
+
className: "px-4 py-4",
|
|
2293
|
+
style: [styles4.footer, { borderTopColor: colors.divider }],
|
|
2294
|
+
children: footer
|
|
2295
|
+
}
|
|
2296
|
+
)
|
|
2297
|
+
]
|
|
2298
|
+
}
|
|
2299
|
+
);
|
|
2300
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native13.Modal, { visible: true, transparent: true, animationType: "fade", onRequestClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2301
|
+
AppView,
|
|
2302
|
+
{
|
|
2303
|
+
testID,
|
|
2304
|
+
flex: true,
|
|
2305
|
+
row: true,
|
|
2306
|
+
style: { backgroundColor: "rgba(0,0,0,0.5)" },
|
|
2307
|
+
justify: placement === "right" ? "end" : "start",
|
|
2308
|
+
children: [
|
|
2309
|
+
placement === "left" && drawerContent,
|
|
2310
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2311
|
+
AppPressable,
|
|
2312
|
+
{
|
|
2313
|
+
testID: backdropTestID,
|
|
2314
|
+
className: "flex-1",
|
|
2315
|
+
onPress: closeOnBackdropPress ? handleClose : void 0
|
|
2316
|
+
}
|
|
2317
|
+
),
|
|
2318
|
+
placement === "right" && drawerContent
|
|
2319
|
+
]
|
|
2320
|
+
}
|
|
2321
|
+
) });
|
|
2322
|
+
}
|
|
2323
|
+
var styles4 = import_react_native13.StyleSheet.create({
|
|
2324
|
+
drawer: {
|
|
2325
|
+
height: "100%"
|
|
2326
|
+
},
|
|
2327
|
+
header: {
|
|
2328
|
+
borderBottomWidth: 0.5
|
|
2329
|
+
},
|
|
2330
|
+
footer: {
|
|
2331
|
+
borderTopWidth: 0.5
|
|
2332
|
+
}
|
|
2333
|
+
});
|
|
2334
|
+
|
|
2335
|
+
// src/ui/display/GradientView.tsx
|
|
2336
|
+
var import_expo_linear_gradient = require("expo-linear-gradient");
|
|
2337
|
+
var import_jsx_runtime20 = require("nativewind/jsx-runtime");
|
|
2338
|
+
function GradientView({
|
|
2339
|
+
colors,
|
|
2340
|
+
start = { x: 0, y: 0 },
|
|
2341
|
+
end = { x: 1, y: 1 },
|
|
2342
|
+
children,
|
|
2343
|
+
style,
|
|
2344
|
+
...props
|
|
2345
|
+
}) {
|
|
2346
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_expo_linear_gradient.LinearGradient, { colors: [...colors], start, end, style, ...props, children });
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
// src/ui/form/AppInput.tsx
|
|
2350
|
+
var import_react17 = require("react");
|
|
2351
|
+
var import_react_native14 = require("react-native");
|
|
2352
|
+
var import_jsx_runtime21 = require("nativewind/jsx-runtime");
|
|
2353
|
+
var AppInput = (0, import_react17.forwardRef)(
|
|
2130
2354
|
({ label, error, disabled = false, leftIcon, rightIcon, className, style, ...props }, ref) => {
|
|
2131
2355
|
const colors = useThemeColors();
|
|
2132
|
-
const [isFocused, setIsFocused] = (0,
|
|
2356
|
+
const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
|
|
2133
2357
|
const errorColor = "#ef4444";
|
|
2134
2358
|
const getBorderColor = () => {
|
|
2135
2359
|
if (error) return errorColor;
|
|
2136
2360
|
if (isFocused) return colors.primary;
|
|
2137
2361
|
return colors.border;
|
|
2138
2362
|
};
|
|
2139
|
-
return /* @__PURE__ */ (0,
|
|
2140
|
-
label && /* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2363
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(AppView, { className: cn("flex-col gap-1", className), children: [
|
|
2364
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AppText, { size: "sm", weight: "medium", style: { color: colors.textSecondary }, children: label }),
|
|
2365
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2142
2366
|
AppView,
|
|
2143
2367
|
{
|
|
2144
2368
|
row: true,
|
|
2145
2369
|
items: "center",
|
|
2146
2370
|
className: "rounded-lg px-3",
|
|
2147
2371
|
style: [
|
|
2148
|
-
|
|
2372
|
+
styles5.inputContainer,
|
|
2149
2373
|
{
|
|
2150
2374
|
backgroundColor: colors.card,
|
|
2151
2375
|
borderColor: getBorderColor(),
|
|
@@ -2153,13 +2377,13 @@ var AppInput = (0, import_react16.forwardRef)(
|
|
|
2153
2377
|
}
|
|
2154
2378
|
],
|
|
2155
2379
|
children: [
|
|
2156
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
2157
|
-
/* @__PURE__ */ (0,
|
|
2158
|
-
|
|
2380
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native14.View, { style: styles5.icon, children: leftIcon }),
|
|
2381
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2382
|
+
import_react_native14.TextInput,
|
|
2159
2383
|
{
|
|
2160
2384
|
ref,
|
|
2161
2385
|
className: "flex-1 py-3 text-base",
|
|
2162
|
-
style: [
|
|
2386
|
+
style: [styles5.input, { color: colors.text }, style],
|
|
2163
2387
|
placeholderTextColor: colors.textMuted,
|
|
2164
2388
|
editable: !disabled,
|
|
2165
2389
|
onFocus: (e) => {
|
|
@@ -2173,16 +2397,16 @@ var AppInput = (0, import_react16.forwardRef)(
|
|
|
2173
2397
|
...props
|
|
2174
2398
|
}
|
|
2175
2399
|
),
|
|
2176
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
2400
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native14.View, { style: styles5.icon, children: rightIcon })
|
|
2177
2401
|
]
|
|
2178
2402
|
}
|
|
2179
2403
|
),
|
|
2180
|
-
error && /* @__PURE__ */ (0,
|
|
2404
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AppText, { size: "xs", style: { color: errorColor }, children: error })
|
|
2181
2405
|
] });
|
|
2182
2406
|
}
|
|
2183
2407
|
);
|
|
2184
2408
|
AppInput.displayName = "AppInput";
|
|
2185
|
-
var
|
|
2409
|
+
var styles5 = import_react_native14.StyleSheet.create({
|
|
2186
2410
|
inputContainer: {
|
|
2187
2411
|
borderWidth: 0.5,
|
|
2188
2412
|
minHeight: 48
|
|
@@ -2197,9 +2421,9 @@ var styles4 = import_react_native12.StyleSheet.create({
|
|
|
2197
2421
|
});
|
|
2198
2422
|
|
|
2199
2423
|
// src/ui/form/Checkbox.tsx
|
|
2200
|
-
var
|
|
2201
|
-
var
|
|
2202
|
-
var
|
|
2424
|
+
var import_react18 = require("react");
|
|
2425
|
+
var import_react_native15 = require("react-native");
|
|
2426
|
+
var import_jsx_runtime22 = require("nativewind/jsx-runtime");
|
|
2203
2427
|
function Checkbox({
|
|
2204
2428
|
checked,
|
|
2205
2429
|
defaultChecked,
|
|
@@ -2210,7 +2434,7 @@ function Checkbox({
|
|
|
2210
2434
|
testID
|
|
2211
2435
|
}) {
|
|
2212
2436
|
const colors = useThemeColors();
|
|
2213
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
2437
|
+
const [internalChecked, setInternalChecked] = (0, import_react18.useState)(defaultChecked || false);
|
|
2214
2438
|
const isChecked = checked !== void 0 ? checked : internalChecked;
|
|
2215
2439
|
const toggle = () => {
|
|
2216
2440
|
if (disabled) return;
|
|
@@ -2221,8 +2445,8 @@ function Checkbox({
|
|
|
2221
2445
|
onChange?.(newChecked);
|
|
2222
2446
|
};
|
|
2223
2447
|
const disabledOpacity = 0.4;
|
|
2224
|
-
return /* @__PURE__ */ (0,
|
|
2225
|
-
|
|
2448
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2449
|
+
import_react_native15.TouchableOpacity,
|
|
2226
2450
|
{
|
|
2227
2451
|
onPress: toggle,
|
|
2228
2452
|
disabled,
|
|
@@ -2231,7 +2455,7 @@ function Checkbox({
|
|
|
2231
2455
|
testID,
|
|
2232
2456
|
activeOpacity: 0.7,
|
|
2233
2457
|
children: [
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2458
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2235
2459
|
AppView,
|
|
2236
2460
|
{
|
|
2237
2461
|
className: cn(
|
|
@@ -2239,21 +2463,21 @@ function Checkbox({
|
|
|
2239
2463
|
isChecked ? "bg-primary-500" : "bg-white border"
|
|
2240
2464
|
),
|
|
2241
2465
|
style: [
|
|
2242
|
-
|
|
2466
|
+
styles6.checkbox,
|
|
2243
2467
|
{
|
|
2244
2468
|
backgroundColor: isChecked ? colors.primary : colors.cardElevated,
|
|
2245
2469
|
borderColor: isChecked ? colors.primary : colors.border
|
|
2246
2470
|
}
|
|
2247
2471
|
],
|
|
2248
|
-
children: isChecked && /* @__PURE__ */ (0,
|
|
2472
|
+
children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AppView, { testID: `${testID}-icon`, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(Icon, { name: "check", size: "sm", color: "white" }) })
|
|
2249
2473
|
}
|
|
2250
2474
|
),
|
|
2251
|
-
children && /* @__PURE__ */ (0,
|
|
2475
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AppText, { size: "sm", style: { color: colors.text }, children })
|
|
2252
2476
|
]
|
|
2253
2477
|
}
|
|
2254
2478
|
);
|
|
2255
2479
|
}
|
|
2256
|
-
var
|
|
2480
|
+
var styles6 = import_react_native15.StyleSheet.create({
|
|
2257
2481
|
checkbox: {
|
|
2258
2482
|
borderWidth: 0.5
|
|
2259
2483
|
}
|
|
@@ -2271,7 +2495,7 @@ var isGroupOptionDisabled = (groupDisabled, optionDisabled) => {
|
|
|
2271
2495
|
};
|
|
2272
2496
|
|
|
2273
2497
|
// src/ui/form/CheckboxGroup.tsx
|
|
2274
|
-
var
|
|
2498
|
+
var import_jsx_runtime23 = require("nativewind/jsx-runtime");
|
|
2275
2499
|
function CheckboxGroup({
|
|
2276
2500
|
value = [],
|
|
2277
2501
|
onChange,
|
|
@@ -2284,7 +2508,7 @@ function CheckboxGroup({
|
|
|
2284
2508
|
onChange(toggleGroupValue(value, optionValue, checked));
|
|
2285
2509
|
};
|
|
2286
2510
|
const isRow = direction === "row";
|
|
2287
|
-
return /* @__PURE__ */ (0,
|
|
2511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AppView, { row: isRow, flex: isRow, gap: 4, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2288
2512
|
Checkbox,
|
|
2289
2513
|
{
|
|
2290
2514
|
checked: value.includes(option.value),
|
|
@@ -2297,9 +2521,9 @@ function CheckboxGroup({
|
|
|
2297
2521
|
}
|
|
2298
2522
|
|
|
2299
2523
|
// src/ui/form/Radio.tsx
|
|
2300
|
-
var
|
|
2301
|
-
var
|
|
2302
|
-
var
|
|
2524
|
+
var import_react19 = require("react");
|
|
2525
|
+
var import_react_native16 = require("react-native");
|
|
2526
|
+
var import_jsx_runtime24 = require("nativewind/jsx-runtime");
|
|
2303
2527
|
function Radio({
|
|
2304
2528
|
checked,
|
|
2305
2529
|
defaultChecked,
|
|
@@ -2310,7 +2534,7 @@ function Radio({
|
|
|
2310
2534
|
testID
|
|
2311
2535
|
}) {
|
|
2312
2536
|
const colors = useThemeColors();
|
|
2313
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
2537
|
+
const [internalChecked, setInternalChecked] = (0, import_react19.useState)(defaultChecked || false);
|
|
2314
2538
|
const isChecked = checked !== void 0 ? checked : internalChecked;
|
|
2315
2539
|
const toggle = () => {
|
|
2316
2540
|
if (disabled) return;
|
|
@@ -2321,8 +2545,8 @@ function Radio({
|
|
|
2321
2545
|
onChange?.(newChecked);
|
|
2322
2546
|
};
|
|
2323
2547
|
const disabledOpacity = 0.4;
|
|
2324
|
-
return /* @__PURE__ */ (0,
|
|
2325
|
-
|
|
2548
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2549
|
+
import_react_native16.TouchableOpacity,
|
|
2326
2550
|
{
|
|
2327
2551
|
onPress: toggle,
|
|
2328
2552
|
disabled,
|
|
@@ -2331,33 +2555,33 @@ function Radio({
|
|
|
2331
2555
|
testID,
|
|
2332
2556
|
activeOpacity: 0.7,
|
|
2333
2557
|
children: [
|
|
2334
|
-
/* @__PURE__ */ (0,
|
|
2558
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2335
2559
|
AppView,
|
|
2336
2560
|
{
|
|
2337
2561
|
className: cn("w-5 h-5 rounded-full items-center justify-center", isChecked && "border-2"),
|
|
2338
2562
|
style: [
|
|
2339
|
-
|
|
2563
|
+
styles7.radio,
|
|
2340
2564
|
{
|
|
2341
2565
|
backgroundColor: colors.card,
|
|
2342
2566
|
borderColor: isChecked ? colors.primary : colors.border,
|
|
2343
2567
|
borderWidth: isChecked ? 0.5 : 0.5
|
|
2344
2568
|
}
|
|
2345
2569
|
],
|
|
2346
|
-
children: isChecked && /* @__PURE__ */ (0,
|
|
2570
|
+
children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2347
2571
|
AppView,
|
|
2348
2572
|
{
|
|
2349
2573
|
className: "rounded-full",
|
|
2350
|
-
style: [
|
|
2574
|
+
style: [styles7.inner, { backgroundColor: colors.primary }]
|
|
2351
2575
|
}
|
|
2352
2576
|
)
|
|
2353
2577
|
}
|
|
2354
2578
|
),
|
|
2355
|
-
children && /* @__PURE__ */ (0,
|
|
2579
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AppText, { size: "sm", style: { color: colors.text }, children })
|
|
2356
2580
|
]
|
|
2357
2581
|
}
|
|
2358
2582
|
);
|
|
2359
2583
|
}
|
|
2360
|
-
var
|
|
2584
|
+
var styles7 = import_react_native16.StyleSheet.create({
|
|
2361
2585
|
radio: {
|
|
2362
2586
|
borderWidth: 0.5
|
|
2363
2587
|
},
|
|
@@ -2368,7 +2592,7 @@ var styles6 = import_react_native14.StyleSheet.create({
|
|
|
2368
2592
|
});
|
|
2369
2593
|
|
|
2370
2594
|
// src/ui/form/RadioGroup.tsx
|
|
2371
|
-
var
|
|
2595
|
+
var import_jsx_runtime25 = require("nativewind/jsx-runtime");
|
|
2372
2596
|
function RadioGroup({
|
|
2373
2597
|
value,
|
|
2374
2598
|
onChange,
|
|
@@ -2377,7 +2601,7 @@ function RadioGroup({
|
|
|
2377
2601
|
disabled = false
|
|
2378
2602
|
}) {
|
|
2379
2603
|
const isRow = direction === "row";
|
|
2380
|
-
return /* @__PURE__ */ (0,
|
|
2604
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AppView, { row: isRow, flex: isRow, gap: 4, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2381
2605
|
Radio,
|
|
2382
2606
|
{
|
|
2383
2607
|
checked: value === option.value,
|
|
@@ -2390,9 +2614,9 @@ function RadioGroup({
|
|
|
2390
2614
|
}
|
|
2391
2615
|
|
|
2392
2616
|
// src/ui/form/Switch.tsx
|
|
2393
|
-
var
|
|
2394
|
-
var
|
|
2395
|
-
var
|
|
2617
|
+
var import_react20 = require("react");
|
|
2618
|
+
var import_react_native17 = require("react-native");
|
|
2619
|
+
var import_jsx_runtime26 = require("nativewind/jsx-runtime");
|
|
2396
2620
|
function Switch({
|
|
2397
2621
|
checked,
|
|
2398
2622
|
defaultChecked,
|
|
@@ -2404,7 +2628,7 @@ function Switch({
|
|
|
2404
2628
|
style
|
|
2405
2629
|
}) {
|
|
2406
2630
|
const colors = useThemeColors();
|
|
2407
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
2631
|
+
const [internalChecked, setInternalChecked] = (0, import_react20.useState)(defaultChecked || false);
|
|
2408
2632
|
const isChecked = checked !== void 0 ? checked : internalChecked;
|
|
2409
2633
|
const toggle = () => {
|
|
2410
2634
|
if (disabled) return;
|
|
@@ -2424,20 +2648,20 @@ function Switch({
|
|
|
2424
2648
|
};
|
|
2425
2649
|
const config = sizes[size];
|
|
2426
2650
|
const thumbPosition = isChecked ? config.width - config.thumb - config.padding : config.padding;
|
|
2427
|
-
return /* @__PURE__ */ (0,
|
|
2428
|
-
|
|
2651
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2652
|
+
import_react_native17.TouchableOpacity,
|
|
2429
2653
|
{
|
|
2430
2654
|
onPress: toggle,
|
|
2431
2655
|
disabled,
|
|
2432
2656
|
className: cn(className),
|
|
2433
2657
|
testID,
|
|
2434
2658
|
activeOpacity: disabled ? 1 : 0.8,
|
|
2435
|
-
children: /* @__PURE__ */ (0,
|
|
2659
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2436
2660
|
AppView,
|
|
2437
2661
|
{
|
|
2438
2662
|
className: "rounded-full",
|
|
2439
2663
|
style: [
|
|
2440
|
-
|
|
2664
|
+
styles8.track,
|
|
2441
2665
|
{
|
|
2442
2666
|
width: config.width,
|
|
2443
2667
|
height: config.height,
|
|
@@ -2446,12 +2670,12 @@ function Switch({
|
|
|
2446
2670
|
},
|
|
2447
2671
|
style
|
|
2448
2672
|
],
|
|
2449
|
-
children: /* @__PURE__ */ (0,
|
|
2673
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2450
2674
|
AppView,
|
|
2451
2675
|
{
|
|
2452
2676
|
className: "rounded-full",
|
|
2453
2677
|
style: [
|
|
2454
|
-
|
|
2678
|
+
styles8.thumb,
|
|
2455
2679
|
{
|
|
2456
2680
|
width: config.thumb,
|
|
2457
2681
|
height: config.thumb,
|
|
@@ -2470,7 +2694,7 @@ function Switch({
|
|
|
2470
2694
|
}
|
|
2471
2695
|
);
|
|
2472
2696
|
}
|
|
2473
|
-
var
|
|
2697
|
+
var styles8 = import_react_native17.StyleSheet.create({
|
|
2474
2698
|
track: {
|
|
2475
2699
|
justifyContent: "center",
|
|
2476
2700
|
padding: 2
|
|
@@ -2485,15 +2709,15 @@ var styles7 = import_react_native15.StyleSheet.create({
|
|
|
2485
2709
|
});
|
|
2486
2710
|
|
|
2487
2711
|
// src/ui/form/Slider.tsx
|
|
2488
|
-
var
|
|
2489
|
-
var
|
|
2712
|
+
var import_react22 = require("react");
|
|
2713
|
+
var import_react_native18 = require("react-native");
|
|
2490
2714
|
|
|
2491
2715
|
// src/ui/form/useFormTheme.ts
|
|
2492
|
-
var
|
|
2716
|
+
var import_react21 = require("react");
|
|
2493
2717
|
function useFormThemeColors() {
|
|
2494
2718
|
const { isDark } = useOptionalTheme();
|
|
2495
2719
|
const colors = useThemeColors();
|
|
2496
|
-
return (0,
|
|
2720
|
+
return (0, import_react21.useMemo)(
|
|
2497
2721
|
() => ({
|
|
2498
2722
|
primary: colors.primary,
|
|
2499
2723
|
primarySurface: colors.primarySurface,
|
|
@@ -2514,7 +2738,7 @@ function useFormThemeColors() {
|
|
|
2514
2738
|
}
|
|
2515
2739
|
|
|
2516
2740
|
// src/ui/form/Slider.tsx
|
|
2517
|
-
var
|
|
2741
|
+
var import_jsx_runtime27 = require("nativewind/jsx-runtime");
|
|
2518
2742
|
function Slider({
|
|
2519
2743
|
value,
|
|
2520
2744
|
defaultValue = 0,
|
|
@@ -2528,13 +2752,13 @@ function Slider({
|
|
|
2528
2752
|
className
|
|
2529
2753
|
}) {
|
|
2530
2754
|
const colors = useFormThemeColors();
|
|
2531
|
-
const [internalValue, setInternalValue] = (0,
|
|
2532
|
-
const [trackWidth, setTrackWidth] = (0,
|
|
2533
|
-
const [isDragging, setIsDragging] = (0,
|
|
2755
|
+
const [internalValue, setInternalValue] = (0, import_react22.useState)(defaultValue);
|
|
2756
|
+
const [trackWidth, setTrackWidth] = (0, import_react22.useState)(0);
|
|
2757
|
+
const [isDragging, setIsDragging] = (0, import_react22.useState)(false);
|
|
2534
2758
|
const currentValue = value !== void 0 ? value : internalValue;
|
|
2535
2759
|
const disabledOpacity = 0.4;
|
|
2536
2760
|
const progress = (currentValue - min) / (max - min) * 100;
|
|
2537
|
-
const getValueFromPosition = (0,
|
|
2761
|
+
const getValueFromPosition = (0, import_react22.useCallback)(
|
|
2538
2762
|
(position) => {
|
|
2539
2763
|
const percentage = Math.max(0, Math.min(1, position / trackWidth));
|
|
2540
2764
|
const rawValue = min + percentage * (max - min);
|
|
@@ -2543,7 +2767,7 @@ function Slider({
|
|
|
2543
2767
|
},
|
|
2544
2768
|
[trackWidth, min, max, step]
|
|
2545
2769
|
);
|
|
2546
|
-
const setValue = (0,
|
|
2770
|
+
const setValue = (0, import_react22.useCallback)(
|
|
2547
2771
|
(newValue) => {
|
|
2548
2772
|
const clampedValue = Math.min(max, Math.max(min, newValue));
|
|
2549
2773
|
if (value === void 0) {
|
|
@@ -2553,8 +2777,8 @@ function Slider({
|
|
|
2553
2777
|
},
|
|
2554
2778
|
[value, min, max, onChange]
|
|
2555
2779
|
);
|
|
2556
|
-
const panResponder = (0,
|
|
2557
|
-
|
|
2780
|
+
const panResponder = (0, import_react22.useRef)(
|
|
2781
|
+
import_react_native18.PanResponder.create({
|
|
2558
2782
|
onStartShouldSetPanResponder: () => !disabled,
|
|
2559
2783
|
onMoveShouldSetPanResponder: () => !disabled,
|
|
2560
2784
|
onPanResponderGrant: () => {
|
|
@@ -2574,7 +2798,7 @@ function Slider({
|
|
|
2574
2798
|
}
|
|
2575
2799
|
})
|
|
2576
2800
|
).current;
|
|
2577
|
-
const handleTrackPress = (0,
|
|
2801
|
+
const handleTrackPress = (0, import_react22.useCallback)(
|
|
2578
2802
|
(event) => {
|
|
2579
2803
|
if (disabled) return;
|
|
2580
2804
|
const { locationX } = event.nativeEvent;
|
|
@@ -2584,16 +2808,16 @@ function Slider({
|
|
|
2584
2808
|
},
|
|
2585
2809
|
[disabled, getValueFromPosition, setValue, onChangeEnd]
|
|
2586
2810
|
);
|
|
2587
|
-
const onLayout = (0,
|
|
2811
|
+
const onLayout = (0, import_react22.useCallback)((event) => {
|
|
2588
2812
|
setTrackWidth(event.nativeEvent.layout.width);
|
|
2589
2813
|
}, []);
|
|
2590
|
-
return /* @__PURE__ */ (0,
|
|
2591
|
-
showTooltip && isDragging && /* @__PURE__ */ (0,
|
|
2814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AppView, { className: cn("py-2", className), children: [
|
|
2815
|
+
showTooltip && isDragging && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2592
2816
|
AppView,
|
|
2593
2817
|
{
|
|
2594
2818
|
className: "absolute rounded px-2 py-1 -top-8",
|
|
2595
2819
|
style: [
|
|
2596
|
-
|
|
2820
|
+
styles9.tooltip,
|
|
2597
2821
|
{
|
|
2598
2822
|
backgroundColor: colors.surfaceMuted,
|
|
2599
2823
|
left: `${progress}%`,
|
|
@@ -2601,12 +2825,12 @@ function Slider({
|
|
|
2601
2825
|
}
|
|
2602
2826
|
],
|
|
2603
2827
|
children: [
|
|
2604
|
-
/* @__PURE__ */ (0,
|
|
2605
|
-
/* @__PURE__ */ (0,
|
|
2828
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AppText, { size: "xs", style: { color: colors.text }, children: Math.round(currentValue) }),
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2606
2830
|
AppView,
|
|
2607
2831
|
{
|
|
2608
2832
|
style: [
|
|
2609
|
-
|
|
2833
|
+
styles9.tooltipArrow,
|
|
2610
2834
|
{
|
|
2611
2835
|
borderTopColor: colors.surfaceMuted
|
|
2612
2836
|
}
|
|
@@ -2616,23 +2840,23 @@ function Slider({
|
|
|
2616
2840
|
]
|
|
2617
2841
|
}
|
|
2618
2842
|
),
|
|
2619
|
-
/* @__PURE__ */ (0,
|
|
2620
|
-
|
|
2843
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2844
|
+
import_react_native18.View,
|
|
2621
2845
|
{
|
|
2622
2846
|
onLayout,
|
|
2623
2847
|
className: "rounded-full",
|
|
2624
2848
|
style: [
|
|
2625
|
-
|
|
2849
|
+
styles9.track,
|
|
2626
2850
|
{ backgroundColor: colors.divider, opacity: disabled ? disabledOpacity : 1 }
|
|
2627
2851
|
],
|
|
2628
2852
|
onTouchEnd: handleTrackPress,
|
|
2629
2853
|
children: [
|
|
2630
|
-
/* @__PURE__ */ (0,
|
|
2854
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2631
2855
|
AppView,
|
|
2632
2856
|
{
|
|
2633
2857
|
className: "rounded-full",
|
|
2634
2858
|
style: [
|
|
2635
|
-
|
|
2859
|
+
styles9.filledTrack,
|
|
2636
2860
|
{
|
|
2637
2861
|
backgroundColor: colors.primary,
|
|
2638
2862
|
width: `${progress}%`
|
|
@@ -2640,12 +2864,12 @@ function Slider({
|
|
|
2640
2864
|
]
|
|
2641
2865
|
}
|
|
2642
2866
|
),
|
|
2643
|
-
/* @__PURE__ */ (0,
|
|
2867
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2644
2868
|
AppView,
|
|
2645
2869
|
{
|
|
2646
2870
|
className: "absolute rounded-full items-center justify-center",
|
|
2647
2871
|
style: [
|
|
2648
|
-
|
|
2872
|
+
styles9.thumb,
|
|
2649
2873
|
{
|
|
2650
2874
|
backgroundColor: colors.textInverse,
|
|
2651
2875
|
left: `${progress}%`,
|
|
@@ -2657,12 +2881,12 @@ function Slider({
|
|
|
2657
2881
|
}
|
|
2658
2882
|
],
|
|
2659
2883
|
...panResponder.panHandlers,
|
|
2660
|
-
children: /* @__PURE__ */ (0,
|
|
2884
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2661
2885
|
AppView,
|
|
2662
2886
|
{
|
|
2663
2887
|
className: "rounded-full",
|
|
2664
2888
|
style: [
|
|
2665
|
-
|
|
2889
|
+
styles9.thumbDot,
|
|
2666
2890
|
{
|
|
2667
2891
|
backgroundColor: colors.primary
|
|
2668
2892
|
}
|
|
@@ -2676,7 +2900,7 @@ function Slider({
|
|
|
2676
2900
|
)
|
|
2677
2901
|
] });
|
|
2678
2902
|
}
|
|
2679
|
-
var
|
|
2903
|
+
var styles9 = import_react_native18.StyleSheet.create({
|
|
2680
2904
|
track: {
|
|
2681
2905
|
height: 6,
|
|
2682
2906
|
width: "100%"
|
|
@@ -2717,9 +2941,9 @@ var styles8 = import_react_native16.StyleSheet.create({
|
|
|
2717
2941
|
});
|
|
2718
2942
|
|
|
2719
2943
|
// src/ui/form/Select.tsx
|
|
2720
|
-
var
|
|
2721
|
-
var
|
|
2722
|
-
var
|
|
2944
|
+
var import_react23 = require("react");
|
|
2945
|
+
var import_react_native19 = require("react-native");
|
|
2946
|
+
var import_jsx_runtime28 = require("nativewind/jsx-runtime");
|
|
2723
2947
|
function Select({
|
|
2724
2948
|
value,
|
|
2725
2949
|
onChange,
|
|
@@ -2733,24 +2957,24 @@ function Select({
|
|
|
2733
2957
|
className
|
|
2734
2958
|
}) {
|
|
2735
2959
|
const colors = useFormThemeColors();
|
|
2736
|
-
const [visible, setVisible] = (0,
|
|
2737
|
-
const [searchKeyword, setSearchKeyword] = (0,
|
|
2738
|
-
const selectedValues = (0,
|
|
2960
|
+
const [visible, setVisible] = (0, import_react23.useState)(false);
|
|
2961
|
+
const [searchKeyword, setSearchKeyword] = (0, import_react23.useState)("");
|
|
2962
|
+
const selectedValues = (0, import_react23.useMemo)(() => {
|
|
2739
2963
|
if (multiple) {
|
|
2740
2964
|
return Array.isArray(value) ? value : [];
|
|
2741
2965
|
}
|
|
2742
2966
|
return value ? [value] : [];
|
|
2743
2967
|
}, [value, multiple]);
|
|
2744
|
-
const displayText = (0,
|
|
2968
|
+
const displayText = (0, import_react23.useMemo)(() => {
|
|
2745
2969
|
if (selectedValues.length === 0) return placeholder;
|
|
2746
2970
|
const selectedLabels = options.filter((opt) => selectedValues.includes(opt.value)).map((opt) => opt.label);
|
|
2747
2971
|
return selectedLabels.join(", ") || placeholder;
|
|
2748
2972
|
}, [selectedValues, options, placeholder]);
|
|
2749
|
-
const filteredOptions = (0,
|
|
2973
|
+
const filteredOptions = (0, import_react23.useMemo)(() => {
|
|
2750
2974
|
if (!searchable || !searchKeyword) return options;
|
|
2751
2975
|
return options.filter((opt) => opt.label.toLowerCase().includes(searchKeyword.toLowerCase()));
|
|
2752
2976
|
}, [options, searchable, searchKeyword]);
|
|
2753
|
-
const handleSelect = (0,
|
|
2977
|
+
const handleSelect = (0, import_react23.useCallback)(
|
|
2754
2978
|
(optionValue) => {
|
|
2755
2979
|
if (multiple) {
|
|
2756
2980
|
const currentValues = Array.isArray(value) ? value : [];
|
|
@@ -2763,24 +2987,24 @@ function Select({
|
|
|
2763
2987
|
},
|
|
2764
2988
|
[multiple, value, onChange]
|
|
2765
2989
|
);
|
|
2766
|
-
const handleClear = (0,
|
|
2990
|
+
const handleClear = (0, import_react23.useCallback)(
|
|
2767
2991
|
(e) => {
|
|
2768
2992
|
e.stopPropagation();
|
|
2769
2993
|
onChange?.(multiple ? [] : "");
|
|
2770
2994
|
},
|
|
2771
2995
|
[multiple, onChange]
|
|
2772
2996
|
);
|
|
2773
|
-
const handleSearch = (0,
|
|
2997
|
+
const handleSearch = (0, import_react23.useCallback)(
|
|
2774
2998
|
(text) => {
|
|
2775
2999
|
setSearchKeyword(text);
|
|
2776
3000
|
onSearch?.(text);
|
|
2777
3001
|
},
|
|
2778
3002
|
[onSearch]
|
|
2779
3003
|
);
|
|
2780
|
-
const renderOption = (0,
|
|
3004
|
+
const renderOption = (0, import_react23.useCallback)(
|
|
2781
3005
|
({ item }) => {
|
|
2782
3006
|
const isSelected = selectedValues.includes(item.value);
|
|
2783
|
-
return /* @__PURE__ */ (0,
|
|
3007
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2784
3008
|
AppPressable,
|
|
2785
3009
|
{
|
|
2786
3010
|
className: cn(
|
|
@@ -2788,22 +3012,22 @@ function Select({
|
|
|
2788
3012
|
isSelected && "bg-primary-50"
|
|
2789
3013
|
),
|
|
2790
3014
|
style: [
|
|
2791
|
-
|
|
3015
|
+
styles10.optionItem,
|
|
2792
3016
|
{ borderBottomColor: colors.divider },
|
|
2793
3017
|
isSelected && { backgroundColor: colors.primarySurface }
|
|
2794
3018
|
],
|
|
2795
3019
|
onPress: () => handleSelect(item.value),
|
|
2796
3020
|
children: [
|
|
2797
|
-
/* @__PURE__ */ (0,
|
|
2798
|
-
isSelected && /* @__PURE__ */ (0,
|
|
3021
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppText, { style: { color: isSelected ? colors.primary : colors.text }, children: item.label }),
|
|
3022
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "check", size: "sm", color: "primary-500" })
|
|
2799
3023
|
]
|
|
2800
3024
|
}
|
|
2801
3025
|
);
|
|
2802
3026
|
},
|
|
2803
3027
|
[selectedValues, handleSelect, colors]
|
|
2804
3028
|
);
|
|
2805
|
-
return /* @__PURE__ */ (0,
|
|
2806
|
-
/* @__PURE__ */ (0,
|
|
3029
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
3030
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2807
3031
|
AppPressable,
|
|
2808
3032
|
{
|
|
2809
3033
|
className: cn(
|
|
@@ -2811,11 +3035,11 @@ function Select({
|
|
|
2811
3035
|
disabled ? "opacity-60" : "",
|
|
2812
3036
|
className
|
|
2813
3037
|
),
|
|
2814
|
-
style: [
|
|
3038
|
+
style: [styles10.trigger, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
2815
3039
|
disabled,
|
|
2816
3040
|
onPress: () => setVisible(true),
|
|
2817
3041
|
children: [
|
|
2818
|
-
/* @__PURE__ */ (0,
|
|
3042
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2819
3043
|
AppText,
|
|
2820
3044
|
{
|
|
2821
3045
|
className: "flex-1",
|
|
@@ -2824,46 +3048,46 @@ function Select({
|
|
|
2824
3048
|
children: displayText
|
|
2825
3049
|
}
|
|
2826
3050
|
),
|
|
2827
|
-
/* @__PURE__ */ (0,
|
|
2828
|
-
clearable && selectedValues.length > 0 && !disabled && /* @__PURE__ */ (0,
|
|
2829
|
-
/* @__PURE__ */ (0,
|
|
3051
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react_native19.View, { className: "flex-row items-center", children: [
|
|
3052
|
+
clearable && selectedValues.length > 0 && !disabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native19.TouchableOpacity, { onPress: handleClear, className: "mr-2 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "close", size: "sm", color: colors.icon }) }),
|
|
3053
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "keyboard-arrow-down", size: "md", color: colors.icon })
|
|
2830
3054
|
] })
|
|
2831
3055
|
]
|
|
2832
3056
|
}
|
|
2833
3057
|
),
|
|
2834
|
-
/* @__PURE__ */ (0,
|
|
2835
|
-
|
|
3058
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3059
|
+
import_react_native19.Modal,
|
|
2836
3060
|
{
|
|
2837
3061
|
visible,
|
|
2838
3062
|
transparent: true,
|
|
2839
3063
|
animationType: "slide",
|
|
2840
3064
|
onRequestClose: () => setVisible(false),
|
|
2841
|
-
children: /* @__PURE__ */ (0,
|
|
3065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppView, { className: "flex-1", style: { backgroundColor: colors.overlay }, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2842
3066
|
AppView,
|
|
2843
3067
|
{
|
|
2844
3068
|
className: "rounded-t-2xl max-h-[70%]",
|
|
2845
3069
|
style: { backgroundColor: colors.surface },
|
|
2846
3070
|
children: [
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
3071
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2848
3072
|
AppView,
|
|
2849
3073
|
{
|
|
2850
3074
|
row: true,
|
|
2851
3075
|
between: true,
|
|
2852
3076
|
items: "center",
|
|
2853
3077
|
className: "px-4 py-3",
|
|
2854
|
-
style: [
|
|
3078
|
+
style: [styles10.header, { borderBottomColor: colors.divider }],
|
|
2855
3079
|
children: [
|
|
2856
|
-
/* @__PURE__ */ (0,
|
|
2857
|
-
/* @__PURE__ */ (0,
|
|
3080
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: multiple ? "\u9009\u62E9\u9009\u9879" : "\u8BF7\u9009\u62E9" }),
|
|
3081
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native19.TouchableOpacity, { onPress: () => setVisible(false), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "close", size: "md", color: colors.icon }) })
|
|
2858
3082
|
]
|
|
2859
3083
|
}
|
|
2860
3084
|
),
|
|
2861
|
-
searchable && /* @__PURE__ */ (0,
|
|
3085
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2862
3086
|
AppView,
|
|
2863
3087
|
{
|
|
2864
3088
|
className: "px-4 py-3",
|
|
2865
|
-
style: [
|
|
2866
|
-
children: /* @__PURE__ */ (0,
|
|
3089
|
+
style: [styles10.searchBox, { borderBottomColor: colors.divider }],
|
|
3090
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2867
3091
|
AppView,
|
|
2868
3092
|
{
|
|
2869
3093
|
row: true,
|
|
@@ -2871,9 +3095,9 @@ function Select({
|
|
|
2871
3095
|
className: "px-3 py-2 rounded-lg",
|
|
2872
3096
|
style: { backgroundColor: colors.surfaceMuted },
|
|
2873
3097
|
children: [
|
|
2874
|
-
/* @__PURE__ */ (0,
|
|
2875
|
-
/* @__PURE__ */ (0,
|
|
2876
|
-
|
|
3098
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native19.View, { style: { marginRight: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "search", size: "sm", color: colors.icon }) }),
|
|
3099
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3100
|
+
import_react_native19.TextInput,
|
|
2877
3101
|
{
|
|
2878
3102
|
className: "flex-1 text-base",
|
|
2879
3103
|
style: { color: colors.text },
|
|
@@ -2884,42 +3108,42 @@ function Select({
|
|
|
2884
3108
|
autoFocus: true
|
|
2885
3109
|
}
|
|
2886
3110
|
),
|
|
2887
|
-
searchKeyword.length > 0 && /* @__PURE__ */ (0,
|
|
3111
|
+
searchKeyword.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native19.TouchableOpacity, { onPress: () => setSearchKeyword(""), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "close", size: "sm", color: colors.icon }) })
|
|
2888
3112
|
]
|
|
2889
3113
|
}
|
|
2890
3114
|
)
|
|
2891
3115
|
}
|
|
2892
3116
|
),
|
|
2893
|
-
/* @__PURE__ */ (0,
|
|
2894
|
-
|
|
3117
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3118
|
+
import_react_native19.FlatList,
|
|
2895
3119
|
{
|
|
2896
3120
|
data: filteredOptions,
|
|
2897
3121
|
keyExtractor: (item) => item.value,
|
|
2898
3122
|
renderItem: renderOption,
|
|
2899
|
-
ListEmptyComponent: /* @__PURE__ */ (0,
|
|
3123
|
+
ListEmptyComponent: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppView, { center: true, className: "py-8", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppText, { style: { color: colors.textMuted }, children: "\u6682\u65E0\u9009\u9879" }) })
|
|
2900
3124
|
}
|
|
2901
3125
|
),
|
|
2902
|
-
multiple && /* @__PURE__ */ (0,
|
|
3126
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2903
3127
|
AppView,
|
|
2904
3128
|
{
|
|
2905
3129
|
row: true,
|
|
2906
3130
|
between: true,
|
|
2907
3131
|
items: "center",
|
|
2908
3132
|
className: "px-4 py-3",
|
|
2909
|
-
style: [
|
|
3133
|
+
style: [styles10.footer, { borderTopColor: colors.divider }],
|
|
2910
3134
|
children: [
|
|
2911
|
-
/* @__PURE__ */ (0,
|
|
3135
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(AppText, { style: { color: colors.textMuted }, children: [
|
|
2912
3136
|
"\u5DF2\u9009\u62E9 ",
|
|
2913
3137
|
selectedValues.length,
|
|
2914
3138
|
" \u9879"
|
|
2915
3139
|
] }),
|
|
2916
|
-
/* @__PURE__ */ (0,
|
|
2917
|
-
|
|
3140
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3141
|
+
import_react_native19.TouchableOpacity,
|
|
2918
3142
|
{
|
|
2919
3143
|
className: "px-4 py-2 rounded-lg",
|
|
2920
3144
|
style: { backgroundColor: colors.primary },
|
|
2921
3145
|
onPress: () => setVisible(false),
|
|
2922
|
-
children: /* @__PURE__ */ (0,
|
|
3146
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppText, { className: "font-medium", style: { color: colors.textInverse }, children: "\u786E\u5B9A" })
|
|
2923
3147
|
}
|
|
2924
3148
|
)
|
|
2925
3149
|
]
|
|
@@ -2932,7 +3156,7 @@ function Select({
|
|
|
2932
3156
|
)
|
|
2933
3157
|
] });
|
|
2934
3158
|
}
|
|
2935
|
-
var
|
|
3159
|
+
var styles10 = import_react_native19.StyleSheet.create({
|
|
2936
3160
|
trigger: {
|
|
2937
3161
|
borderWidth: 0.5
|
|
2938
3162
|
},
|
|
@@ -2951,9 +3175,9 @@ var styles9 = import_react_native17.StyleSheet.create({
|
|
|
2951
3175
|
});
|
|
2952
3176
|
|
|
2953
3177
|
// src/ui/form/DatePicker.tsx
|
|
2954
|
-
var
|
|
2955
|
-
var
|
|
2956
|
-
var
|
|
3178
|
+
var import_react24 = require("react");
|
|
3179
|
+
var import_react_native20 = require("react-native");
|
|
3180
|
+
var import_jsx_runtime29 = require("nativewind/jsx-runtime");
|
|
2957
3181
|
function PickerColumn({
|
|
2958
3182
|
title,
|
|
2959
3183
|
values,
|
|
@@ -2964,27 +3188,27 @@ function PickerColumn({
|
|
|
2964
3188
|
showDivider = false,
|
|
2965
3189
|
colors
|
|
2966
3190
|
}) {
|
|
2967
|
-
return /* @__PURE__ */ (0,
|
|
3191
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2968
3192
|
AppView,
|
|
2969
3193
|
{
|
|
2970
3194
|
flex: true,
|
|
2971
3195
|
style: [
|
|
2972
|
-
showDivider &&
|
|
3196
|
+
showDivider && styles11.column,
|
|
2973
3197
|
showDivider ? { borderRightColor: colors.divider } : void 0
|
|
2974
3198
|
],
|
|
2975
3199
|
children: [
|
|
2976
|
-
/* @__PURE__ */ (0,
|
|
2977
|
-
/* @__PURE__ */ (0,
|
|
3200
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppView, { center: true, className: "py-2", style: { backgroundColor: colors.headerSurface }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { className: "text-sm font-medium", style: { color: colors.textMuted }, children: title }) }),
|
|
3201
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppView, { className: "flex-1", children: values.map((value) => {
|
|
2978
3202
|
const selected = selectedValue === value;
|
|
2979
3203
|
const disabled = isDisabled(value);
|
|
2980
|
-
return /* @__PURE__ */ (0,
|
|
2981
|
-
|
|
3204
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3205
|
+
import_react_native20.TouchableOpacity,
|
|
2982
3206
|
{
|
|
2983
3207
|
className: cn("py-2 items-center", selected && "bg-primary-50"),
|
|
2984
3208
|
style: selected ? { backgroundColor: colors.primarySurface } : void 0,
|
|
2985
3209
|
disabled,
|
|
2986
3210
|
onPress: () => onSelect(value),
|
|
2987
|
-
children: /* @__PURE__ */ (0,
|
|
3211
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2988
3212
|
AppText,
|
|
2989
3213
|
{
|
|
2990
3214
|
className: cn(selected ? "font-semibold" : void 0, disabled && "opacity-30"),
|
|
@@ -3013,16 +3237,16 @@ function DatePicker({
|
|
|
3013
3237
|
className
|
|
3014
3238
|
}) {
|
|
3015
3239
|
const colors = useFormThemeColors();
|
|
3016
|
-
const [visible, setVisible] = (0,
|
|
3017
|
-
const [tempDate, setTempDate] = (0,
|
|
3018
|
-
const displayText = (0,
|
|
3240
|
+
const [visible, setVisible] = (0, import_react24.useState)(false);
|
|
3241
|
+
const [tempDate, setTempDate] = (0, import_react24.useState)(value || /* @__PURE__ */ new Date());
|
|
3242
|
+
const displayText = (0, import_react24.useMemo)(() => {
|
|
3019
3243
|
return value ? formatDate(value, format) : placeholder;
|
|
3020
3244
|
}, [value, format, placeholder]);
|
|
3021
|
-
const handleConfirm = (0,
|
|
3245
|
+
const handleConfirm = (0, import_react24.useCallback)(() => {
|
|
3022
3246
|
onChange?.(tempDate);
|
|
3023
3247
|
setVisible(false);
|
|
3024
3248
|
}, [tempDate, onChange]);
|
|
3025
|
-
const years = (0,
|
|
3249
|
+
const years = (0, import_react24.useMemo)(() => {
|
|
3026
3250
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
3027
3251
|
const arr = [];
|
|
3028
3252
|
for (let i = currentYear - 50; i <= currentYear + 50; i++) {
|
|
@@ -3030,16 +3254,16 @@ function DatePicker({
|
|
|
3030
3254
|
}
|
|
3031
3255
|
return arr;
|
|
3032
3256
|
}, []);
|
|
3033
|
-
const months = (0,
|
|
3257
|
+
const months = (0, import_react24.useMemo)(() => {
|
|
3034
3258
|
return Array.from({ length: 12 }, (_, i) => i + 1);
|
|
3035
3259
|
}, []);
|
|
3036
|
-
const days = (0,
|
|
3260
|
+
const days = (0, import_react24.useMemo)(() => {
|
|
3037
3261
|
const year = tempDate.getFullYear();
|
|
3038
3262
|
const month = tempDate.getMonth();
|
|
3039
3263
|
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
3040
3264
|
return Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
|
3041
3265
|
}, [tempDate]);
|
|
3042
|
-
const isDateDisabled = (0,
|
|
3266
|
+
const isDateDisabled = (0, import_react24.useCallback)(
|
|
3043
3267
|
(year, month, day) => {
|
|
3044
3268
|
const date = new Date(year, month - 1, day);
|
|
3045
3269
|
if (minDate && date < minDate) return true;
|
|
@@ -3048,7 +3272,7 @@ function DatePicker({
|
|
|
3048
3272
|
},
|
|
3049
3273
|
[minDate, maxDate]
|
|
3050
3274
|
);
|
|
3051
|
-
const updateTempDate = (0,
|
|
3275
|
+
const updateTempDate = (0, import_react24.useCallback)(
|
|
3052
3276
|
(year, month, day) => {
|
|
3053
3277
|
const newDate = new Date(tempDate);
|
|
3054
3278
|
if (year !== void 0) newDate.setFullYear(year);
|
|
@@ -3058,8 +3282,8 @@ function DatePicker({
|
|
|
3058
3282
|
},
|
|
3059
3283
|
[tempDate]
|
|
3060
3284
|
);
|
|
3061
|
-
return /* @__PURE__ */ (0,
|
|
3062
|
-
/* @__PURE__ */ (0,
|
|
3285
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
3286
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3063
3287
|
AppPressable,
|
|
3064
3288
|
{
|
|
3065
3289
|
className: cn(
|
|
@@ -3067,14 +3291,14 @@ function DatePicker({
|
|
|
3067
3291
|
disabled ? "opacity-60" : "",
|
|
3068
3292
|
className
|
|
3069
3293
|
),
|
|
3070
|
-
style: [
|
|
3294
|
+
style: [styles11.trigger, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
3071
3295
|
disabled,
|
|
3072
3296
|
onPress: () => {
|
|
3073
3297
|
setTempDate(value || /* @__PURE__ */ new Date());
|
|
3074
3298
|
setVisible(true);
|
|
3075
3299
|
},
|
|
3076
3300
|
children: [
|
|
3077
|
-
/* @__PURE__ */ (0,
|
|
3301
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3078
3302
|
AppText,
|
|
3079
3303
|
{
|
|
3080
3304
|
className: "flex-1",
|
|
@@ -3083,36 +3307,36 @@ function DatePicker({
|
|
|
3083
3307
|
children: displayText
|
|
3084
3308
|
}
|
|
3085
3309
|
),
|
|
3086
|
-
/* @__PURE__ */ (0,
|
|
3310
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "calendar-today", size: "md", color: colors.icon })
|
|
3087
3311
|
]
|
|
3088
3312
|
}
|
|
3089
3313
|
),
|
|
3090
|
-
/* @__PURE__ */ (0,
|
|
3091
|
-
|
|
3314
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3315
|
+
import_react_native20.Modal,
|
|
3092
3316
|
{
|
|
3093
3317
|
visible,
|
|
3094
3318
|
transparent: true,
|
|
3095
3319
|
animationType: "slide",
|
|
3096
3320
|
onRequestClose: () => setVisible(false),
|
|
3097
|
-
children: /* @__PURE__ */ (0,
|
|
3098
|
-
/* @__PURE__ */ (0,
|
|
3321
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppView, { className: "flex-1", style: { backgroundColor: colors.overlay }, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(AppView, { className: "rounded-t-2xl", style: { backgroundColor: colors.surface }, children: [
|
|
3322
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3099
3323
|
AppView,
|
|
3100
3324
|
{
|
|
3101
3325
|
row: true,
|
|
3102
3326
|
between: true,
|
|
3103
3327
|
items: "center",
|
|
3104
3328
|
className: "px-4 py-3",
|
|
3105
|
-
style: [
|
|
3329
|
+
style: [styles11.header, { borderBottomColor: colors.divider }],
|
|
3106
3330
|
children: [
|
|
3107
|
-
/* @__PURE__ */ (0,
|
|
3108
|
-
/* @__PURE__ */ (0,
|
|
3109
|
-
/* @__PURE__ */ (0,
|
|
3331
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native20.TouchableOpacity, { onPress: () => setVisible(false), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.textMuted }, children: "\u53D6\u6D88" }) }),
|
|
3332
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: "\u9009\u62E9\u65E5\u671F" }),
|
|
3333
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native20.TouchableOpacity, { onPress: handleConfirm, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.primary }, className: "font-medium", children: "\u786E\u5B9A" }) })
|
|
3110
3334
|
]
|
|
3111
3335
|
}
|
|
3112
3336
|
),
|
|
3113
|
-
/* @__PURE__ */ (0,
|
|
3114
|
-
/* @__PURE__ */ (0,
|
|
3115
|
-
/* @__PURE__ */ (0,
|
|
3337
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppView, { center: true, className: "py-4", style: { backgroundColor: colors.headerSurface }, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { className: "text-2xl font-semibold", style: { color: colors.text }, children: formatDate(tempDate, "yyyy\u5E74MM\u6708dd\u65E5") }) }),
|
|
3338
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(AppView, { row: true, className: "h-48", children: [
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3116
3340
|
PickerColumn,
|
|
3117
3341
|
{
|
|
3118
3342
|
title: "\u5E74",
|
|
@@ -3124,7 +3348,7 @@ function DatePicker({
|
|
|
3124
3348
|
showDivider: true
|
|
3125
3349
|
}
|
|
3126
3350
|
),
|
|
3127
|
-
/* @__PURE__ */ (0,
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3128
3352
|
PickerColumn,
|
|
3129
3353
|
{
|
|
3130
3354
|
title: "\u6708",
|
|
@@ -3137,7 +3361,7 @@ function DatePicker({
|
|
|
3137
3361
|
showDivider: true
|
|
3138
3362
|
}
|
|
3139
3363
|
),
|
|
3140
|
-
/* @__PURE__ */ (0,
|
|
3364
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3141
3365
|
PickerColumn,
|
|
3142
3366
|
{
|
|
3143
3367
|
title: "\u65E5",
|
|
@@ -3149,38 +3373,38 @@ function DatePicker({
|
|
|
3149
3373
|
}
|
|
3150
3374
|
)
|
|
3151
3375
|
] }),
|
|
3152
|
-
/* @__PURE__ */ (0,
|
|
3376
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3153
3377
|
AppView,
|
|
3154
3378
|
{
|
|
3155
3379
|
row: true,
|
|
3156
3380
|
className: "px-4 py-3 gap-2",
|
|
3157
|
-
style: [
|
|
3381
|
+
style: [styles11.footer, { borderTopColor: colors.divider }],
|
|
3158
3382
|
children: [
|
|
3159
|
-
/* @__PURE__ */ (0,
|
|
3160
|
-
|
|
3383
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3384
|
+
import_react_native20.TouchableOpacity,
|
|
3161
3385
|
{
|
|
3162
3386
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3163
3387
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3164
3388
|
onPress: () => setTempDate(/* @__PURE__ */ new Date()),
|
|
3165
|
-
children: /* @__PURE__ */ (0,
|
|
3389
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.text }, children: "\u4ECA\u5929" })
|
|
3166
3390
|
}
|
|
3167
3391
|
),
|
|
3168
|
-
minDate && /* @__PURE__ */ (0,
|
|
3169
|
-
|
|
3392
|
+
minDate && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3393
|
+
import_react_native20.TouchableOpacity,
|
|
3170
3394
|
{
|
|
3171
3395
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3172
3396
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3173
3397
|
onPress: () => setTempDate(minDate),
|
|
3174
|
-
children: /* @__PURE__ */ (0,
|
|
3398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.text }, children: "\u6700\u65E9" })
|
|
3175
3399
|
}
|
|
3176
3400
|
),
|
|
3177
|
-
maxDate && /* @__PURE__ */ (0,
|
|
3178
|
-
|
|
3401
|
+
maxDate && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3402
|
+
import_react_native20.TouchableOpacity,
|
|
3179
3403
|
{
|
|
3180
3404
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3181
3405
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3182
3406
|
onPress: () => setTempDate(maxDate),
|
|
3183
|
-
children: /* @__PURE__ */ (0,
|
|
3407
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.text }, children: "\u6700\u665A" })
|
|
3184
3408
|
}
|
|
3185
3409
|
)
|
|
3186
3410
|
]
|
|
@@ -3191,7 +3415,7 @@ function DatePicker({
|
|
|
3191
3415
|
)
|
|
3192
3416
|
] });
|
|
3193
3417
|
}
|
|
3194
|
-
var
|
|
3418
|
+
var styles11 = import_react_native20.StyleSheet.create({
|
|
3195
3419
|
trigger: {
|
|
3196
3420
|
borderWidth: 0.5
|
|
3197
3421
|
},
|
|
@@ -3207,7 +3431,7 @@ var styles10 = import_react_native18.StyleSheet.create({
|
|
|
3207
3431
|
});
|
|
3208
3432
|
|
|
3209
3433
|
// src/ui/form/FormItem.tsx
|
|
3210
|
-
var
|
|
3434
|
+
var import_jsx_runtime30 = require("nativewind/jsx-runtime");
|
|
3211
3435
|
function FormItem({
|
|
3212
3436
|
name: _name,
|
|
3213
3437
|
label,
|
|
@@ -3219,19 +3443,19 @@ function FormItem({
|
|
|
3219
3443
|
labelClassName
|
|
3220
3444
|
}) {
|
|
3221
3445
|
const colors = useThemeColors();
|
|
3222
|
-
return /* @__PURE__ */ (0,
|
|
3223
|
-
label && /* @__PURE__ */ (0,
|
|
3224
|
-
/* @__PURE__ */ (0,
|
|
3225
|
-
required && /* @__PURE__ */ (0,
|
|
3446
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AppView, { className: cn("mb-4", className), children: [
|
|
3447
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AppView, { row: true, items: "center", gap: 1, className: cn("mb-2", labelClassName), children: [
|
|
3448
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { size: "sm", weight: "medium", style: { color: colors.textSecondary }, children: label }),
|
|
3449
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { color: "error-500", children: "*" })
|
|
3226
3450
|
] }),
|
|
3227
3451
|
children,
|
|
3228
|
-
error && /* @__PURE__ */ (0,
|
|
3229
|
-
help && !error && /* @__PURE__ */ (0,
|
|
3452
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { size: "sm", color: "error-500", className: "mt-1", children: error }),
|
|
3453
|
+
help && !error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { size: "sm", className: "mt-1", style: { color: colors.textMuted }, children: help })
|
|
3230
3454
|
] });
|
|
3231
3455
|
}
|
|
3232
3456
|
|
|
3233
3457
|
// src/ui/form/useForm.ts
|
|
3234
|
-
var
|
|
3458
|
+
var import_react25 = require("react");
|
|
3235
3459
|
var getIssuePath = (issue) => issue.path.map(String).join(".");
|
|
3236
3460
|
var getFieldError = (issues, name) => {
|
|
3237
3461
|
const exactIssue = issues.find((issue) => getIssuePath(issue) === name);
|
|
@@ -3247,16 +3471,16 @@ var buildFormErrors = (issues) => {
|
|
|
3247
3471
|
}, {});
|
|
3248
3472
|
};
|
|
3249
3473
|
function useForm({ schema, defaultValues }) {
|
|
3250
|
-
const [values, setValues] = (0,
|
|
3251
|
-
const [errors, setErrors] = (0,
|
|
3252
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
3253
|
-
const isDirty = (0,
|
|
3474
|
+
const [values, setValues] = (0, import_react25.useState)(defaultValues);
|
|
3475
|
+
const [errors, setErrors] = (0, import_react25.useState)({});
|
|
3476
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react25.useState)(false);
|
|
3477
|
+
const isDirty = (0, import_react25.useMemo)(() => {
|
|
3254
3478
|
return JSON.stringify(values) !== JSON.stringify(defaultValues);
|
|
3255
3479
|
}, [values, defaultValues]);
|
|
3256
|
-
const isValid = (0,
|
|
3480
|
+
const isValid = (0, import_react25.useMemo)(() => {
|
|
3257
3481
|
return Object.keys(errors).length === 0;
|
|
3258
3482
|
}, [errors]);
|
|
3259
|
-
const clearFieldError = (0,
|
|
3483
|
+
const clearFieldError = (0, import_react25.useCallback)((name) => {
|
|
3260
3484
|
setErrors((prev) => {
|
|
3261
3485
|
if (!(name in prev)) return prev;
|
|
3262
3486
|
const next = { ...prev };
|
|
@@ -3264,20 +3488,20 @@ function useForm({ schema, defaultValues }) {
|
|
|
3264
3488
|
return next;
|
|
3265
3489
|
});
|
|
3266
3490
|
}, []);
|
|
3267
|
-
const setValue = (0,
|
|
3491
|
+
const setValue = (0, import_react25.useCallback)(
|
|
3268
3492
|
(name, value) => {
|
|
3269
3493
|
setValues((prev) => ({ ...prev, [name]: value }));
|
|
3270
3494
|
clearFieldError(name);
|
|
3271
3495
|
},
|
|
3272
3496
|
[clearFieldError]
|
|
3273
3497
|
);
|
|
3274
|
-
const getValue = (0,
|
|
3498
|
+
const getValue = (0, import_react25.useCallback)(
|
|
3275
3499
|
(name) => {
|
|
3276
3500
|
return values[name];
|
|
3277
3501
|
},
|
|
3278
3502
|
[values]
|
|
3279
3503
|
);
|
|
3280
|
-
const validateField = (0,
|
|
3504
|
+
const validateField = (0, import_react25.useCallback)(
|
|
3281
3505
|
async (name) => {
|
|
3282
3506
|
const fieldName = name;
|
|
3283
3507
|
const result = await schema.safeParseAsync(values);
|
|
@@ -3298,7 +3522,7 @@ function useForm({ schema, defaultValues }) {
|
|
|
3298
3522
|
},
|
|
3299
3523
|
[schema, values, clearFieldError]
|
|
3300
3524
|
);
|
|
3301
|
-
const validate = (0,
|
|
3525
|
+
const validate = (0, import_react25.useCallback)(async () => {
|
|
3302
3526
|
const result = await schema.safeParseAsync(values);
|
|
3303
3527
|
if (result.success) {
|
|
3304
3528
|
setErrors({});
|
|
@@ -3307,12 +3531,12 @@ function useForm({ schema, defaultValues }) {
|
|
|
3307
3531
|
setErrors(buildFormErrors(result.error.issues));
|
|
3308
3532
|
return false;
|
|
3309
3533
|
}, [schema, values]);
|
|
3310
|
-
const reset = (0,
|
|
3534
|
+
const reset = (0, import_react25.useCallback)(() => {
|
|
3311
3535
|
setValues(defaultValues);
|
|
3312
3536
|
setErrors({});
|
|
3313
3537
|
setIsSubmitting(false);
|
|
3314
3538
|
}, [defaultValues]);
|
|
3315
|
-
const handleSubmit = (0,
|
|
3539
|
+
const handleSubmit = (0, import_react25.useCallback)(
|
|
3316
3540
|
async (onSubmit) => {
|
|
3317
3541
|
const valid = await validate();
|
|
3318
3542
|
if (!valid) return;
|
|
@@ -3341,29 +3565,54 @@ function useForm({ schema, defaultValues }) {
|
|
|
3341
3565
|
}
|
|
3342
3566
|
|
|
3343
3567
|
// src/ui/hooks/useToggle.ts
|
|
3344
|
-
var
|
|
3568
|
+
var import_react26 = require("react");
|
|
3345
3569
|
function useToggle(defaultValue = false) {
|
|
3346
|
-
const [value, setValue] = (0,
|
|
3347
|
-
const toggle = (0,
|
|
3570
|
+
const [value, setValue] = (0, import_react26.useState)(defaultValue);
|
|
3571
|
+
const toggle = (0, import_react26.useCallback)(() => {
|
|
3348
3572
|
setValue((v) => !v);
|
|
3349
3573
|
}, []);
|
|
3350
|
-
const set = (0,
|
|
3574
|
+
const set = (0, import_react26.useCallback)((newValue) => {
|
|
3351
3575
|
setValue(newValue);
|
|
3352
3576
|
}, []);
|
|
3353
|
-
const setTrue = (0,
|
|
3577
|
+
const setTrue = (0, import_react26.useCallback)(() => {
|
|
3354
3578
|
setValue(true);
|
|
3355
3579
|
}, []);
|
|
3356
|
-
const setFalse = (0,
|
|
3580
|
+
const setFalse = (0, import_react26.useCallback)(() => {
|
|
3357
3581
|
setValue(false);
|
|
3358
3582
|
}, []);
|
|
3359
3583
|
return [value, { toggle, set, setTrue, setFalse }];
|
|
3360
3584
|
}
|
|
3361
3585
|
|
|
3586
|
+
// src/ui/hooks/usePageDrawer.ts
|
|
3587
|
+
var import_react27 = require("react");
|
|
3588
|
+
function usePageDrawer(defaultVisible = false) {
|
|
3589
|
+
const [visible, setVisibleState] = (0, import_react27.useState)(defaultVisible);
|
|
3590
|
+
const open = (0, import_react27.useCallback)(() => {
|
|
3591
|
+
setVisibleState(true);
|
|
3592
|
+
}, []);
|
|
3593
|
+
const close = (0, import_react27.useCallback)(() => {
|
|
3594
|
+
setVisibleState(false);
|
|
3595
|
+
}, []);
|
|
3596
|
+
const toggle = (0, import_react27.useCallback)(() => {
|
|
3597
|
+
setVisibleState((current) => !current);
|
|
3598
|
+
}, []);
|
|
3599
|
+
const setVisible = (0, import_react27.useCallback)((nextVisible) => {
|
|
3600
|
+
setVisibleState(nextVisible);
|
|
3601
|
+
}, []);
|
|
3602
|
+
return {
|
|
3603
|
+
visible,
|
|
3604
|
+
open,
|
|
3605
|
+
close,
|
|
3606
|
+
toggle,
|
|
3607
|
+
setVisible
|
|
3608
|
+
};
|
|
3609
|
+
}
|
|
3610
|
+
|
|
3362
3611
|
// src/ui/hooks/useDebounce.ts
|
|
3363
|
-
var
|
|
3612
|
+
var import_react28 = require("react");
|
|
3364
3613
|
function useDebounce(value, delay = 500) {
|
|
3365
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
3366
|
-
(0,
|
|
3614
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react28.useState)(value);
|
|
3615
|
+
(0, import_react28.useEffect)(() => {
|
|
3367
3616
|
const timer = setTimeout(() => {
|
|
3368
3617
|
setDebouncedValue(value);
|
|
3369
3618
|
}, delay);
|
|
@@ -3375,11 +3624,11 @@ function useDebounce(value, delay = 500) {
|
|
|
3375
3624
|
}
|
|
3376
3625
|
|
|
3377
3626
|
// src/ui/hooks/useThrottle.ts
|
|
3378
|
-
var
|
|
3627
|
+
var import_react29 = require("react");
|
|
3379
3628
|
function useThrottle(value, delay = 200) {
|
|
3380
|
-
const [throttledValue, setThrottledValue] = (0,
|
|
3381
|
-
const lastUpdatedRef = (0,
|
|
3382
|
-
(0,
|
|
3629
|
+
const [throttledValue, setThrottledValue] = (0, import_react29.useState)(value);
|
|
3630
|
+
const lastUpdatedRef = (0, import_react29.useRef)(Date.now());
|
|
3631
|
+
(0, import_react29.useEffect)(() => {
|
|
3383
3632
|
const now = Date.now();
|
|
3384
3633
|
const timeElapsed = now - lastUpdatedRef.current;
|
|
3385
3634
|
if (timeElapsed >= delay) {
|
|
@@ -3400,12 +3649,12 @@ function useThrottle(value, delay = 200) {
|
|
|
3400
3649
|
}
|
|
3401
3650
|
|
|
3402
3651
|
// src/ui/hooks/useKeyboard.ts
|
|
3403
|
-
var
|
|
3404
|
-
var
|
|
3652
|
+
var import_react30 = require("react");
|
|
3653
|
+
var import_react_native21 = require("react-native");
|
|
3405
3654
|
function useKeyboard() {
|
|
3406
|
-
const [visible, setVisible] = (0,
|
|
3407
|
-
const [height, setHeight] = (0,
|
|
3408
|
-
(0,
|
|
3655
|
+
const [visible, setVisible] = (0, import_react30.useState)(false);
|
|
3656
|
+
const [height, setHeight] = (0, import_react30.useState)(0);
|
|
3657
|
+
(0, import_react30.useEffect)(() => {
|
|
3409
3658
|
const handleKeyboardWillShow = (event) => {
|
|
3410
3659
|
setVisible(true);
|
|
3411
3660
|
setHeight(event.endCoordinates.height);
|
|
@@ -3422,31 +3671,31 @@ function useKeyboard() {
|
|
|
3422
3671
|
setVisible(false);
|
|
3423
3672
|
setHeight(0);
|
|
3424
3673
|
};
|
|
3425
|
-
const willShowSub =
|
|
3426
|
-
|
|
3427
|
-
|
|
3674
|
+
const willShowSub = import_react_native21.Keyboard.addListener(
|
|
3675
|
+
import_react_native21.Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow",
|
|
3676
|
+
import_react_native21.Platform.OS === "ios" ? handleKeyboardWillShow : handleKeyboardDidShow
|
|
3428
3677
|
);
|
|
3429
|
-
const willHideSub =
|
|
3430
|
-
|
|
3431
|
-
|
|
3678
|
+
const willHideSub = import_react_native21.Keyboard.addListener(
|
|
3679
|
+
import_react_native21.Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide",
|
|
3680
|
+
import_react_native21.Platform.OS === "ios" ? handleKeyboardWillHide : handleKeyboardDidHide
|
|
3432
3681
|
);
|
|
3433
3682
|
return () => {
|
|
3434
3683
|
willShowSub.remove();
|
|
3435
3684
|
willHideSub.remove();
|
|
3436
3685
|
};
|
|
3437
3686
|
}, []);
|
|
3438
|
-
const dismiss = (0,
|
|
3439
|
-
|
|
3687
|
+
const dismiss = (0, import_react30.useCallback)(() => {
|
|
3688
|
+
import_react_native21.Keyboard.dismiss();
|
|
3440
3689
|
}, []);
|
|
3441
3690
|
return { visible, height, dismiss };
|
|
3442
3691
|
}
|
|
3443
3692
|
|
|
3444
3693
|
// src/ui/hooks/useDimensions.ts
|
|
3445
|
-
var
|
|
3446
|
-
var
|
|
3694
|
+
var import_react31 = require("react");
|
|
3695
|
+
var import_react_native22 = require("react-native");
|
|
3447
3696
|
function useDimensions() {
|
|
3448
|
-
const [dimensions, setDimensions] = (0,
|
|
3449
|
-
const window =
|
|
3697
|
+
const [dimensions, setDimensions] = (0, import_react31.useState)(() => {
|
|
3698
|
+
const window = import_react_native22.Dimensions.get("window");
|
|
3450
3699
|
return {
|
|
3451
3700
|
width: window.width,
|
|
3452
3701
|
height: window.height,
|
|
@@ -3454,7 +3703,7 @@ function useDimensions() {
|
|
|
3454
3703
|
fontScale: window.fontScale
|
|
3455
3704
|
};
|
|
3456
3705
|
});
|
|
3457
|
-
(0,
|
|
3706
|
+
(0, import_react31.useEffect)(() => {
|
|
3458
3707
|
const handleChange = ({ window }) => {
|
|
3459
3708
|
setDimensions({
|
|
3460
3709
|
width: window.width,
|
|
@@ -3463,7 +3712,7 @@ function useDimensions() {
|
|
|
3463
3712
|
fontScale: window.fontScale
|
|
3464
3713
|
});
|
|
3465
3714
|
};
|
|
3466
|
-
const subscription =
|
|
3715
|
+
const subscription = import_react_native22.Dimensions.addEventListener("change", handleChange);
|
|
3467
3716
|
return () => {
|
|
3468
3717
|
subscription.remove();
|
|
3469
3718
|
};
|
|
@@ -3472,20 +3721,20 @@ function useDimensions() {
|
|
|
3472
3721
|
}
|
|
3473
3722
|
|
|
3474
3723
|
// src/ui/hooks/useOrientation.ts
|
|
3475
|
-
var
|
|
3476
|
-
var
|
|
3724
|
+
var import_react32 = require("react");
|
|
3725
|
+
var import_react_native23 = require("react-native");
|
|
3477
3726
|
function useOrientation() {
|
|
3478
3727
|
const getOrientation = () => {
|
|
3479
|
-
const { width, height } =
|
|
3728
|
+
const { width, height } = import_react_native23.Dimensions.get("window");
|
|
3480
3729
|
return width > height ? "landscape" : "portrait";
|
|
3481
3730
|
};
|
|
3482
|
-
const [orientation, setOrientation] = (0,
|
|
3483
|
-
(0,
|
|
3731
|
+
const [orientation, setOrientation] = (0, import_react32.useState)(getOrientation);
|
|
3732
|
+
(0, import_react32.useEffect)(() => {
|
|
3484
3733
|
const handleChange = ({ window }) => {
|
|
3485
3734
|
const newOrientation = window.width > window.height ? "landscape" : "portrait";
|
|
3486
3735
|
setOrientation(newOrientation);
|
|
3487
3736
|
};
|
|
3488
|
-
const subscription =
|
|
3737
|
+
const subscription = import_react_native23.Dimensions.addEventListener("change", handleChange);
|
|
3489
3738
|
return () => {
|
|
3490
3739
|
subscription.remove();
|
|
3491
3740
|
};
|
|
@@ -3498,7 +3747,7 @@ function useOrientation() {
|
|
|
3498
3747
|
}
|
|
3499
3748
|
|
|
3500
3749
|
// src/navigation/provider.tsx
|
|
3501
|
-
var
|
|
3750
|
+
var import_react33 = __toESM(require("react"));
|
|
3502
3751
|
var import_native = require("@react-navigation/native");
|
|
3503
3752
|
|
|
3504
3753
|
// src/navigation/utils/navigation-theme.ts
|
|
@@ -3524,7 +3773,7 @@ function createNavigationTheme(pantherTheme, isDark) {
|
|
|
3524
3773
|
}
|
|
3525
3774
|
|
|
3526
3775
|
// src/navigation/provider.tsx
|
|
3527
|
-
var
|
|
3776
|
+
var import_jsx_runtime31 = require("nativewind/jsx-runtime");
|
|
3528
3777
|
function NavigationProvider({
|
|
3529
3778
|
children,
|
|
3530
3779
|
linking,
|
|
@@ -3535,11 +3784,11 @@ function NavigationProvider({
|
|
|
3535
3784
|
theme: customTheme
|
|
3536
3785
|
}) {
|
|
3537
3786
|
const { theme, isDark } = useTheme();
|
|
3538
|
-
const navigationTheme =
|
|
3787
|
+
const navigationTheme = import_react33.default.useMemo(
|
|
3539
3788
|
() => customTheme || createNavigationTheme(theme, isDark),
|
|
3540
3789
|
[customTheme, theme, isDark]
|
|
3541
3790
|
);
|
|
3542
|
-
return /* @__PURE__ */ (0,
|
|
3791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3543
3792
|
import_native.NavigationContainer,
|
|
3544
3793
|
{
|
|
3545
3794
|
theme: navigationTheme,
|
|
@@ -3557,14 +3806,14 @@ function NavigationProvider({
|
|
|
3557
3806
|
var import_stack = require("@react-navigation/stack");
|
|
3558
3807
|
|
|
3559
3808
|
// src/navigation/navigators/StackNavigator.tsx
|
|
3560
|
-
var
|
|
3809
|
+
var import_jsx_runtime32 = require("nativewind/jsx-runtime");
|
|
3561
3810
|
var NativeStack = (0, import_stack.createStackNavigator)();
|
|
3562
3811
|
var defaultScreenOptions = {
|
|
3563
3812
|
headerShown: false,
|
|
3564
3813
|
...import_stack.TransitionPresets.SlideFromRightIOS
|
|
3565
3814
|
};
|
|
3566
3815
|
function StackNavigator({ initialRouteName, screenOptions, children }) {
|
|
3567
|
-
return /* @__PURE__ */ (0,
|
|
3816
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3568
3817
|
NativeStack.Navigator,
|
|
3569
3818
|
{
|
|
3570
3819
|
initialRouteName,
|
|
@@ -3576,7 +3825,7 @@ function StackNavigator({ initialRouteName, screenOptions, children }) {
|
|
|
3576
3825
|
StackNavigator.Screen = NativeStack.Screen;
|
|
3577
3826
|
StackNavigator.Group = NativeStack.Group;
|
|
3578
3827
|
function createStackScreens(routes) {
|
|
3579
|
-
return routes.map((route) => /* @__PURE__ */ (0,
|
|
3828
|
+
return routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3580
3829
|
StackNavigator.Screen,
|
|
3581
3830
|
{
|
|
3582
3831
|
name: route.name,
|
|
@@ -3589,13 +3838,13 @@ function createStackScreens(routes) {
|
|
|
3589
3838
|
}
|
|
3590
3839
|
|
|
3591
3840
|
// src/navigation/navigators/TabNavigator.tsx
|
|
3592
|
-
var
|
|
3841
|
+
var import_react34 = __toESM(require("react"));
|
|
3593
3842
|
var import_bottom_tabs = require("@react-navigation/bottom-tabs");
|
|
3594
3843
|
|
|
3595
3844
|
// src/navigation/components/BottomTabBar.tsx
|
|
3596
|
-
var
|
|
3845
|
+
var import_react_native24 = require("react-native");
|
|
3597
3846
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
3598
|
-
var
|
|
3847
|
+
var import_jsx_runtime33 = require("nativewind/jsx-runtime");
|
|
3599
3848
|
var DEFAULT_TAB_BAR_HEIGHT = 65;
|
|
3600
3849
|
function BottomTabBar({
|
|
3601
3850
|
state,
|
|
@@ -3617,11 +3866,11 @@ function BottomTabBar({
|
|
|
3617
3866
|
const inactiveColor = inactiveTintColor || colors.textMuted;
|
|
3618
3867
|
const backgroundColor = style?.backgroundColor || colors.card;
|
|
3619
3868
|
const borderTopColor = colors.divider;
|
|
3620
|
-
return /* @__PURE__ */ (0,
|
|
3621
|
-
|
|
3869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3870
|
+
import_react_native24.View,
|
|
3622
3871
|
{
|
|
3623
3872
|
style: [
|
|
3624
|
-
|
|
3873
|
+
styles12.container,
|
|
3625
3874
|
{ borderTopColor },
|
|
3626
3875
|
{ backgroundColor, height: height + insets.bottom, paddingBottom: insets.bottom },
|
|
3627
3876
|
style
|
|
@@ -3652,8 +3901,8 @@ function BottomTabBar({
|
|
|
3652
3901
|
size: 24
|
|
3653
3902
|
}) : null;
|
|
3654
3903
|
const badge = options.tabBarBadge;
|
|
3655
|
-
return /* @__PURE__ */ (0,
|
|
3656
|
-
|
|
3904
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3905
|
+
import_react_native24.TouchableOpacity,
|
|
3657
3906
|
{
|
|
3658
3907
|
accessibilityRole: "button",
|
|
3659
3908
|
accessibilityState: isFocused ? { selected: true } : {},
|
|
@@ -3662,21 +3911,21 @@ function BottomTabBar({
|
|
|
3662
3911
|
onPress,
|
|
3663
3912
|
onLongPress,
|
|
3664
3913
|
style: [
|
|
3665
|
-
|
|
3914
|
+
styles12.tab,
|
|
3666
3915
|
{
|
|
3667
3916
|
backgroundColor: isFocused ? activeBackgroundColor : inactiveBackgroundColor
|
|
3668
3917
|
}
|
|
3669
3918
|
],
|
|
3670
3919
|
children: [
|
|
3671
|
-
/* @__PURE__ */ (0,
|
|
3920
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_native24.View, { style: [styles12.iconContainer, iconStyle], children: [
|
|
3672
3921
|
iconName,
|
|
3673
|
-
badge != null && /* @__PURE__ */ (0,
|
|
3922
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native24.View, { style: [styles12.badge, { backgroundColor: activeColor }], children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(AppText, { style: styles12.badgeText, children: typeof badge === "number" && badge > 99 ? "99+" : badge }) })
|
|
3674
3923
|
] }),
|
|
3675
|
-
showLabel && /* @__PURE__ */ (0,
|
|
3924
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3676
3925
|
AppText,
|
|
3677
3926
|
{
|
|
3678
3927
|
style: [
|
|
3679
|
-
|
|
3928
|
+
styles12.label,
|
|
3680
3929
|
{ color: isFocused ? activeColor : inactiveColor },
|
|
3681
3930
|
labelStyle
|
|
3682
3931
|
],
|
|
@@ -3692,7 +3941,7 @@ function BottomTabBar({
|
|
|
3692
3941
|
}
|
|
3693
3942
|
);
|
|
3694
3943
|
}
|
|
3695
|
-
var
|
|
3944
|
+
var styles12 = import_react_native24.StyleSheet.create({
|
|
3696
3945
|
container: {
|
|
3697
3946
|
flexDirection: "row",
|
|
3698
3947
|
borderTopWidth: 0.5,
|
|
@@ -3735,7 +3984,7 @@ var styles11 = import_react_native22.StyleSheet.create({
|
|
|
3735
3984
|
});
|
|
3736
3985
|
|
|
3737
3986
|
// src/navigation/navigators/TabNavigator.tsx
|
|
3738
|
-
var
|
|
3987
|
+
var import_jsx_runtime34 = require("nativewind/jsx-runtime");
|
|
3739
3988
|
var NativeTab = (0, import_bottom_tabs.createBottomTabNavigator)();
|
|
3740
3989
|
var defaultScreenOptions2 = {
|
|
3741
3990
|
headerShown: false,
|
|
@@ -3748,7 +3997,7 @@ function TabNavigator({
|
|
|
3748
3997
|
screenOptions,
|
|
3749
3998
|
children
|
|
3750
3999
|
}) {
|
|
3751
|
-
const mergedScreenOptions =
|
|
4000
|
+
const mergedScreenOptions = import_react34.default.useMemo(() => {
|
|
3752
4001
|
const options = { ...defaultScreenOptions2, ...screenOptions };
|
|
3753
4002
|
if (tabBarOptions) {
|
|
3754
4003
|
if (tabBarOptions.showLabel !== void 0) {
|
|
@@ -3781,9 +4030,9 @@ function TabNavigator({
|
|
|
3781
4030
|
}
|
|
3782
4031
|
return options;
|
|
3783
4032
|
}, [tabBarOptions, screenOptions]);
|
|
3784
|
-
const resolvedTabBar =
|
|
4033
|
+
const resolvedTabBar = import_react34.default.useMemo(() => {
|
|
3785
4034
|
if (tabBar) return tabBar;
|
|
3786
|
-
return (props) => /* @__PURE__ */ (0,
|
|
4035
|
+
return (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3787
4036
|
BottomTabBar,
|
|
3788
4037
|
{
|
|
3789
4038
|
...props,
|
|
@@ -3810,7 +4059,7 @@ function TabNavigator({
|
|
|
3810
4059
|
tabBarOptions?.style,
|
|
3811
4060
|
tabBarOptions?.height
|
|
3812
4061
|
]);
|
|
3813
|
-
return /* @__PURE__ */ (0,
|
|
4062
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3814
4063
|
NativeTab.Navigator,
|
|
3815
4064
|
{
|
|
3816
4065
|
initialRouteName,
|
|
@@ -3822,7 +4071,7 @@ function TabNavigator({
|
|
|
3822
4071
|
}
|
|
3823
4072
|
TabNavigator.Screen = NativeTab.Screen;
|
|
3824
4073
|
function createTabScreens(routes) {
|
|
3825
|
-
return routes.map((route) => /* @__PURE__ */ (0,
|
|
4074
|
+
return routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3826
4075
|
TabNavigator.Screen,
|
|
3827
4076
|
{
|
|
3828
4077
|
name: route.name,
|
|
@@ -3835,9 +4084,9 @@ function createTabScreens(routes) {
|
|
|
3835
4084
|
}
|
|
3836
4085
|
|
|
3837
4086
|
// src/navigation/navigators/DrawerNavigator.tsx
|
|
3838
|
-
var
|
|
4087
|
+
var import_react35 = __toESM(require("react"));
|
|
3839
4088
|
var import_drawer = require("@react-navigation/drawer");
|
|
3840
|
-
var
|
|
4089
|
+
var import_jsx_runtime35 = require("nativewind/jsx-runtime");
|
|
3841
4090
|
var NativeDrawer = (0, import_drawer.createDrawerNavigator)();
|
|
3842
4091
|
function DrawerNavigator({
|
|
3843
4092
|
initialRouteName,
|
|
@@ -3848,7 +4097,7 @@ function DrawerNavigator({
|
|
|
3848
4097
|
}) {
|
|
3849
4098
|
const { theme, isDark } = useTheme();
|
|
3850
4099
|
const navigationTheme = createNavigationTheme(theme, isDark);
|
|
3851
|
-
const mergedScreenOptions =
|
|
4100
|
+
const mergedScreenOptions = import_react35.default.useMemo(() => {
|
|
3852
4101
|
return {
|
|
3853
4102
|
headerShown: false,
|
|
3854
4103
|
drawerStyle: {
|
|
@@ -3867,7 +4116,7 @@ function DrawerNavigator({
|
|
|
3867
4116
|
...screenOptions
|
|
3868
4117
|
};
|
|
3869
4118
|
}, [screenOptions, drawerOptions, navigationTheme, theme]);
|
|
3870
|
-
return /* @__PURE__ */ (0,
|
|
4119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3871
4120
|
NativeDrawer.Navigator,
|
|
3872
4121
|
{
|
|
3873
4122
|
initialRouteName,
|
|
@@ -3879,7 +4128,7 @@ function DrawerNavigator({
|
|
|
3879
4128
|
}
|
|
3880
4129
|
DrawerNavigator.Screen = NativeDrawer.Screen;
|
|
3881
4130
|
function createDrawerScreens(routes) {
|
|
3882
|
-
return routes.map((route) => /* @__PURE__ */ (0,
|
|
4131
|
+
return routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3883
4132
|
DrawerNavigator.Screen,
|
|
3884
4133
|
{
|
|
3885
4134
|
name: route.name,
|
|
@@ -3892,9 +4141,9 @@ function createDrawerScreens(routes) {
|
|
|
3892
4141
|
}
|
|
3893
4142
|
|
|
3894
4143
|
// src/navigation/components/AppHeader.tsx
|
|
3895
|
-
var
|
|
4144
|
+
var import_react_native25 = require("react-native");
|
|
3896
4145
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
3897
|
-
var
|
|
4146
|
+
var import_jsx_runtime36 = require("nativewind/jsx-runtime");
|
|
3898
4147
|
function AppHeader({
|
|
3899
4148
|
title,
|
|
3900
4149
|
subtitle,
|
|
@@ -3908,7 +4157,7 @@ function AppHeader({
|
|
|
3908
4157
|
const colors = useThemeColors();
|
|
3909
4158
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
3910
4159
|
const backgroundColor = transparent ? "transparent" : colors.card;
|
|
3911
|
-
return /* @__PURE__ */ (0,
|
|
4160
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3912
4161
|
AppView,
|
|
3913
4162
|
{
|
|
3914
4163
|
style: [
|
|
@@ -3918,38 +4167,38 @@ function AppHeader({
|
|
|
3918
4167
|
},
|
|
3919
4168
|
style
|
|
3920
4169
|
],
|
|
3921
|
-
children: /* @__PURE__ */ (0,
|
|
3922
|
-
/* @__PURE__ */ (0,
|
|
3923
|
-
/* @__PURE__ */ (0,
|
|
3924
|
-
title && /* @__PURE__ */ (0,
|
|
4170
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { row: true, items: "center", px: 4, style: styles13.container, children: [
|
|
4171
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppView, { style: [styles13.sideContainer, styles13.leftContainer], children: leftIcon && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppPressable, { onPress: onLeftPress, style: styles13.iconButton, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Icon, { name: leftIcon, size: 24, color: colors.text }) }) }),
|
|
4172
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { style: styles13.centerContainer, children: [
|
|
4173
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3925
4174
|
AppText,
|
|
3926
4175
|
{
|
|
3927
4176
|
size: "lg",
|
|
3928
4177
|
weight: "semibold",
|
|
3929
|
-
style: [
|
|
4178
|
+
style: [styles13.title, { color: colors.text }],
|
|
3930
4179
|
numberOfLines: 1,
|
|
3931
4180
|
children: title
|
|
3932
4181
|
}
|
|
3933
4182
|
),
|
|
3934
|
-
subtitle && /* @__PURE__ */ (0,
|
|
4183
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3935
4184
|
AppText,
|
|
3936
4185
|
{
|
|
3937
4186
|
size: "xs",
|
|
3938
|
-
style: [
|
|
4187
|
+
style: [styles13.subtitle, { color: colors.textMuted }],
|
|
3939
4188
|
numberOfLines: 1,
|
|
3940
4189
|
children: subtitle
|
|
3941
4190
|
}
|
|
3942
4191
|
)
|
|
3943
4192
|
] }),
|
|
3944
|
-
/* @__PURE__ */ (0,
|
|
3945
|
-
/* @__PURE__ */ (0,
|
|
3946
|
-
icon.badge ? /* @__PURE__ */ (0,
|
|
4193
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppView, { row: true, items: "center", style: [styles13.sideContainer, styles13.rightContainer], children: rightIcons.map((icon, index) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppPressable, { onPress: icon.onPress, style: styles13.iconButton, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { children: [
|
|
4194
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Icon, { name: icon.icon, size: 24, color: colors.text }),
|
|
4195
|
+
icon.badge ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppView, { style: styles13.badge, children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(AppText, { size: "xs", color: "white", style: styles13.badgeText, children: icon.badge > 99 ? "99+" : icon.badge }) }) : null
|
|
3947
4196
|
] }) }, index)) })
|
|
3948
4197
|
] })
|
|
3949
4198
|
}
|
|
3950
4199
|
);
|
|
3951
4200
|
}
|
|
3952
|
-
var
|
|
4201
|
+
var styles13 = import_react_native25.StyleSheet.create({
|
|
3953
4202
|
container: {
|
|
3954
4203
|
height: 44
|
|
3955
4204
|
// iOS 标准导航栏高度
|
|
@@ -4000,9 +4249,9 @@ var styles12 = import_react_native23.StyleSheet.create({
|
|
|
4000
4249
|
});
|
|
4001
4250
|
|
|
4002
4251
|
// src/navigation/components/DrawerContent.tsx
|
|
4003
|
-
var
|
|
4252
|
+
var import_react_native26 = require("react-native");
|
|
4004
4253
|
var import_drawer2 = require("@react-navigation/drawer");
|
|
4005
|
-
var
|
|
4254
|
+
var import_jsx_runtime37 = require("nativewind/jsx-runtime");
|
|
4006
4255
|
function DrawerContent({
|
|
4007
4256
|
state,
|
|
4008
4257
|
descriptors,
|
|
@@ -4031,20 +4280,20 @@ function DrawerContent({
|
|
|
4031
4280
|
badge: options.tabBarBadge
|
|
4032
4281
|
};
|
|
4033
4282
|
});
|
|
4034
|
-
return /* @__PURE__ */ (0,
|
|
4035
|
-
header && /* @__PURE__ */ (0,
|
|
4036
|
-
/* @__PURE__ */ (0,
|
|
4283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_drawer2.DrawerContentScrollView, { style: [styles14.container, { backgroundColor }], children: [
|
|
4284
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: [styles14.header, { borderBottomColor: dividerColor }], children: header }),
|
|
4285
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppView, { className: "py-2", children: drawerItems.map((item) => {
|
|
4037
4286
|
const isFocused = state.routes[state.index].name === item.name;
|
|
4038
4287
|
const onPress = () => {
|
|
4039
4288
|
navigation.navigate(item.name);
|
|
4040
4289
|
};
|
|
4041
|
-
return /* @__PURE__ */ (0,
|
|
4042
|
-
|
|
4290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4291
|
+
import_react_native26.TouchableOpacity,
|
|
4043
4292
|
{
|
|
4044
4293
|
onPress,
|
|
4045
|
-
style: [
|
|
4294
|
+
style: [styles14.item, isFocused && { backgroundColor: activeBgColor }],
|
|
4046
4295
|
children: [
|
|
4047
|
-
item.icon && /* @__PURE__ */ (0,
|
|
4296
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: styles14.iconContainer, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4048
4297
|
Icon,
|
|
4049
4298
|
{
|
|
4050
4299
|
name: item.icon,
|
|
@@ -4052,28 +4301,28 @@ function DrawerContent({
|
|
|
4052
4301
|
color: isFocused ? activeColor : inactiveColor
|
|
4053
4302
|
}
|
|
4054
4303
|
) }),
|
|
4055
|
-
/* @__PURE__ */ (0,
|
|
4304
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4056
4305
|
AppText,
|
|
4057
4306
|
{
|
|
4058
4307
|
style: [
|
|
4059
|
-
|
|
4308
|
+
styles14.label,
|
|
4060
4309
|
{ color: isFocused ? activeColor : inactiveColor },
|
|
4061
|
-
isFocused &&
|
|
4310
|
+
isFocused && styles14.activeLabel
|
|
4062
4311
|
],
|
|
4063
4312
|
numberOfLines: 1,
|
|
4064
4313
|
children: item.label
|
|
4065
4314
|
}
|
|
4066
4315
|
),
|
|
4067
|
-
item.badge != null && /* @__PURE__ */ (0,
|
|
4316
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: [styles14.badge, { backgroundColor: activeColor }], children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppText, { style: styles14.badgeText, children: typeof item.badge === "number" && item.badge > 99 ? "99+" : item.badge }) })
|
|
4068
4317
|
]
|
|
4069
4318
|
},
|
|
4070
4319
|
item.name
|
|
4071
4320
|
);
|
|
4072
4321
|
}) }),
|
|
4073
|
-
footer && /* @__PURE__ */ (0,
|
|
4322
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native26.View, { style: [styles14.footer, { borderTopColor: dividerColor }], children: footer })
|
|
4074
4323
|
] });
|
|
4075
4324
|
}
|
|
4076
|
-
var
|
|
4325
|
+
var styles14 = import_react_native26.StyleSheet.create({
|
|
4077
4326
|
container: {
|
|
4078
4327
|
flex: 1
|
|
4079
4328
|
},
|
|
@@ -4123,7 +4372,7 @@ var styles13 = import_react_native24.StyleSheet.create({
|
|
|
4123
4372
|
});
|
|
4124
4373
|
|
|
4125
4374
|
// src/navigation/hooks/useNavigation.ts
|
|
4126
|
-
var
|
|
4375
|
+
var import_react36 = require("react");
|
|
4127
4376
|
var import_native2 = require("@react-navigation/native");
|
|
4128
4377
|
function useNavigation() {
|
|
4129
4378
|
return (0, import_native2.useNavigation)();
|
|
@@ -4139,7 +4388,7 @@ function useDrawerNavigation() {
|
|
|
4139
4388
|
}
|
|
4140
4389
|
function useBackHandler(handler) {
|
|
4141
4390
|
const navigation = (0, import_native2.useNavigation)();
|
|
4142
|
-
(0,
|
|
4391
|
+
(0, import_react36.useEffect)(() => {
|
|
4143
4392
|
const unsubscribe = navigation.addListener("beforeRemove", (e) => {
|
|
4144
4393
|
if (!handler()) {
|
|
4145
4394
|
e.preventDefault();
|
|
@@ -4168,8 +4417,8 @@ var import_native5 = require("@react-navigation/native");
|
|
|
4168
4417
|
var import_react_native_safe_area_context4 = require("react-native-safe-area-context");
|
|
4169
4418
|
|
|
4170
4419
|
// src/overlay/AppStatusBar.tsx
|
|
4171
|
-
var
|
|
4172
|
-
var
|
|
4420
|
+
var import_react_native27 = require("react-native");
|
|
4421
|
+
var import_jsx_runtime38 = require("nativewind/jsx-runtime");
|
|
4173
4422
|
function AppStatusBar({
|
|
4174
4423
|
barStyle = "auto",
|
|
4175
4424
|
backgroundColor,
|
|
@@ -4179,8 +4428,8 @@ function AppStatusBar({
|
|
|
4179
4428
|
const { theme, isDark } = useTheme();
|
|
4180
4429
|
const resolvedBarStyle = barStyle === "auto" ? isDark ? "light-content" : "dark-content" : barStyle;
|
|
4181
4430
|
const resolvedBackgroundColor = backgroundColor ?? (translucent ? "transparent" : theme.colors.background?.[500] || "#ffffff");
|
|
4182
|
-
return /* @__PURE__ */ (0,
|
|
4183
|
-
|
|
4431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4432
|
+
import_react_native27.StatusBar,
|
|
4184
4433
|
{
|
|
4185
4434
|
barStyle: resolvedBarStyle,
|
|
4186
4435
|
backgroundColor: resolvedBackgroundColor,
|
|
@@ -4191,27 +4440,27 @@ function AppStatusBar({
|
|
|
4191
4440
|
}
|
|
4192
4441
|
|
|
4193
4442
|
// src/overlay/loading/provider.tsx
|
|
4194
|
-
var
|
|
4443
|
+
var import_react38 = require("react");
|
|
4195
4444
|
|
|
4196
4445
|
// src/overlay/loading/context.ts
|
|
4197
|
-
var
|
|
4198
|
-
var LoadingContext = (0,
|
|
4446
|
+
var import_react37 = require("react");
|
|
4447
|
+
var LoadingContext = (0, import_react37.createContext)(null);
|
|
4199
4448
|
function useLoadingContext() {
|
|
4200
|
-
const ctx = (0,
|
|
4449
|
+
const ctx = (0, import_react37.useContext)(LoadingContext);
|
|
4201
4450
|
if (!ctx) throw new Error("useLoading must be used within OverlayProvider");
|
|
4202
4451
|
return ctx;
|
|
4203
4452
|
}
|
|
4204
4453
|
|
|
4205
4454
|
// src/overlay/loading/component.tsx
|
|
4206
|
-
var
|
|
4207
|
-
var
|
|
4455
|
+
var import_react_native28 = require("react-native");
|
|
4456
|
+
var import_jsx_runtime39 = require("nativewind/jsx-runtime");
|
|
4208
4457
|
function LoadingModal({ visible, text }) {
|
|
4209
|
-
return /* @__PURE__ */ (0,
|
|
4210
|
-
/* @__PURE__ */ (0,
|
|
4211
|
-
text && /* @__PURE__ */ (0,
|
|
4458
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native28.Modal, { transparent: true, visible, animationType: "fade", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native28.View, { style: styles15.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native28.View, { style: [styles15.loadingBox, { backgroundColor: "rgba(0,0,0,0.8)" }], children: [
|
|
4459
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native28.ActivityIndicator, { size: "large", color: "#fff" }),
|
|
4460
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AppText, { className: "text-white mt-3 text-sm", children: text })
|
|
4212
4461
|
] }) }) });
|
|
4213
4462
|
}
|
|
4214
|
-
var
|
|
4463
|
+
var styles15 = import_react_native28.StyleSheet.create({
|
|
4215
4464
|
overlay: {
|
|
4216
4465
|
flex: 1,
|
|
4217
4466
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4227,45 +4476,45 @@ var styles14 = import_react_native26.StyleSheet.create({
|
|
|
4227
4476
|
});
|
|
4228
4477
|
|
|
4229
4478
|
// src/overlay/loading/provider.tsx
|
|
4230
|
-
var
|
|
4479
|
+
var import_jsx_runtime40 = require("nativewind/jsx-runtime");
|
|
4231
4480
|
function LoadingProvider({ children }) {
|
|
4232
|
-
const [state, setState] = (0,
|
|
4233
|
-
const show = (0,
|
|
4481
|
+
const [state, setState] = (0, import_react38.useState)({ visible: false });
|
|
4482
|
+
const show = (0, import_react38.useCallback)((text) => {
|
|
4234
4483
|
setState({ visible: true, text });
|
|
4235
4484
|
}, []);
|
|
4236
|
-
const hide = (0,
|
|
4485
|
+
const hide = (0, import_react38.useCallback)(() => {
|
|
4237
4486
|
setState({ visible: false });
|
|
4238
4487
|
}, []);
|
|
4239
|
-
return /* @__PURE__ */ (0,
|
|
4488
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(LoadingContext.Provider, { value: { show, hide }, children: [
|
|
4240
4489
|
children,
|
|
4241
|
-
/* @__PURE__ */ (0,
|
|
4490
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LoadingModal, { ...state })
|
|
4242
4491
|
] });
|
|
4243
4492
|
}
|
|
4244
4493
|
|
|
4245
4494
|
// src/overlay/toast/provider.tsx
|
|
4246
|
-
var
|
|
4247
|
-
var
|
|
4495
|
+
var import_react41 = require("react");
|
|
4496
|
+
var import_react_native30 = require("react-native");
|
|
4248
4497
|
|
|
4249
4498
|
// src/overlay/toast/context.ts
|
|
4250
|
-
var
|
|
4251
|
-
var ToastContext = (0,
|
|
4499
|
+
var import_react39 = require("react");
|
|
4500
|
+
var ToastContext = (0, import_react39.createContext)(null);
|
|
4252
4501
|
function useToastContext() {
|
|
4253
|
-
const ctx = (0,
|
|
4502
|
+
const ctx = (0, import_react39.useContext)(ToastContext);
|
|
4254
4503
|
if (!ctx) throw new Error("useToast must be used within OverlayProvider");
|
|
4255
4504
|
return ctx;
|
|
4256
4505
|
}
|
|
4257
4506
|
|
|
4258
4507
|
// src/overlay/toast/component.tsx
|
|
4259
|
-
var
|
|
4260
|
-
var
|
|
4261
|
-
var
|
|
4508
|
+
var import_react40 = require("react");
|
|
4509
|
+
var import_react_native29 = require("react-native");
|
|
4510
|
+
var import_jsx_runtime41 = require("nativewind/jsx-runtime");
|
|
4262
4511
|
function ToastItemView({ message, type, onHide }) {
|
|
4263
|
-
const fadeAnim = (0,
|
|
4264
|
-
(0,
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4512
|
+
const fadeAnim = (0, import_react40.useRef)(new import_react_native29.Animated.Value(0)).current;
|
|
4513
|
+
(0, import_react40.useEffect)(() => {
|
|
4514
|
+
import_react_native29.Animated.sequence([
|
|
4515
|
+
import_react_native29.Animated.timing(fadeAnim, { toValue: 1, duration: 200, useNativeDriver: true }),
|
|
4516
|
+
import_react_native29.Animated.delay(2500),
|
|
4517
|
+
import_react_native29.Animated.timing(fadeAnim, { toValue: 0, duration: 200, useNativeDriver: true })
|
|
4269
4518
|
]).start(onHide);
|
|
4270
4519
|
}, []);
|
|
4271
4520
|
const bgColors = {
|
|
@@ -4274,8 +4523,8 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4274
4523
|
warning: "bg-warning-500",
|
|
4275
4524
|
info: "bg-primary-500"
|
|
4276
4525
|
};
|
|
4277
|
-
return /* @__PURE__ */ (0,
|
|
4278
|
-
|
|
4526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4527
|
+
import_react_native29.Animated.View,
|
|
4279
4528
|
{
|
|
4280
4529
|
style: {
|
|
4281
4530
|
opacity: fadeAnim,
|
|
@@ -4288,17 +4537,17 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4288
4537
|
}
|
|
4289
4538
|
]
|
|
4290
4539
|
},
|
|
4291
|
-
children: /* @__PURE__ */ (0,
|
|
4540
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppView, { className: `${bgColors[type]} px-4 py-3 rounded-lg mb-2 mx-4 shadow-lg`, children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(AppText, { className: "text-white text-center", children: message }) })
|
|
4292
4541
|
}
|
|
4293
4542
|
);
|
|
4294
4543
|
}
|
|
4295
4544
|
|
|
4296
4545
|
// src/overlay/toast/provider.tsx
|
|
4297
|
-
var
|
|
4546
|
+
var import_jsx_runtime42 = require("nativewind/jsx-runtime");
|
|
4298
4547
|
function ToastProvider({ children }) {
|
|
4299
|
-
const [toasts, setToasts] = (0,
|
|
4300
|
-
const timersRef = (0,
|
|
4301
|
-
const remove = (0,
|
|
4548
|
+
const [toasts, setToasts] = (0, import_react41.useState)([]);
|
|
4549
|
+
const timersRef = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
|
|
4550
|
+
const remove = (0, import_react41.useCallback)((id) => {
|
|
4302
4551
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
4303
4552
|
const timer = timersRef.current.get(id);
|
|
4304
4553
|
if (timer) {
|
|
@@ -4306,7 +4555,7 @@ function ToastProvider({ children }) {
|
|
|
4306
4555
|
timersRef.current.delete(id);
|
|
4307
4556
|
}
|
|
4308
4557
|
}, []);
|
|
4309
|
-
const show = (0,
|
|
4558
|
+
const show = (0, import_react41.useCallback)(
|
|
4310
4559
|
(message, type = "info", duration = 3e3) => {
|
|
4311
4560
|
const id = Math.random().toString(36).substring(7);
|
|
4312
4561
|
const toast = { id, message, type, duration };
|
|
@@ -4316,28 +4565,28 @@ function ToastProvider({ children }) {
|
|
|
4316
4565
|
},
|
|
4317
4566
|
[remove]
|
|
4318
4567
|
);
|
|
4319
|
-
const success = (0,
|
|
4568
|
+
const success = (0, import_react41.useCallback)(
|
|
4320
4569
|
(message, duration) => show(message, "success", duration),
|
|
4321
4570
|
[show]
|
|
4322
4571
|
);
|
|
4323
|
-
const error = (0,
|
|
4572
|
+
const error = (0, import_react41.useCallback)(
|
|
4324
4573
|
(message, duration) => show(message, "error", duration),
|
|
4325
4574
|
[show]
|
|
4326
4575
|
);
|
|
4327
|
-
const info = (0,
|
|
4576
|
+
const info = (0, import_react41.useCallback)(
|
|
4328
4577
|
(message, duration) => show(message, "info", duration),
|
|
4329
4578
|
[show]
|
|
4330
4579
|
);
|
|
4331
|
-
const warning = (0,
|
|
4580
|
+
const warning = (0, import_react41.useCallback)(
|
|
4332
4581
|
(message, duration) => show(message, "warning", duration),
|
|
4333
4582
|
[show]
|
|
4334
4583
|
);
|
|
4335
|
-
return /* @__PURE__ */ (0,
|
|
4584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(ToastContext.Provider, { value: { show, success, error, info, warning }, children: [
|
|
4336
4585
|
children,
|
|
4337
|
-
/* @__PURE__ */ (0,
|
|
4586
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native30.View, { style: styles16.toastContainer, pointerEvents: "none", children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ToastItemView, { ...toast, onHide: () => remove(toast.id) }, toast.id)) })
|
|
4338
4587
|
] });
|
|
4339
4588
|
}
|
|
4340
|
-
var
|
|
4589
|
+
var styles16 = import_react_native30.StyleSheet.create({
|
|
4341
4590
|
toastContainer: {
|
|
4342
4591
|
position: "absolute",
|
|
4343
4592
|
top: 60,
|
|
@@ -4348,20 +4597,20 @@ var styles15 = import_react_native28.StyleSheet.create({
|
|
|
4348
4597
|
});
|
|
4349
4598
|
|
|
4350
4599
|
// src/overlay/alert/provider.tsx
|
|
4351
|
-
var
|
|
4600
|
+
var import_react43 = require("react");
|
|
4352
4601
|
|
|
4353
4602
|
// src/overlay/alert/context.ts
|
|
4354
|
-
var
|
|
4355
|
-
var AlertContext = (0,
|
|
4603
|
+
var import_react42 = require("react");
|
|
4604
|
+
var AlertContext = (0, import_react42.createContext)(null);
|
|
4356
4605
|
function useAlertContext() {
|
|
4357
|
-
const ctx = (0,
|
|
4606
|
+
const ctx = (0, import_react42.useContext)(AlertContext);
|
|
4358
4607
|
if (!ctx) throw new Error("useAlert must be used within OverlayProvider");
|
|
4359
4608
|
return ctx;
|
|
4360
4609
|
}
|
|
4361
4610
|
|
|
4362
4611
|
// src/overlay/alert/component.tsx
|
|
4363
|
-
var
|
|
4364
|
-
var
|
|
4612
|
+
var import_react_native31 = require("react-native");
|
|
4613
|
+
var import_jsx_runtime43 = require("nativewind/jsx-runtime");
|
|
4365
4614
|
function AlertModal({
|
|
4366
4615
|
visible,
|
|
4367
4616
|
title,
|
|
@@ -4373,16 +4622,16 @@ function AlertModal({
|
|
|
4373
4622
|
onCancel
|
|
4374
4623
|
}) {
|
|
4375
4624
|
if (!visible) return null;
|
|
4376
|
-
return /* @__PURE__ */ (0,
|
|
4377
|
-
title && /* @__PURE__ */ (0,
|
|
4378
|
-
message && /* @__PURE__ */ (0,
|
|
4379
|
-
/* @__PURE__ */ (0,
|
|
4380
|
-
showCancel && /* @__PURE__ */ (0,
|
|
4381
|
-
/* @__PURE__ */ (0,
|
|
4625
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native31.Modal, { transparent: true, visible: true, animationType: "fade", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native31.View, { style: styles17.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native31.View, { style: styles17.alertBox, children: [
|
|
4626
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppText, { className: "text-lg font-semibold text-center mb-2", children: title }),
|
|
4627
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppText, { className: "text-gray-600 text-center mb-4", children: message }),
|
|
4628
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(AppView, { row: true, gap: 3, className: "mt-2", children: [
|
|
4629
|
+
showCancel && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppPressable, { onPress: onCancel, className: "flex-1 py-3 bg-gray-100 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppText, { className: "text-center text-gray-700", children: cancelText || "\u53D6\u6D88" }) }),
|
|
4630
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppPressable, { onPress: onConfirm, className: "flex-1 py-3 bg-primary-500 rounded-lg", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppText, { className: "text-center text-white", children: confirmText || "\u786E\u5B9A" }) })
|
|
4382
4631
|
] })
|
|
4383
4632
|
] }) }) });
|
|
4384
4633
|
}
|
|
4385
|
-
var
|
|
4634
|
+
var styles17 = import_react_native31.StyleSheet.create({
|
|
4386
4635
|
overlay: {
|
|
4387
4636
|
flex: 1,
|
|
4388
4637
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4404,32 +4653,32 @@ var styles16 = import_react_native29.StyleSheet.create({
|
|
|
4404
4653
|
});
|
|
4405
4654
|
|
|
4406
4655
|
// src/overlay/alert/provider.tsx
|
|
4407
|
-
var
|
|
4656
|
+
var import_jsx_runtime44 = require("nativewind/jsx-runtime");
|
|
4408
4657
|
function AlertProvider({ children }) {
|
|
4409
|
-
const [alert, setAlert] = (0,
|
|
4410
|
-
const showAlert = (0,
|
|
4658
|
+
const [alert, setAlert] = (0, import_react43.useState)(null);
|
|
4659
|
+
const showAlert = (0, import_react43.useCallback)((options) => {
|
|
4411
4660
|
setAlert({ ...options, visible: true });
|
|
4412
4661
|
}, []);
|
|
4413
|
-
const confirm = (0,
|
|
4662
|
+
const confirm = (0, import_react43.useCallback)(
|
|
4414
4663
|
(options) => {
|
|
4415
4664
|
showAlert({ ...options, showCancel: true });
|
|
4416
4665
|
},
|
|
4417
4666
|
[showAlert]
|
|
4418
4667
|
);
|
|
4419
|
-
const hide = (0,
|
|
4668
|
+
const hide = (0, import_react43.useCallback)(() => {
|
|
4420
4669
|
setAlert(null);
|
|
4421
4670
|
}, []);
|
|
4422
|
-
const handleConfirm = (0,
|
|
4671
|
+
const handleConfirm = (0, import_react43.useCallback)(() => {
|
|
4423
4672
|
alert?.onConfirm?.();
|
|
4424
4673
|
hide();
|
|
4425
4674
|
}, [alert, hide]);
|
|
4426
|
-
const handleCancel = (0,
|
|
4675
|
+
const handleCancel = (0, import_react43.useCallback)(() => {
|
|
4427
4676
|
alert?.onCancel?.();
|
|
4428
4677
|
hide();
|
|
4429
4678
|
}, [alert, hide]);
|
|
4430
|
-
return /* @__PURE__ */ (0,
|
|
4679
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(AlertContext.Provider, { value: { alert: showAlert, confirm }, children: [
|
|
4431
4680
|
children,
|
|
4432
|
-
/* @__PURE__ */ (0,
|
|
4681
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4433
4682
|
AlertModal,
|
|
4434
4683
|
{
|
|
4435
4684
|
visible: alert?.visible ?? false,
|
|
@@ -4446,13 +4695,13 @@ function AlertProvider({ children }) {
|
|
|
4446
4695
|
}
|
|
4447
4696
|
|
|
4448
4697
|
// src/overlay/provider.tsx
|
|
4449
|
-
var
|
|
4698
|
+
var import_jsx_runtime45 = require("nativewind/jsx-runtime");
|
|
4450
4699
|
function OverlayProvider({ children }) {
|
|
4451
|
-
return /* @__PURE__ */ (0,
|
|
4700
|
+
return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(LoadingProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(ToastProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(AlertProvider, { children }) }) });
|
|
4452
4701
|
}
|
|
4453
4702
|
|
|
4454
4703
|
// src/overlay/AppProvider.tsx
|
|
4455
|
-
var
|
|
4704
|
+
var import_jsx_runtime46 = require("nativewind/jsx-runtime");
|
|
4456
4705
|
var defaultLightTheme = {
|
|
4457
4706
|
colors: {
|
|
4458
4707
|
primary: "#f38b32",
|
|
@@ -4489,21 +4738,21 @@ function AppProvider({
|
|
|
4489
4738
|
}) {
|
|
4490
4739
|
let content = children;
|
|
4491
4740
|
if (enableOverlay) {
|
|
4492
|
-
content = /* @__PURE__ */ (0,
|
|
4741
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(OverlayProvider, { children: content });
|
|
4493
4742
|
}
|
|
4494
4743
|
if (enableNavigation) {
|
|
4495
|
-
content = /* @__PURE__ */ (0,
|
|
4744
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(NavigationProvider, { ...navigationProps, children: content });
|
|
4496
4745
|
}
|
|
4497
4746
|
if (enableTheme) {
|
|
4498
|
-
content = /* @__PURE__ */ (0,
|
|
4499
|
-
enableStatusBar && /* @__PURE__ */ (0,
|
|
4747
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ThemeProvider, { light: lightTheme, dark: darkTheme, defaultDark, isDark, children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(import_jsx_runtime46.Fragment, { children: [
|
|
4748
|
+
enableStatusBar && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AppStatusBar, { testID: "status-bar", ...statusBarProps }),
|
|
4500
4749
|
content
|
|
4501
4750
|
] }) });
|
|
4502
4751
|
}
|
|
4503
4752
|
if (enableSafeArea) {
|
|
4504
|
-
content = /* @__PURE__ */ (0,
|
|
4753
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native_safe_area_context4.SafeAreaProvider, { children: content });
|
|
4505
4754
|
}
|
|
4506
|
-
return /* @__PURE__ */ (0,
|
|
4755
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, { children: content });
|
|
4507
4756
|
}
|
|
4508
4757
|
|
|
4509
4758
|
// src/overlay/loading/hooks.ts
|
|
@@ -4550,6 +4799,7 @@ var import_react_native_safe_area_context5 = require("react-native-safe-area-con
|
|
|
4550
4799
|
ErrorCode,
|
|
4551
4800
|
FileIcons,
|
|
4552
4801
|
FormItem,
|
|
4802
|
+
GradientView,
|
|
4553
4803
|
Icon,
|
|
4554
4804
|
Loading,
|
|
4555
4805
|
MemoryStorage,
|
|
@@ -4558,6 +4808,7 @@ var import_react_native_safe_area_context5 = require("react-native-safe-area-con
|
|
|
4558
4808
|
NavigationProvider,
|
|
4559
4809
|
OverlayProvider,
|
|
4560
4810
|
Page,
|
|
4811
|
+
PageDrawer,
|
|
4561
4812
|
Progress,
|
|
4562
4813
|
Radio,
|
|
4563
4814
|
RadioGroup,
|
|
@@ -4623,6 +4874,7 @@ var import_react_native_safe_area_context5 = require("react-native-safe-area-con
|
|
|
4623
4874
|
useNavigation,
|
|
4624
4875
|
useNavigationState,
|
|
4625
4876
|
useOrientation,
|
|
4877
|
+
usePageDrawer,
|
|
4626
4878
|
usePagination,
|
|
4627
4879
|
usePrevious,
|
|
4628
4880
|
useQuery,
|