@gaozh1024/rn-kit 0.2.0-beta.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -1
- package/dist/index.d.mts +101 -15
- package/dist/index.d.ts +101 -15
- package/dist/index.js +673 -428
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +565 -323
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -2
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 }),
|
|
@@ -2122,30 +2151,200 @@ var styles3 = import_react_native11.StyleSheet.create({
|
|
|
2122
2151
|
}
|
|
2123
2152
|
});
|
|
2124
2153
|
|
|
2125
|
-
// src/ui/
|
|
2126
|
-
var import_react16 = require("react");
|
|
2154
|
+
// src/ui/display/PageDrawer.tsx
|
|
2155
|
+
var import_react16 = __toESM(require("react"));
|
|
2127
2156
|
var import_react_native12 = require("react-native");
|
|
2128
2157
|
var import_jsx_runtime19 = require("nativewind/jsx-runtime");
|
|
2129
|
-
|
|
2158
|
+
function PageDrawer({
|
|
2159
|
+
visible,
|
|
2160
|
+
onClose,
|
|
2161
|
+
title,
|
|
2162
|
+
header,
|
|
2163
|
+
footer,
|
|
2164
|
+
placement = "right",
|
|
2165
|
+
width = 320,
|
|
2166
|
+
swipeEnabled = true,
|
|
2167
|
+
swipeThreshold = 80,
|
|
2168
|
+
closeOnBackdropPress = true,
|
|
2169
|
+
showCloseButton = true,
|
|
2170
|
+
children,
|
|
2171
|
+
testID,
|
|
2172
|
+
contentTestID = "page-drawer-content",
|
|
2173
|
+
backdropTestID = "page-drawer-backdrop"
|
|
2174
|
+
}) {
|
|
2175
|
+
const colors = useThemeColors();
|
|
2176
|
+
const [translateX, setTranslateX] = import_react16.default.useState(0);
|
|
2177
|
+
if (!visible) return null;
|
|
2178
|
+
const handleClose = import_react16.default.useCallback(() => {
|
|
2179
|
+
setTranslateX(0);
|
|
2180
|
+
onClose?.();
|
|
2181
|
+
}, [onClose]);
|
|
2182
|
+
import_react16.default.useEffect(() => {
|
|
2183
|
+
if (!visible) return;
|
|
2184
|
+
const subscription = import_react_native12.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
2185
|
+
handleClose();
|
|
2186
|
+
return true;
|
|
2187
|
+
});
|
|
2188
|
+
return () => subscription.remove();
|
|
2189
|
+
}, [handleClose, visible]);
|
|
2190
|
+
const panResponder = import_react16.default.useMemo(
|
|
2191
|
+
() => import_react_native12.PanResponder.create({
|
|
2192
|
+
onMoveShouldSetPanResponder: (_event, gestureState) => {
|
|
2193
|
+
if (!swipeEnabled) return false;
|
|
2194
|
+
const isHorizontal = Math.abs(gestureState.dx) > Math.abs(gestureState.dy);
|
|
2195
|
+
const reachesThreshold = Math.abs(gestureState.dx) > 8;
|
|
2196
|
+
return isHorizontal && reachesThreshold;
|
|
2197
|
+
},
|
|
2198
|
+
onPanResponderMove: (_event, gestureState) => {
|
|
2199
|
+
if (!swipeEnabled) return;
|
|
2200
|
+
const nextTranslateX = placement === "right" ? Math.min(0, Math.max(-width, gestureState.dx)) : Math.max(0, Math.min(width, gestureState.dx));
|
|
2201
|
+
setTranslateX(nextTranslateX);
|
|
2202
|
+
},
|
|
2203
|
+
onPanResponderRelease: (_event, gestureState) => {
|
|
2204
|
+
if (!swipeEnabled) {
|
|
2205
|
+
setTranslateX(0);
|
|
2206
|
+
return;
|
|
2207
|
+
}
|
|
2208
|
+
const reachedCloseThreshold = placement === "right" ? gestureState.dx <= -swipeThreshold : gestureState.dx >= swipeThreshold;
|
|
2209
|
+
if (reachedCloseThreshold) {
|
|
2210
|
+
handleClose();
|
|
2211
|
+
return;
|
|
2212
|
+
}
|
|
2213
|
+
setTranslateX(0);
|
|
2214
|
+
},
|
|
2215
|
+
onPanResponderTerminate: () => {
|
|
2216
|
+
setTranslateX(0);
|
|
2217
|
+
}
|
|
2218
|
+
}),
|
|
2219
|
+
[handleClose, placement, swipeEnabled, swipeThreshold, width]
|
|
2220
|
+
);
|
|
2221
|
+
const drawerContent = /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2222
|
+
AppView,
|
|
2223
|
+
{
|
|
2224
|
+
testID: contentTestID,
|
|
2225
|
+
className: "h-full",
|
|
2226
|
+
...panResponder.panHandlers,
|
|
2227
|
+
style: [
|
|
2228
|
+
styles4.drawer,
|
|
2229
|
+
{
|
|
2230
|
+
width,
|
|
2231
|
+
backgroundColor: colors.card,
|
|
2232
|
+
borderLeftWidth: placement === "right" ? 0.5 : 0,
|
|
2233
|
+
borderRightWidth: placement === "left" ? 0.5 : 0,
|
|
2234
|
+
borderLeftColor: colors.border,
|
|
2235
|
+
borderRightColor: colors.border,
|
|
2236
|
+
transform: [{ translateX }]
|
|
2237
|
+
}
|
|
2238
|
+
],
|
|
2239
|
+
children: [
|
|
2240
|
+
(header || title || showCloseButton) && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2241
|
+
AppView,
|
|
2242
|
+
{
|
|
2243
|
+
row: true,
|
|
2244
|
+
items: "center",
|
|
2245
|
+
between: true,
|
|
2246
|
+
className: "px-4 py-4",
|
|
2247
|
+
style: [styles4.header, { borderBottomColor: colors.divider }],
|
|
2248
|
+
children: [
|
|
2249
|
+
/* @__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) }),
|
|
2250
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2251
|
+
AppPressable,
|
|
2252
|
+
{
|
|
2253
|
+
testID: "page-drawer-close",
|
|
2254
|
+
className: "p-1",
|
|
2255
|
+
pressedClassName: "opacity-70",
|
|
2256
|
+
onPress: handleClose,
|
|
2257
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Icon, { name: "close", size: "md", color: colors.textSecondary })
|
|
2258
|
+
}
|
|
2259
|
+
)
|
|
2260
|
+
]
|
|
2261
|
+
}
|
|
2262
|
+
),
|
|
2263
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AppScrollView, { flex: true, className: "px-4 py-4", children }),
|
|
2264
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2265
|
+
AppView,
|
|
2266
|
+
{
|
|
2267
|
+
className: "px-4 py-4",
|
|
2268
|
+
style: [styles4.footer, { borderTopColor: colors.divider }],
|
|
2269
|
+
children: footer
|
|
2270
|
+
}
|
|
2271
|
+
)
|
|
2272
|
+
]
|
|
2273
|
+
}
|
|
2274
|
+
);
|
|
2275
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react_native12.Modal, { visible: true, transparent: true, animationType: "fade", onRequestClose: handleClose, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2276
|
+
AppView,
|
|
2277
|
+
{
|
|
2278
|
+
testID,
|
|
2279
|
+
flex: true,
|
|
2280
|
+
row: true,
|
|
2281
|
+
style: { backgroundColor: "rgba(0,0,0,0.5)" },
|
|
2282
|
+
justify: placement === "right" ? "end" : "start",
|
|
2283
|
+
children: [
|
|
2284
|
+
placement === "left" && drawerContent,
|
|
2285
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2286
|
+
AppPressable,
|
|
2287
|
+
{
|
|
2288
|
+
testID: backdropTestID,
|
|
2289
|
+
className: "flex-1",
|
|
2290
|
+
onPress: closeOnBackdropPress ? handleClose : void 0
|
|
2291
|
+
}
|
|
2292
|
+
),
|
|
2293
|
+
placement === "right" && drawerContent
|
|
2294
|
+
]
|
|
2295
|
+
}
|
|
2296
|
+
) });
|
|
2297
|
+
}
|
|
2298
|
+
var styles4 = import_react_native12.StyleSheet.create({
|
|
2299
|
+
drawer: {
|
|
2300
|
+
height: "100%"
|
|
2301
|
+
},
|
|
2302
|
+
header: {
|
|
2303
|
+
borderBottomWidth: 0.5
|
|
2304
|
+
},
|
|
2305
|
+
footer: {
|
|
2306
|
+
borderTopWidth: 0.5
|
|
2307
|
+
}
|
|
2308
|
+
});
|
|
2309
|
+
|
|
2310
|
+
// src/ui/display/GradientView.tsx
|
|
2311
|
+
var import_expo_linear_gradient = require("expo-linear-gradient");
|
|
2312
|
+
var import_jsx_runtime20 = require("nativewind/jsx-runtime");
|
|
2313
|
+
function GradientView({
|
|
2314
|
+
colors,
|
|
2315
|
+
start = { x: 0, y: 0 },
|
|
2316
|
+
end = { x: 1, y: 1 },
|
|
2317
|
+
children,
|
|
2318
|
+
style,
|
|
2319
|
+
...props
|
|
2320
|
+
}) {
|
|
2321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_expo_linear_gradient.LinearGradient, { colors: [...colors], start, end, style, ...props, children });
|
|
2322
|
+
}
|
|
2323
|
+
|
|
2324
|
+
// src/ui/form/AppInput.tsx
|
|
2325
|
+
var import_react17 = require("react");
|
|
2326
|
+
var import_react_native13 = require("react-native");
|
|
2327
|
+
var import_jsx_runtime21 = require("nativewind/jsx-runtime");
|
|
2328
|
+
var AppInput = (0, import_react17.forwardRef)(
|
|
2130
2329
|
({ label, error, disabled = false, leftIcon, rightIcon, className, style, ...props }, ref) => {
|
|
2131
2330
|
const colors = useThemeColors();
|
|
2132
|
-
const [isFocused, setIsFocused] = (0,
|
|
2331
|
+
const [isFocused, setIsFocused] = (0, import_react17.useState)(false);
|
|
2133
2332
|
const errorColor = "#ef4444";
|
|
2134
2333
|
const getBorderColor = () => {
|
|
2135
2334
|
if (error) return errorColor;
|
|
2136
2335
|
if (isFocused) return colors.primary;
|
|
2137
2336
|
return colors.border;
|
|
2138
2337
|
};
|
|
2139
|
-
return /* @__PURE__ */ (0,
|
|
2140
|
-
label && /* @__PURE__ */ (0,
|
|
2141
|
-
/* @__PURE__ */ (0,
|
|
2338
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(AppView, { className: cn("flex-col gap-1", className), children: [
|
|
2339
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AppText, { size: "sm", weight: "medium", style: { color: colors.textSecondary }, children: label }),
|
|
2340
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2142
2341
|
AppView,
|
|
2143
2342
|
{
|
|
2144
2343
|
row: true,
|
|
2145
2344
|
items: "center",
|
|
2146
2345
|
className: "rounded-lg px-3",
|
|
2147
2346
|
style: [
|
|
2148
|
-
|
|
2347
|
+
styles5.inputContainer,
|
|
2149
2348
|
{
|
|
2150
2349
|
backgroundColor: colors.card,
|
|
2151
2350
|
borderColor: getBorderColor(),
|
|
@@ -2153,13 +2352,13 @@ var AppInput = (0, import_react16.forwardRef)(
|
|
|
2153
2352
|
}
|
|
2154
2353
|
],
|
|
2155
2354
|
children: [
|
|
2156
|
-
leftIcon && /* @__PURE__ */ (0,
|
|
2157
|
-
/* @__PURE__ */ (0,
|
|
2158
|
-
|
|
2355
|
+
leftIcon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native13.View, { style: styles5.icon, children: leftIcon }),
|
|
2356
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2357
|
+
import_react_native13.TextInput,
|
|
2159
2358
|
{
|
|
2160
2359
|
ref,
|
|
2161
2360
|
className: "flex-1 py-3 text-base",
|
|
2162
|
-
style: [
|
|
2361
|
+
style: [styles5.input, { color: colors.text }, style],
|
|
2163
2362
|
placeholderTextColor: colors.textMuted,
|
|
2164
2363
|
editable: !disabled,
|
|
2165
2364
|
onFocus: (e) => {
|
|
@@ -2173,16 +2372,16 @@ var AppInput = (0, import_react16.forwardRef)(
|
|
|
2173
2372
|
...props
|
|
2174
2373
|
}
|
|
2175
2374
|
),
|
|
2176
|
-
rightIcon && /* @__PURE__ */ (0,
|
|
2375
|
+
rightIcon && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_native13.View, { style: styles5.icon, children: rightIcon })
|
|
2177
2376
|
]
|
|
2178
2377
|
}
|
|
2179
2378
|
),
|
|
2180
|
-
error && /* @__PURE__ */ (0,
|
|
2379
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(AppText, { size: "xs", style: { color: errorColor }, children: error })
|
|
2181
2380
|
] });
|
|
2182
2381
|
}
|
|
2183
2382
|
);
|
|
2184
2383
|
AppInput.displayName = "AppInput";
|
|
2185
|
-
var
|
|
2384
|
+
var styles5 = import_react_native13.StyleSheet.create({
|
|
2186
2385
|
inputContainer: {
|
|
2187
2386
|
borderWidth: 0.5,
|
|
2188
2387
|
minHeight: 48
|
|
@@ -2197,9 +2396,9 @@ var styles4 = import_react_native12.StyleSheet.create({
|
|
|
2197
2396
|
});
|
|
2198
2397
|
|
|
2199
2398
|
// src/ui/form/Checkbox.tsx
|
|
2200
|
-
var
|
|
2201
|
-
var
|
|
2202
|
-
var
|
|
2399
|
+
var import_react18 = require("react");
|
|
2400
|
+
var import_react_native14 = require("react-native");
|
|
2401
|
+
var import_jsx_runtime22 = require("nativewind/jsx-runtime");
|
|
2203
2402
|
function Checkbox({
|
|
2204
2403
|
checked,
|
|
2205
2404
|
defaultChecked,
|
|
@@ -2210,7 +2409,7 @@ function Checkbox({
|
|
|
2210
2409
|
testID
|
|
2211
2410
|
}) {
|
|
2212
2411
|
const colors = useThemeColors();
|
|
2213
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
2412
|
+
const [internalChecked, setInternalChecked] = (0, import_react18.useState)(defaultChecked || false);
|
|
2214
2413
|
const isChecked = checked !== void 0 ? checked : internalChecked;
|
|
2215
2414
|
const toggle = () => {
|
|
2216
2415
|
if (disabled) return;
|
|
@@ -2221,8 +2420,8 @@ function Checkbox({
|
|
|
2221
2420
|
onChange?.(newChecked);
|
|
2222
2421
|
};
|
|
2223
2422
|
const disabledOpacity = 0.4;
|
|
2224
|
-
return /* @__PURE__ */ (0,
|
|
2225
|
-
|
|
2423
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(
|
|
2424
|
+
import_react_native14.TouchableOpacity,
|
|
2226
2425
|
{
|
|
2227
2426
|
onPress: toggle,
|
|
2228
2427
|
disabled,
|
|
@@ -2231,7 +2430,7 @@ function Checkbox({
|
|
|
2231
2430
|
testID,
|
|
2232
2431
|
activeOpacity: 0.7,
|
|
2233
2432
|
children: [
|
|
2234
|
-
/* @__PURE__ */ (0,
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2235
2434
|
AppView,
|
|
2236
2435
|
{
|
|
2237
2436
|
className: cn(
|
|
@@ -2239,28 +2438,39 @@ function Checkbox({
|
|
|
2239
2438
|
isChecked ? "bg-primary-500" : "bg-white border"
|
|
2240
2439
|
),
|
|
2241
2440
|
style: [
|
|
2242
|
-
|
|
2441
|
+
styles6.checkbox,
|
|
2243
2442
|
{
|
|
2244
2443
|
backgroundColor: isChecked ? colors.primary : colors.cardElevated,
|
|
2245
2444
|
borderColor: isChecked ? colors.primary : colors.border
|
|
2246
2445
|
}
|
|
2247
2446
|
],
|
|
2248
|
-
children: isChecked && /* @__PURE__ */ (0,
|
|
2447
|
+
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
2448
|
}
|
|
2250
2449
|
),
|
|
2251
|
-
children && /* @__PURE__ */ (0,
|
|
2450
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(AppText, { size: "sm", style: { color: colors.text }, children })
|
|
2252
2451
|
]
|
|
2253
2452
|
}
|
|
2254
2453
|
);
|
|
2255
2454
|
}
|
|
2256
|
-
var
|
|
2455
|
+
var styles6 = import_react_native14.StyleSheet.create({
|
|
2257
2456
|
checkbox: {
|
|
2258
2457
|
borderWidth: 0.5
|
|
2259
2458
|
}
|
|
2260
2459
|
});
|
|
2261
2460
|
|
|
2461
|
+
// src/ui/form/group.ts
|
|
2462
|
+
var toggleGroupValue = (values, optionValue, checked) => {
|
|
2463
|
+
if (checked) {
|
|
2464
|
+
return values.includes(optionValue) ? values : [...values, optionValue];
|
|
2465
|
+
}
|
|
2466
|
+
return values.filter((value) => value !== optionValue);
|
|
2467
|
+
};
|
|
2468
|
+
var isGroupOptionDisabled = (groupDisabled, optionDisabled) => {
|
|
2469
|
+
return groupDisabled || Boolean(optionDisabled);
|
|
2470
|
+
};
|
|
2471
|
+
|
|
2262
2472
|
// src/ui/form/CheckboxGroup.tsx
|
|
2263
|
-
var
|
|
2473
|
+
var import_jsx_runtime23 = require("nativewind/jsx-runtime");
|
|
2264
2474
|
function CheckboxGroup({
|
|
2265
2475
|
value = [],
|
|
2266
2476
|
onChange,
|
|
@@ -2270,18 +2480,15 @@ function CheckboxGroup({
|
|
|
2270
2480
|
}) {
|
|
2271
2481
|
const handleChange = (optionValue, checked) => {
|
|
2272
2482
|
if (!onChange) return;
|
|
2273
|
-
|
|
2274
|
-
onChange([...value, optionValue]);
|
|
2275
|
-
} else {
|
|
2276
|
-
onChange(value.filter((v) => v !== optionValue));
|
|
2277
|
-
}
|
|
2483
|
+
onChange(toggleGroupValue(value, optionValue, checked));
|
|
2278
2484
|
};
|
|
2279
|
-
|
|
2485
|
+
const isRow = direction === "row";
|
|
2486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(AppView, { row: isRow, flex: isRow, gap: 4, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
2280
2487
|
Checkbox,
|
|
2281
2488
|
{
|
|
2282
2489
|
checked: value.includes(option.value),
|
|
2283
2490
|
onChange: (checked) => handleChange(option.value, checked),
|
|
2284
|
-
disabled: disabled
|
|
2491
|
+
disabled: isGroupOptionDisabled(disabled, option.disabled),
|
|
2285
2492
|
children: option.label
|
|
2286
2493
|
},
|
|
2287
2494
|
option.value
|
|
@@ -2289,9 +2496,9 @@ function CheckboxGroup({
|
|
|
2289
2496
|
}
|
|
2290
2497
|
|
|
2291
2498
|
// src/ui/form/Radio.tsx
|
|
2292
|
-
var
|
|
2293
|
-
var
|
|
2294
|
-
var
|
|
2499
|
+
var import_react19 = require("react");
|
|
2500
|
+
var import_react_native15 = require("react-native");
|
|
2501
|
+
var import_jsx_runtime24 = require("nativewind/jsx-runtime");
|
|
2295
2502
|
function Radio({
|
|
2296
2503
|
checked,
|
|
2297
2504
|
defaultChecked,
|
|
@@ -2302,7 +2509,7 @@ function Radio({
|
|
|
2302
2509
|
testID
|
|
2303
2510
|
}) {
|
|
2304
2511
|
const colors = useThemeColors();
|
|
2305
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
2512
|
+
const [internalChecked, setInternalChecked] = (0, import_react19.useState)(defaultChecked || false);
|
|
2306
2513
|
const isChecked = checked !== void 0 ? checked : internalChecked;
|
|
2307
2514
|
const toggle = () => {
|
|
2308
2515
|
if (disabled) return;
|
|
@@ -2313,8 +2520,8 @@ function Radio({
|
|
|
2313
2520
|
onChange?.(newChecked);
|
|
2314
2521
|
};
|
|
2315
2522
|
const disabledOpacity = 0.4;
|
|
2316
|
-
return /* @__PURE__ */ (0,
|
|
2317
|
-
|
|
2523
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2524
|
+
import_react_native15.TouchableOpacity,
|
|
2318
2525
|
{
|
|
2319
2526
|
onPress: toggle,
|
|
2320
2527
|
disabled,
|
|
@@ -2323,33 +2530,33 @@ function Radio({
|
|
|
2323
2530
|
testID,
|
|
2324
2531
|
activeOpacity: 0.7,
|
|
2325
2532
|
children: [
|
|
2326
|
-
/* @__PURE__ */ (0,
|
|
2533
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2327
2534
|
AppView,
|
|
2328
2535
|
{
|
|
2329
2536
|
className: cn("w-5 h-5 rounded-full items-center justify-center", isChecked && "border-2"),
|
|
2330
2537
|
style: [
|
|
2331
|
-
|
|
2538
|
+
styles7.radio,
|
|
2332
2539
|
{
|
|
2333
2540
|
backgroundColor: colors.card,
|
|
2334
2541
|
borderColor: isChecked ? colors.primary : colors.border,
|
|
2335
2542
|
borderWidth: isChecked ? 0.5 : 0.5
|
|
2336
2543
|
}
|
|
2337
2544
|
],
|
|
2338
|
-
children: isChecked && /* @__PURE__ */ (0,
|
|
2545
|
+
children: isChecked && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
2339
2546
|
AppView,
|
|
2340
2547
|
{
|
|
2341
2548
|
className: "rounded-full",
|
|
2342
|
-
style: [
|
|
2549
|
+
style: [styles7.inner, { backgroundColor: colors.primary }]
|
|
2343
2550
|
}
|
|
2344
2551
|
)
|
|
2345
2552
|
}
|
|
2346
2553
|
),
|
|
2347
|
-
children && /* @__PURE__ */ (0,
|
|
2554
|
+
children && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(AppText, { size: "sm", style: { color: colors.text }, children })
|
|
2348
2555
|
]
|
|
2349
2556
|
}
|
|
2350
2557
|
);
|
|
2351
2558
|
}
|
|
2352
|
-
var
|
|
2559
|
+
var styles7 = import_react_native15.StyleSheet.create({
|
|
2353
2560
|
radio: {
|
|
2354
2561
|
borderWidth: 0.5
|
|
2355
2562
|
},
|
|
@@ -2360,7 +2567,7 @@ var styles6 = import_react_native14.StyleSheet.create({
|
|
|
2360
2567
|
});
|
|
2361
2568
|
|
|
2362
2569
|
// src/ui/form/RadioGroup.tsx
|
|
2363
|
-
var
|
|
2570
|
+
var import_jsx_runtime25 = require("nativewind/jsx-runtime");
|
|
2364
2571
|
function RadioGroup({
|
|
2365
2572
|
value,
|
|
2366
2573
|
onChange,
|
|
@@ -2368,12 +2575,13 @@ function RadioGroup({
|
|
|
2368
2575
|
direction = "column",
|
|
2369
2576
|
disabled = false
|
|
2370
2577
|
}) {
|
|
2371
|
-
|
|
2578
|
+
const isRow = direction === "row";
|
|
2579
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AppView, { row: isRow, flex: isRow, gap: 4, children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2372
2580
|
Radio,
|
|
2373
2581
|
{
|
|
2374
2582
|
checked: value === option.value,
|
|
2375
2583
|
onChange: () => onChange?.(option.value),
|
|
2376
|
-
disabled: disabled
|
|
2584
|
+
disabled: isGroupOptionDisabled(disabled, option.disabled),
|
|
2377
2585
|
children: option.label
|
|
2378
2586
|
},
|
|
2379
2587
|
option.value
|
|
@@ -2381,9 +2589,9 @@ function RadioGroup({
|
|
|
2381
2589
|
}
|
|
2382
2590
|
|
|
2383
2591
|
// src/ui/form/Switch.tsx
|
|
2384
|
-
var
|
|
2385
|
-
var
|
|
2386
|
-
var
|
|
2592
|
+
var import_react20 = require("react");
|
|
2593
|
+
var import_react_native16 = require("react-native");
|
|
2594
|
+
var import_jsx_runtime26 = require("nativewind/jsx-runtime");
|
|
2387
2595
|
function Switch({
|
|
2388
2596
|
checked,
|
|
2389
2597
|
defaultChecked,
|
|
@@ -2395,7 +2603,7 @@ function Switch({
|
|
|
2395
2603
|
style
|
|
2396
2604
|
}) {
|
|
2397
2605
|
const colors = useThemeColors();
|
|
2398
|
-
const [internalChecked, setInternalChecked] = (0,
|
|
2606
|
+
const [internalChecked, setInternalChecked] = (0, import_react20.useState)(defaultChecked || false);
|
|
2399
2607
|
const isChecked = checked !== void 0 ? checked : internalChecked;
|
|
2400
2608
|
const toggle = () => {
|
|
2401
2609
|
if (disabled) return;
|
|
@@ -2415,20 +2623,20 @@ function Switch({
|
|
|
2415
2623
|
};
|
|
2416
2624
|
const config = sizes[size];
|
|
2417
2625
|
const thumbPosition = isChecked ? config.width - config.thumb - config.padding : config.padding;
|
|
2418
|
-
return /* @__PURE__ */ (0,
|
|
2419
|
-
|
|
2626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2627
|
+
import_react_native16.TouchableOpacity,
|
|
2420
2628
|
{
|
|
2421
2629
|
onPress: toggle,
|
|
2422
2630
|
disabled,
|
|
2423
2631
|
className: cn(className),
|
|
2424
2632
|
testID,
|
|
2425
2633
|
activeOpacity: disabled ? 1 : 0.8,
|
|
2426
|
-
children: /* @__PURE__ */ (0,
|
|
2634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2427
2635
|
AppView,
|
|
2428
2636
|
{
|
|
2429
2637
|
className: "rounded-full",
|
|
2430
2638
|
style: [
|
|
2431
|
-
|
|
2639
|
+
styles8.track,
|
|
2432
2640
|
{
|
|
2433
2641
|
width: config.width,
|
|
2434
2642
|
height: config.height,
|
|
@@ -2437,12 +2645,12 @@ function Switch({
|
|
|
2437
2645
|
},
|
|
2438
2646
|
style
|
|
2439
2647
|
],
|
|
2440
|
-
children: /* @__PURE__ */ (0,
|
|
2648
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2441
2649
|
AppView,
|
|
2442
2650
|
{
|
|
2443
2651
|
className: "rounded-full",
|
|
2444
2652
|
style: [
|
|
2445
|
-
|
|
2653
|
+
styles8.thumb,
|
|
2446
2654
|
{
|
|
2447
2655
|
width: config.thumb,
|
|
2448
2656
|
height: config.thumb,
|
|
@@ -2461,7 +2669,7 @@ function Switch({
|
|
|
2461
2669
|
}
|
|
2462
2670
|
);
|
|
2463
2671
|
}
|
|
2464
|
-
var
|
|
2672
|
+
var styles8 = import_react_native16.StyleSheet.create({
|
|
2465
2673
|
track: {
|
|
2466
2674
|
justifyContent: "center",
|
|
2467
2675
|
padding: 2
|
|
@@ -2476,15 +2684,15 @@ var styles7 = import_react_native15.StyleSheet.create({
|
|
|
2476
2684
|
});
|
|
2477
2685
|
|
|
2478
2686
|
// src/ui/form/Slider.tsx
|
|
2479
|
-
var
|
|
2480
|
-
var
|
|
2687
|
+
var import_react22 = require("react");
|
|
2688
|
+
var import_react_native17 = require("react-native");
|
|
2481
2689
|
|
|
2482
2690
|
// src/ui/form/useFormTheme.ts
|
|
2483
|
-
var
|
|
2691
|
+
var import_react21 = require("react");
|
|
2484
2692
|
function useFormThemeColors() {
|
|
2485
2693
|
const { isDark } = useOptionalTheme();
|
|
2486
2694
|
const colors = useThemeColors();
|
|
2487
|
-
return (0,
|
|
2695
|
+
return (0, import_react21.useMemo)(
|
|
2488
2696
|
() => ({
|
|
2489
2697
|
primary: colors.primary,
|
|
2490
2698
|
primarySurface: colors.primarySurface,
|
|
@@ -2505,7 +2713,7 @@ function useFormThemeColors() {
|
|
|
2505
2713
|
}
|
|
2506
2714
|
|
|
2507
2715
|
// src/ui/form/Slider.tsx
|
|
2508
|
-
var
|
|
2716
|
+
var import_jsx_runtime27 = require("nativewind/jsx-runtime");
|
|
2509
2717
|
function Slider({
|
|
2510
2718
|
value,
|
|
2511
2719
|
defaultValue = 0,
|
|
@@ -2519,13 +2727,13 @@ function Slider({
|
|
|
2519
2727
|
className
|
|
2520
2728
|
}) {
|
|
2521
2729
|
const colors = useFormThemeColors();
|
|
2522
|
-
const [internalValue, setInternalValue] = (0,
|
|
2523
|
-
const [trackWidth, setTrackWidth] = (0,
|
|
2524
|
-
const [isDragging, setIsDragging] = (0,
|
|
2730
|
+
const [internalValue, setInternalValue] = (0, import_react22.useState)(defaultValue);
|
|
2731
|
+
const [trackWidth, setTrackWidth] = (0, import_react22.useState)(0);
|
|
2732
|
+
const [isDragging, setIsDragging] = (0, import_react22.useState)(false);
|
|
2525
2733
|
const currentValue = value !== void 0 ? value : internalValue;
|
|
2526
2734
|
const disabledOpacity = 0.4;
|
|
2527
2735
|
const progress = (currentValue - min) / (max - min) * 100;
|
|
2528
|
-
const getValueFromPosition = (0,
|
|
2736
|
+
const getValueFromPosition = (0, import_react22.useCallback)(
|
|
2529
2737
|
(position) => {
|
|
2530
2738
|
const percentage = Math.max(0, Math.min(1, position / trackWidth));
|
|
2531
2739
|
const rawValue = min + percentage * (max - min);
|
|
@@ -2534,7 +2742,7 @@ function Slider({
|
|
|
2534
2742
|
},
|
|
2535
2743
|
[trackWidth, min, max, step]
|
|
2536
2744
|
);
|
|
2537
|
-
const setValue = (0,
|
|
2745
|
+
const setValue = (0, import_react22.useCallback)(
|
|
2538
2746
|
(newValue) => {
|
|
2539
2747
|
const clampedValue = Math.min(max, Math.max(min, newValue));
|
|
2540
2748
|
if (value === void 0) {
|
|
@@ -2544,8 +2752,8 @@ function Slider({
|
|
|
2544
2752
|
},
|
|
2545
2753
|
[value, min, max, onChange]
|
|
2546
2754
|
);
|
|
2547
|
-
const panResponder = (0,
|
|
2548
|
-
|
|
2755
|
+
const panResponder = (0, import_react22.useRef)(
|
|
2756
|
+
import_react_native17.PanResponder.create({
|
|
2549
2757
|
onStartShouldSetPanResponder: () => !disabled,
|
|
2550
2758
|
onMoveShouldSetPanResponder: () => !disabled,
|
|
2551
2759
|
onPanResponderGrant: () => {
|
|
@@ -2565,7 +2773,7 @@ function Slider({
|
|
|
2565
2773
|
}
|
|
2566
2774
|
})
|
|
2567
2775
|
).current;
|
|
2568
|
-
const handleTrackPress = (0,
|
|
2776
|
+
const handleTrackPress = (0, import_react22.useCallback)(
|
|
2569
2777
|
(event) => {
|
|
2570
2778
|
if (disabled) return;
|
|
2571
2779
|
const { locationX } = event.nativeEvent;
|
|
@@ -2575,16 +2783,16 @@ function Slider({
|
|
|
2575
2783
|
},
|
|
2576
2784
|
[disabled, getValueFromPosition, setValue, onChangeEnd]
|
|
2577
2785
|
);
|
|
2578
|
-
const onLayout = (0,
|
|
2786
|
+
const onLayout = (0, import_react22.useCallback)((event) => {
|
|
2579
2787
|
setTrackWidth(event.nativeEvent.layout.width);
|
|
2580
2788
|
}, []);
|
|
2581
|
-
return /* @__PURE__ */ (0,
|
|
2582
|
-
showTooltip && isDragging && /* @__PURE__ */ (0,
|
|
2789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AppView, { className: cn("py-2", className), children: [
|
|
2790
|
+
showTooltip && isDragging && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2583
2791
|
AppView,
|
|
2584
2792
|
{
|
|
2585
2793
|
className: "absolute rounded px-2 py-1 -top-8",
|
|
2586
2794
|
style: [
|
|
2587
|
-
|
|
2795
|
+
styles9.tooltip,
|
|
2588
2796
|
{
|
|
2589
2797
|
backgroundColor: colors.surfaceMuted,
|
|
2590
2798
|
left: `${progress}%`,
|
|
@@ -2592,12 +2800,12 @@ function Slider({
|
|
|
2592
2800
|
}
|
|
2593
2801
|
],
|
|
2594
2802
|
children: [
|
|
2595
|
-
/* @__PURE__ */ (0,
|
|
2596
|
-
/* @__PURE__ */ (0,
|
|
2803
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AppText, { size: "xs", style: { color: colors.text }, children: Math.round(currentValue) }),
|
|
2804
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2597
2805
|
AppView,
|
|
2598
2806
|
{
|
|
2599
2807
|
style: [
|
|
2600
|
-
|
|
2808
|
+
styles9.tooltipArrow,
|
|
2601
2809
|
{
|
|
2602
2810
|
borderTopColor: colors.surfaceMuted
|
|
2603
2811
|
}
|
|
@@ -2607,23 +2815,23 @@ function Slider({
|
|
|
2607
2815
|
]
|
|
2608
2816
|
}
|
|
2609
2817
|
),
|
|
2610
|
-
/* @__PURE__ */ (0,
|
|
2611
|
-
|
|
2818
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
2819
|
+
import_react_native17.View,
|
|
2612
2820
|
{
|
|
2613
2821
|
onLayout,
|
|
2614
2822
|
className: "rounded-full",
|
|
2615
2823
|
style: [
|
|
2616
|
-
|
|
2824
|
+
styles9.track,
|
|
2617
2825
|
{ backgroundColor: colors.divider, opacity: disabled ? disabledOpacity : 1 }
|
|
2618
2826
|
],
|
|
2619
2827
|
onTouchEnd: handleTrackPress,
|
|
2620
2828
|
children: [
|
|
2621
|
-
/* @__PURE__ */ (0,
|
|
2829
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2622
2830
|
AppView,
|
|
2623
2831
|
{
|
|
2624
2832
|
className: "rounded-full",
|
|
2625
2833
|
style: [
|
|
2626
|
-
|
|
2834
|
+
styles9.filledTrack,
|
|
2627
2835
|
{
|
|
2628
2836
|
backgroundColor: colors.primary,
|
|
2629
2837
|
width: `${progress}%`
|
|
@@ -2631,12 +2839,12 @@ function Slider({
|
|
|
2631
2839
|
]
|
|
2632
2840
|
}
|
|
2633
2841
|
),
|
|
2634
|
-
/* @__PURE__ */ (0,
|
|
2842
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2635
2843
|
AppView,
|
|
2636
2844
|
{
|
|
2637
2845
|
className: "absolute rounded-full items-center justify-center",
|
|
2638
2846
|
style: [
|
|
2639
|
-
|
|
2847
|
+
styles9.thumb,
|
|
2640
2848
|
{
|
|
2641
2849
|
backgroundColor: colors.textInverse,
|
|
2642
2850
|
left: `${progress}%`,
|
|
@@ -2648,12 +2856,12 @@ function Slider({
|
|
|
2648
2856
|
}
|
|
2649
2857
|
],
|
|
2650
2858
|
...panResponder.panHandlers,
|
|
2651
|
-
children: /* @__PURE__ */ (0,
|
|
2859
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
2652
2860
|
AppView,
|
|
2653
2861
|
{
|
|
2654
2862
|
className: "rounded-full",
|
|
2655
2863
|
style: [
|
|
2656
|
-
|
|
2864
|
+
styles9.thumbDot,
|
|
2657
2865
|
{
|
|
2658
2866
|
backgroundColor: colors.primary
|
|
2659
2867
|
}
|
|
@@ -2667,7 +2875,7 @@ function Slider({
|
|
|
2667
2875
|
)
|
|
2668
2876
|
] });
|
|
2669
2877
|
}
|
|
2670
|
-
var
|
|
2878
|
+
var styles9 = import_react_native17.StyleSheet.create({
|
|
2671
2879
|
track: {
|
|
2672
2880
|
height: 6,
|
|
2673
2881
|
width: "100%"
|
|
@@ -2708,9 +2916,9 @@ var styles8 = import_react_native16.StyleSheet.create({
|
|
|
2708
2916
|
});
|
|
2709
2917
|
|
|
2710
2918
|
// src/ui/form/Select.tsx
|
|
2711
|
-
var
|
|
2712
|
-
var
|
|
2713
|
-
var
|
|
2919
|
+
var import_react23 = require("react");
|
|
2920
|
+
var import_react_native18 = require("react-native");
|
|
2921
|
+
var import_jsx_runtime28 = require("nativewind/jsx-runtime");
|
|
2714
2922
|
function Select({
|
|
2715
2923
|
value,
|
|
2716
2924
|
onChange,
|
|
@@ -2724,24 +2932,24 @@ function Select({
|
|
|
2724
2932
|
className
|
|
2725
2933
|
}) {
|
|
2726
2934
|
const colors = useFormThemeColors();
|
|
2727
|
-
const [visible, setVisible] = (0,
|
|
2728
|
-
const [searchKeyword, setSearchKeyword] = (0,
|
|
2729
|
-
const selectedValues = (0,
|
|
2935
|
+
const [visible, setVisible] = (0, import_react23.useState)(false);
|
|
2936
|
+
const [searchKeyword, setSearchKeyword] = (0, import_react23.useState)("");
|
|
2937
|
+
const selectedValues = (0, import_react23.useMemo)(() => {
|
|
2730
2938
|
if (multiple) {
|
|
2731
2939
|
return Array.isArray(value) ? value : [];
|
|
2732
2940
|
}
|
|
2733
2941
|
return value ? [value] : [];
|
|
2734
2942
|
}, [value, multiple]);
|
|
2735
|
-
const displayText = (0,
|
|
2943
|
+
const displayText = (0, import_react23.useMemo)(() => {
|
|
2736
2944
|
if (selectedValues.length === 0) return placeholder;
|
|
2737
2945
|
const selectedLabels = options.filter((opt) => selectedValues.includes(opt.value)).map((opt) => opt.label);
|
|
2738
2946
|
return selectedLabels.join(", ") || placeholder;
|
|
2739
2947
|
}, [selectedValues, options, placeholder]);
|
|
2740
|
-
const filteredOptions = (0,
|
|
2948
|
+
const filteredOptions = (0, import_react23.useMemo)(() => {
|
|
2741
2949
|
if (!searchable || !searchKeyword) return options;
|
|
2742
2950
|
return options.filter((opt) => opt.label.toLowerCase().includes(searchKeyword.toLowerCase()));
|
|
2743
2951
|
}, [options, searchable, searchKeyword]);
|
|
2744
|
-
const handleSelect = (0,
|
|
2952
|
+
const handleSelect = (0, import_react23.useCallback)(
|
|
2745
2953
|
(optionValue) => {
|
|
2746
2954
|
if (multiple) {
|
|
2747
2955
|
const currentValues = Array.isArray(value) ? value : [];
|
|
@@ -2754,24 +2962,24 @@ function Select({
|
|
|
2754
2962
|
},
|
|
2755
2963
|
[multiple, value, onChange]
|
|
2756
2964
|
);
|
|
2757
|
-
const handleClear = (0,
|
|
2965
|
+
const handleClear = (0, import_react23.useCallback)(
|
|
2758
2966
|
(e) => {
|
|
2759
2967
|
e.stopPropagation();
|
|
2760
2968
|
onChange?.(multiple ? [] : "");
|
|
2761
2969
|
},
|
|
2762
2970
|
[multiple, onChange]
|
|
2763
2971
|
);
|
|
2764
|
-
const handleSearch = (0,
|
|
2972
|
+
const handleSearch = (0, import_react23.useCallback)(
|
|
2765
2973
|
(text) => {
|
|
2766
2974
|
setSearchKeyword(text);
|
|
2767
2975
|
onSearch?.(text);
|
|
2768
2976
|
},
|
|
2769
2977
|
[onSearch]
|
|
2770
2978
|
);
|
|
2771
|
-
const renderOption = (0,
|
|
2979
|
+
const renderOption = (0, import_react23.useCallback)(
|
|
2772
2980
|
({ item }) => {
|
|
2773
2981
|
const isSelected = selectedValues.includes(item.value);
|
|
2774
|
-
return /* @__PURE__ */ (0,
|
|
2982
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2775
2983
|
AppPressable,
|
|
2776
2984
|
{
|
|
2777
2985
|
className: cn(
|
|
@@ -2779,22 +2987,22 @@ function Select({
|
|
|
2779
2987
|
isSelected && "bg-primary-50"
|
|
2780
2988
|
),
|
|
2781
2989
|
style: [
|
|
2782
|
-
|
|
2990
|
+
styles10.optionItem,
|
|
2783
2991
|
{ borderBottomColor: colors.divider },
|
|
2784
2992
|
isSelected && { backgroundColor: colors.primarySurface }
|
|
2785
2993
|
],
|
|
2786
2994
|
onPress: () => handleSelect(item.value),
|
|
2787
2995
|
children: [
|
|
2788
|
-
/* @__PURE__ */ (0,
|
|
2789
|
-
isSelected && /* @__PURE__ */ (0,
|
|
2996
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppText, { style: { color: isSelected ? colors.primary : colors.text }, children: item.label }),
|
|
2997
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "check", size: "sm", color: "primary-500" })
|
|
2790
2998
|
]
|
|
2791
2999
|
}
|
|
2792
3000
|
);
|
|
2793
3001
|
},
|
|
2794
3002
|
[selectedValues, handleSelect, colors]
|
|
2795
3003
|
);
|
|
2796
|
-
return /* @__PURE__ */ (0,
|
|
2797
|
-
/* @__PURE__ */ (0,
|
|
3004
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_jsx_runtime28.Fragment, { children: [
|
|
3005
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2798
3006
|
AppPressable,
|
|
2799
3007
|
{
|
|
2800
3008
|
className: cn(
|
|
@@ -2802,11 +3010,11 @@ function Select({
|
|
|
2802
3010
|
disabled ? "opacity-60" : "",
|
|
2803
3011
|
className
|
|
2804
3012
|
),
|
|
2805
|
-
style: [
|
|
3013
|
+
style: [styles10.trigger, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
2806
3014
|
disabled,
|
|
2807
3015
|
onPress: () => setVisible(true),
|
|
2808
3016
|
children: [
|
|
2809
|
-
/* @__PURE__ */ (0,
|
|
3017
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2810
3018
|
AppText,
|
|
2811
3019
|
{
|
|
2812
3020
|
className: "flex-1",
|
|
@@ -2815,46 +3023,46 @@ function Select({
|
|
|
2815
3023
|
children: displayText
|
|
2816
3024
|
}
|
|
2817
3025
|
),
|
|
2818
|
-
/* @__PURE__ */ (0,
|
|
2819
|
-
clearable && selectedValues.length > 0 && !disabled && /* @__PURE__ */ (0,
|
|
2820
|
-
/* @__PURE__ */ (0,
|
|
3026
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(import_react_native18.View, { className: "flex-row items-center", children: [
|
|
3027
|
+
clearable && selectedValues.length > 0 && !disabled && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native18.TouchableOpacity, { onPress: handleClear, className: "mr-2 p-1", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "close", size: "sm", color: colors.icon }) }),
|
|
3028
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "keyboard-arrow-down", size: "md", color: colors.icon })
|
|
2821
3029
|
] })
|
|
2822
3030
|
]
|
|
2823
3031
|
}
|
|
2824
3032
|
),
|
|
2825
|
-
/* @__PURE__ */ (0,
|
|
2826
|
-
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3034
|
+
import_react_native18.Modal,
|
|
2827
3035
|
{
|
|
2828
3036
|
visible,
|
|
2829
3037
|
transparent: true,
|
|
2830
3038
|
animationType: "slide",
|
|
2831
3039
|
onRequestClose: () => setVisible(false),
|
|
2832
|
-
children: /* @__PURE__ */ (0,
|
|
3040
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppView, { className: "flex-1", style: { backgroundColor: colors.overlay }, justify: "end", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2833
3041
|
AppView,
|
|
2834
3042
|
{
|
|
2835
3043
|
className: "rounded-t-2xl max-h-[70%]",
|
|
2836
3044
|
style: { backgroundColor: colors.surface },
|
|
2837
3045
|
children: [
|
|
2838
|
-
/* @__PURE__ */ (0,
|
|
3046
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2839
3047
|
AppView,
|
|
2840
3048
|
{
|
|
2841
3049
|
row: true,
|
|
2842
3050
|
between: true,
|
|
2843
3051
|
items: "center",
|
|
2844
3052
|
className: "px-4 py-3",
|
|
2845
|
-
style: [
|
|
3053
|
+
style: [styles10.header, { borderBottomColor: colors.divider }],
|
|
2846
3054
|
children: [
|
|
2847
|
-
/* @__PURE__ */ (0,
|
|
2848
|
-
/* @__PURE__ */ (0,
|
|
3055
|
+
/* @__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" }),
|
|
3056
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native18.TouchableOpacity, { onPress: () => setVisible(false), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "close", size: "md", color: colors.icon }) })
|
|
2849
3057
|
]
|
|
2850
3058
|
}
|
|
2851
3059
|
),
|
|
2852
|
-
searchable && /* @__PURE__ */ (0,
|
|
3060
|
+
searchable && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
2853
3061
|
AppView,
|
|
2854
3062
|
{
|
|
2855
3063
|
className: "px-4 py-3",
|
|
2856
|
-
style: [
|
|
2857
|
-
children: /* @__PURE__ */ (0,
|
|
3064
|
+
style: [styles10.searchBox, { borderBottomColor: colors.divider }],
|
|
3065
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2858
3066
|
AppView,
|
|
2859
3067
|
{
|
|
2860
3068
|
row: true,
|
|
@@ -2862,9 +3070,9 @@ function Select({
|
|
|
2862
3070
|
className: "px-3 py-2 rounded-lg",
|
|
2863
3071
|
style: { backgroundColor: colors.surfaceMuted },
|
|
2864
3072
|
children: [
|
|
2865
|
-
/* @__PURE__ */ (0,
|
|
2866
|
-
/* @__PURE__ */ (0,
|
|
2867
|
-
|
|
3073
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native18.View, { style: { marginRight: 8 }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "search", size: "sm", color: colors.icon }) }),
|
|
3074
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3075
|
+
import_react_native18.TextInput,
|
|
2868
3076
|
{
|
|
2869
3077
|
className: "flex-1 text-base",
|
|
2870
3078
|
style: { color: colors.text },
|
|
@@ -2875,42 +3083,42 @@ function Select({
|
|
|
2875
3083
|
autoFocus: true
|
|
2876
3084
|
}
|
|
2877
3085
|
),
|
|
2878
|
-
searchKeyword.length > 0 && /* @__PURE__ */ (0,
|
|
3086
|
+
searchKeyword.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_native18.TouchableOpacity, { onPress: () => setSearchKeyword(""), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, { name: "close", size: "sm", color: colors.icon }) })
|
|
2879
3087
|
]
|
|
2880
3088
|
}
|
|
2881
3089
|
)
|
|
2882
3090
|
}
|
|
2883
3091
|
),
|
|
2884
|
-
/* @__PURE__ */ (0,
|
|
2885
|
-
|
|
3092
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3093
|
+
import_react_native18.FlatList,
|
|
2886
3094
|
{
|
|
2887
3095
|
data: filteredOptions,
|
|
2888
3096
|
keyExtractor: (item) => item.value,
|
|
2889
3097
|
renderItem: renderOption,
|
|
2890
|
-
ListEmptyComponent: /* @__PURE__ */ (0,
|
|
3098
|
+
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" }) })
|
|
2891
3099
|
}
|
|
2892
3100
|
),
|
|
2893
|
-
multiple && /* @__PURE__ */ (0,
|
|
3101
|
+
multiple && /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
2894
3102
|
AppView,
|
|
2895
3103
|
{
|
|
2896
3104
|
row: true,
|
|
2897
3105
|
between: true,
|
|
2898
3106
|
items: "center",
|
|
2899
3107
|
className: "px-4 py-3",
|
|
2900
|
-
style: [
|
|
3108
|
+
style: [styles10.footer, { borderTopColor: colors.divider }],
|
|
2901
3109
|
children: [
|
|
2902
|
-
/* @__PURE__ */ (0,
|
|
3110
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(AppText, { style: { color: colors.textMuted }, children: [
|
|
2903
3111
|
"\u5DF2\u9009\u62E9 ",
|
|
2904
3112
|
selectedValues.length,
|
|
2905
3113
|
" \u9879"
|
|
2906
3114
|
] }),
|
|
2907
|
-
/* @__PURE__ */ (0,
|
|
2908
|
-
|
|
3115
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
|
|
3116
|
+
import_react_native18.TouchableOpacity,
|
|
2909
3117
|
{
|
|
2910
3118
|
className: "px-4 py-2 rounded-lg",
|
|
2911
3119
|
style: { backgroundColor: colors.primary },
|
|
2912
3120
|
onPress: () => setVisible(false),
|
|
2913
|
-
children: /* @__PURE__ */ (0,
|
|
3121
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(AppText, { className: "font-medium", style: { color: colors.textInverse }, children: "\u786E\u5B9A" })
|
|
2914
3122
|
}
|
|
2915
3123
|
)
|
|
2916
3124
|
]
|
|
@@ -2923,7 +3131,7 @@ function Select({
|
|
|
2923
3131
|
)
|
|
2924
3132
|
] });
|
|
2925
3133
|
}
|
|
2926
|
-
var
|
|
3134
|
+
var styles10 = import_react_native18.StyleSheet.create({
|
|
2927
3135
|
trigger: {
|
|
2928
3136
|
borderWidth: 0.5
|
|
2929
3137
|
},
|
|
@@ -2942,9 +3150,9 @@ var styles9 = import_react_native17.StyleSheet.create({
|
|
|
2942
3150
|
});
|
|
2943
3151
|
|
|
2944
3152
|
// src/ui/form/DatePicker.tsx
|
|
2945
|
-
var
|
|
2946
|
-
var
|
|
2947
|
-
var
|
|
3153
|
+
var import_react24 = require("react");
|
|
3154
|
+
var import_react_native19 = require("react-native");
|
|
3155
|
+
var import_jsx_runtime29 = require("nativewind/jsx-runtime");
|
|
2948
3156
|
function PickerColumn({
|
|
2949
3157
|
title,
|
|
2950
3158
|
values,
|
|
@@ -2955,27 +3163,27 @@ function PickerColumn({
|
|
|
2955
3163
|
showDivider = false,
|
|
2956
3164
|
colors
|
|
2957
3165
|
}) {
|
|
2958
|
-
return /* @__PURE__ */ (0,
|
|
3166
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
2959
3167
|
AppView,
|
|
2960
3168
|
{
|
|
2961
3169
|
flex: true,
|
|
2962
3170
|
style: [
|
|
2963
|
-
showDivider &&
|
|
3171
|
+
showDivider && styles11.column,
|
|
2964
3172
|
showDivider ? { borderRightColor: colors.divider } : void 0
|
|
2965
3173
|
],
|
|
2966
3174
|
children: [
|
|
2967
|
-
/* @__PURE__ */ (0,
|
|
2968
|
-
/* @__PURE__ */ (0,
|
|
3175
|
+
/* @__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 }) }),
|
|
3176
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppView, { className: "flex-1", children: values.map((value) => {
|
|
2969
3177
|
const selected = selectedValue === value;
|
|
2970
3178
|
const disabled = isDisabled(value);
|
|
2971
|
-
return /* @__PURE__ */ (0,
|
|
2972
|
-
|
|
3179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3180
|
+
import_react_native19.TouchableOpacity,
|
|
2973
3181
|
{
|
|
2974
3182
|
className: cn("py-2 items-center", selected && "bg-primary-50"),
|
|
2975
3183
|
style: selected ? { backgroundColor: colors.primarySurface } : void 0,
|
|
2976
3184
|
disabled,
|
|
2977
3185
|
onPress: () => onSelect(value),
|
|
2978
|
-
children: /* @__PURE__ */ (0,
|
|
3186
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
2979
3187
|
AppText,
|
|
2980
3188
|
{
|
|
2981
3189
|
className: cn(selected ? "font-semibold" : void 0, disabled && "opacity-30"),
|
|
@@ -3004,16 +3212,16 @@ function DatePicker({
|
|
|
3004
3212
|
className
|
|
3005
3213
|
}) {
|
|
3006
3214
|
const colors = useFormThemeColors();
|
|
3007
|
-
const [visible, setVisible] = (0,
|
|
3008
|
-
const [tempDate, setTempDate] = (0,
|
|
3009
|
-
const displayText = (0,
|
|
3215
|
+
const [visible, setVisible] = (0, import_react24.useState)(false);
|
|
3216
|
+
const [tempDate, setTempDate] = (0, import_react24.useState)(value || /* @__PURE__ */ new Date());
|
|
3217
|
+
const displayText = (0, import_react24.useMemo)(() => {
|
|
3010
3218
|
return value ? formatDate(value, format) : placeholder;
|
|
3011
3219
|
}, [value, format, placeholder]);
|
|
3012
|
-
const handleConfirm = (0,
|
|
3220
|
+
const handleConfirm = (0, import_react24.useCallback)(() => {
|
|
3013
3221
|
onChange?.(tempDate);
|
|
3014
3222
|
setVisible(false);
|
|
3015
3223
|
}, [tempDate, onChange]);
|
|
3016
|
-
const years = (0,
|
|
3224
|
+
const years = (0, import_react24.useMemo)(() => {
|
|
3017
3225
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
3018
3226
|
const arr = [];
|
|
3019
3227
|
for (let i = currentYear - 50; i <= currentYear + 50; i++) {
|
|
@@ -3021,16 +3229,16 @@ function DatePicker({
|
|
|
3021
3229
|
}
|
|
3022
3230
|
return arr;
|
|
3023
3231
|
}, []);
|
|
3024
|
-
const months = (0,
|
|
3232
|
+
const months = (0, import_react24.useMemo)(() => {
|
|
3025
3233
|
return Array.from({ length: 12 }, (_, i) => i + 1);
|
|
3026
3234
|
}, []);
|
|
3027
|
-
const days = (0,
|
|
3235
|
+
const days = (0, import_react24.useMemo)(() => {
|
|
3028
3236
|
const year = tempDate.getFullYear();
|
|
3029
3237
|
const month = tempDate.getMonth();
|
|
3030
3238
|
const daysInMonth = new Date(year, month + 1, 0).getDate();
|
|
3031
3239
|
return Array.from({ length: daysInMonth }, (_, i) => i + 1);
|
|
3032
3240
|
}, [tempDate]);
|
|
3033
|
-
const isDateDisabled = (0,
|
|
3241
|
+
const isDateDisabled = (0, import_react24.useCallback)(
|
|
3034
3242
|
(year, month, day) => {
|
|
3035
3243
|
const date = new Date(year, month - 1, day);
|
|
3036
3244
|
if (minDate && date < minDate) return true;
|
|
@@ -3039,7 +3247,7 @@ function DatePicker({
|
|
|
3039
3247
|
},
|
|
3040
3248
|
[minDate, maxDate]
|
|
3041
3249
|
);
|
|
3042
|
-
const updateTempDate = (0,
|
|
3250
|
+
const updateTempDate = (0, import_react24.useCallback)(
|
|
3043
3251
|
(year, month, day) => {
|
|
3044
3252
|
const newDate = new Date(tempDate);
|
|
3045
3253
|
if (year !== void 0) newDate.setFullYear(year);
|
|
@@ -3049,8 +3257,8 @@ function DatePicker({
|
|
|
3049
3257
|
},
|
|
3050
3258
|
[tempDate]
|
|
3051
3259
|
);
|
|
3052
|
-
return /* @__PURE__ */ (0,
|
|
3053
|
-
/* @__PURE__ */ (0,
|
|
3260
|
+
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
|
|
3261
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3054
3262
|
AppPressable,
|
|
3055
3263
|
{
|
|
3056
3264
|
className: cn(
|
|
@@ -3058,14 +3266,14 @@ function DatePicker({
|
|
|
3058
3266
|
disabled ? "opacity-60" : "",
|
|
3059
3267
|
className
|
|
3060
3268
|
),
|
|
3061
|
-
style: [
|
|
3269
|
+
style: [styles11.trigger, { backgroundColor: colors.surface, borderColor: colors.border }],
|
|
3062
3270
|
disabled,
|
|
3063
3271
|
onPress: () => {
|
|
3064
3272
|
setTempDate(value || /* @__PURE__ */ new Date());
|
|
3065
3273
|
setVisible(true);
|
|
3066
3274
|
},
|
|
3067
3275
|
children: [
|
|
3068
|
-
/* @__PURE__ */ (0,
|
|
3276
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3069
3277
|
AppText,
|
|
3070
3278
|
{
|
|
3071
3279
|
className: "flex-1",
|
|
@@ -3074,36 +3282,36 @@ function DatePicker({
|
|
|
3074
3282
|
children: displayText
|
|
3075
3283
|
}
|
|
3076
3284
|
),
|
|
3077
|
-
/* @__PURE__ */ (0,
|
|
3285
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Icon, { name: "calendar-today", size: "md", color: colors.icon })
|
|
3078
3286
|
]
|
|
3079
3287
|
}
|
|
3080
3288
|
),
|
|
3081
|
-
/* @__PURE__ */ (0,
|
|
3082
|
-
|
|
3289
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3290
|
+
import_react_native19.Modal,
|
|
3083
3291
|
{
|
|
3084
3292
|
visible,
|
|
3085
3293
|
transparent: true,
|
|
3086
3294
|
animationType: "slide",
|
|
3087
3295
|
onRequestClose: () => setVisible(false),
|
|
3088
|
-
children: /* @__PURE__ */ (0,
|
|
3089
|
-
/* @__PURE__ */ (0,
|
|
3296
|
+
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: [
|
|
3297
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3090
3298
|
AppView,
|
|
3091
3299
|
{
|
|
3092
3300
|
row: true,
|
|
3093
3301
|
between: true,
|
|
3094
3302
|
items: "center",
|
|
3095
3303
|
className: "px-4 py-3",
|
|
3096
|
-
style: [
|
|
3304
|
+
style: [styles11.header, { borderBottomColor: colors.divider }],
|
|
3097
3305
|
children: [
|
|
3098
|
-
/* @__PURE__ */ (0,
|
|
3099
|
-
/* @__PURE__ */ (0,
|
|
3100
|
-
/* @__PURE__ */ (0,
|
|
3306
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native19.TouchableOpacity, { onPress: () => setVisible(false), children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.textMuted }, children: "\u53D6\u6D88" }) }),
|
|
3307
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: "\u9009\u62E9\u65E5\u671F" }),
|
|
3308
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_react_native19.TouchableOpacity, { onPress: handleConfirm, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.primary }, className: "font-medium", children: "\u786E\u5B9A" }) })
|
|
3101
3309
|
]
|
|
3102
3310
|
}
|
|
3103
3311
|
),
|
|
3104
|
-
/* @__PURE__ */ (0,
|
|
3105
|
-
/* @__PURE__ */ (0,
|
|
3106
|
-
/* @__PURE__ */ (0,
|
|
3312
|
+
/* @__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") }) }),
|
|
3313
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(AppView, { row: true, className: "h-48", children: [
|
|
3314
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3107
3315
|
PickerColumn,
|
|
3108
3316
|
{
|
|
3109
3317
|
title: "\u5E74",
|
|
@@ -3115,7 +3323,7 @@ function DatePicker({
|
|
|
3115
3323
|
showDivider: true
|
|
3116
3324
|
}
|
|
3117
3325
|
),
|
|
3118
|
-
/* @__PURE__ */ (0,
|
|
3326
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3119
3327
|
PickerColumn,
|
|
3120
3328
|
{
|
|
3121
3329
|
title: "\u6708",
|
|
@@ -3128,7 +3336,7 @@ function DatePicker({
|
|
|
3128
3336
|
showDivider: true
|
|
3129
3337
|
}
|
|
3130
3338
|
),
|
|
3131
|
-
/* @__PURE__ */ (0,
|
|
3339
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3132
3340
|
PickerColumn,
|
|
3133
3341
|
{
|
|
3134
3342
|
title: "\u65E5",
|
|
@@ -3140,38 +3348,38 @@ function DatePicker({
|
|
|
3140
3348
|
}
|
|
3141
3349
|
)
|
|
3142
3350
|
] }),
|
|
3143
|
-
/* @__PURE__ */ (0,
|
|
3351
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
|
|
3144
3352
|
AppView,
|
|
3145
3353
|
{
|
|
3146
3354
|
row: true,
|
|
3147
3355
|
className: "px-4 py-3 gap-2",
|
|
3148
|
-
style: [
|
|
3356
|
+
style: [styles11.footer, { borderTopColor: colors.divider }],
|
|
3149
3357
|
children: [
|
|
3150
|
-
/* @__PURE__ */ (0,
|
|
3151
|
-
|
|
3358
|
+
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3359
|
+
import_react_native19.TouchableOpacity,
|
|
3152
3360
|
{
|
|
3153
3361
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3154
3362
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3155
3363
|
onPress: () => setTempDate(/* @__PURE__ */ new Date()),
|
|
3156
|
-
children: /* @__PURE__ */ (0,
|
|
3364
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.text }, children: "\u4ECA\u5929" })
|
|
3157
3365
|
}
|
|
3158
3366
|
),
|
|
3159
|
-
minDate && /* @__PURE__ */ (0,
|
|
3160
|
-
|
|
3367
|
+
minDate && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3368
|
+
import_react_native19.TouchableOpacity,
|
|
3161
3369
|
{
|
|
3162
3370
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3163
3371
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3164
3372
|
onPress: () => setTempDate(minDate),
|
|
3165
|
-
children: /* @__PURE__ */ (0,
|
|
3373
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.text }, children: "\u6700\u65E9" })
|
|
3166
3374
|
}
|
|
3167
3375
|
),
|
|
3168
|
-
maxDate && /* @__PURE__ */ (0,
|
|
3169
|
-
|
|
3376
|
+
maxDate && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3377
|
+
import_react_native19.TouchableOpacity,
|
|
3170
3378
|
{
|
|
3171
3379
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3172
3380
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3173
3381
|
onPress: () => setTempDate(maxDate),
|
|
3174
|
-
children: /* @__PURE__ */ (0,
|
|
3382
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(AppText, { style: { color: colors.text }, children: "\u6700\u665A" })
|
|
3175
3383
|
}
|
|
3176
3384
|
)
|
|
3177
3385
|
]
|
|
@@ -3182,7 +3390,7 @@ function DatePicker({
|
|
|
3182
3390
|
)
|
|
3183
3391
|
] });
|
|
3184
3392
|
}
|
|
3185
|
-
var
|
|
3393
|
+
var styles11 = import_react_native19.StyleSheet.create({
|
|
3186
3394
|
trigger: {
|
|
3187
3395
|
borderWidth: 0.5
|
|
3188
3396
|
},
|
|
@@ -3198,7 +3406,7 @@ var styles10 = import_react_native18.StyleSheet.create({
|
|
|
3198
3406
|
});
|
|
3199
3407
|
|
|
3200
3408
|
// src/ui/form/FormItem.tsx
|
|
3201
|
-
var
|
|
3409
|
+
var import_jsx_runtime30 = require("nativewind/jsx-runtime");
|
|
3202
3410
|
function FormItem({
|
|
3203
3411
|
name: _name,
|
|
3204
3412
|
label,
|
|
@@ -3210,91 +3418,100 @@ function FormItem({
|
|
|
3210
3418
|
labelClassName
|
|
3211
3419
|
}) {
|
|
3212
3420
|
const colors = useThemeColors();
|
|
3213
|
-
return /* @__PURE__ */ (0,
|
|
3214
|
-
label && /* @__PURE__ */ (0,
|
|
3215
|
-
/* @__PURE__ */ (0,
|
|
3216
|
-
required && /* @__PURE__ */ (0,
|
|
3421
|
+
return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AppView, { className: cn("mb-4", className), children: [
|
|
3422
|
+
label && /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(AppView, { row: true, items: "center", gap: 1, className: cn("mb-2", labelClassName), children: [
|
|
3423
|
+
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { size: "sm", weight: "medium", style: { color: colors.textSecondary }, children: label }),
|
|
3424
|
+
required && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { color: "error-500", children: "*" })
|
|
3217
3425
|
] }),
|
|
3218
3426
|
children,
|
|
3219
|
-
error && /* @__PURE__ */ (0,
|
|
3220
|
-
help && !error && /* @__PURE__ */ (0,
|
|
3427
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { size: "sm", color: "error-500", className: "mt-1", children: error }),
|
|
3428
|
+
help && !error && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(AppText, { size: "sm", className: "mt-1", style: { color: colors.textMuted }, children: help })
|
|
3221
3429
|
] });
|
|
3222
3430
|
}
|
|
3223
3431
|
|
|
3224
3432
|
// src/ui/form/useForm.ts
|
|
3225
|
-
var
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
const
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3433
|
+
var import_react25 = require("react");
|
|
3434
|
+
var getIssuePath = (issue) => issue.path.map(String).join(".");
|
|
3435
|
+
var getFieldError = (issues, name) => {
|
|
3436
|
+
const exactIssue = issues.find((issue) => getIssuePath(issue) === name);
|
|
3437
|
+
if (exactIssue) return exactIssue.message;
|
|
3438
|
+
const nestedIssue = issues.find((issue) => issue.path[0] === name);
|
|
3439
|
+
return nestedIssue?.message;
|
|
3440
|
+
};
|
|
3441
|
+
var buildFormErrors = (issues) => {
|
|
3442
|
+
return issues.reduce((acc, issue) => {
|
|
3443
|
+
const path = getIssuePath(issue);
|
|
3444
|
+
acc[path || "root"] = issue.message;
|
|
3445
|
+
return acc;
|
|
3446
|
+
}, {});
|
|
3447
|
+
};
|
|
3448
|
+
function useForm({ schema, defaultValues }) {
|
|
3449
|
+
const [values, setValues] = (0, import_react25.useState)(defaultValues);
|
|
3450
|
+
const [errors, setErrors] = (0, import_react25.useState)({});
|
|
3451
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react25.useState)(false);
|
|
3452
|
+
const isDirty = (0, import_react25.useMemo)(() => {
|
|
3234
3453
|
return JSON.stringify(values) !== JSON.stringify(defaultValues);
|
|
3235
3454
|
}, [values, defaultValues]);
|
|
3236
|
-
const isValid = (0,
|
|
3455
|
+
const isValid = (0, import_react25.useMemo)(() => {
|
|
3237
3456
|
return Object.keys(errors).length === 0;
|
|
3238
3457
|
}, [errors]);
|
|
3239
|
-
const
|
|
3240
|
-
setValues((prev) => ({ ...prev, [name]: value }));
|
|
3458
|
+
const clearFieldError = (0, import_react25.useCallback)((name) => {
|
|
3241
3459
|
setErrors((prev) => {
|
|
3460
|
+
if (!(name in prev)) return prev;
|
|
3242
3461
|
const next = { ...prev };
|
|
3243
3462
|
delete next[name];
|
|
3244
3463
|
return next;
|
|
3245
3464
|
});
|
|
3246
3465
|
}, []);
|
|
3247
|
-
const
|
|
3466
|
+
const setValue = (0, import_react25.useCallback)(
|
|
3467
|
+
(name, value) => {
|
|
3468
|
+
setValues((prev) => ({ ...prev, [name]: value }));
|
|
3469
|
+
clearFieldError(name);
|
|
3470
|
+
},
|
|
3471
|
+
[clearFieldError]
|
|
3472
|
+
);
|
|
3473
|
+
const getValue = (0, import_react25.useCallback)(
|
|
3248
3474
|
(name) => {
|
|
3249
3475
|
return values[name];
|
|
3250
3476
|
},
|
|
3251
3477
|
[values]
|
|
3252
3478
|
);
|
|
3253
|
-
const validateField = (0,
|
|
3479
|
+
const validateField = (0, import_react25.useCallback)(
|
|
3254
3480
|
async (name) => {
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
return true;
|
|
3265
|
-
}
|
|
3481
|
+
const fieldName = name;
|
|
3482
|
+
const result = await schema.safeParseAsync(values);
|
|
3483
|
+
if (result.success) {
|
|
3484
|
+
clearFieldError(fieldName);
|
|
3485
|
+
return true;
|
|
3486
|
+
}
|
|
3487
|
+
const errorMessage = getFieldError(result.error.issues, fieldName);
|
|
3488
|
+
if (!errorMessage) {
|
|
3489
|
+
clearFieldError(fieldName);
|
|
3266
3490
|
return true;
|
|
3267
|
-
} catch (error) {
|
|
3268
|
-
setErrors((prev) => ({
|
|
3269
|
-
...prev,
|
|
3270
|
-
[name]: error.errors?.[0]?.message || "\u9A8C\u8BC1\u5931\u8D25"
|
|
3271
|
-
}));
|
|
3272
|
-
return false;
|
|
3273
3491
|
}
|
|
3492
|
+
setErrors((prev) => ({
|
|
3493
|
+
...prev,
|
|
3494
|
+
[fieldName]: errorMessage
|
|
3495
|
+
}));
|
|
3496
|
+
return false;
|
|
3274
3497
|
},
|
|
3275
|
-
[schema, values]
|
|
3498
|
+
[schema, values, clearFieldError]
|
|
3276
3499
|
);
|
|
3277
|
-
const validate = (0,
|
|
3278
|
-
|
|
3279
|
-
|
|
3500
|
+
const validate = (0, import_react25.useCallback)(async () => {
|
|
3501
|
+
const result = await schema.safeParseAsync(values);
|
|
3502
|
+
if (result.success) {
|
|
3280
3503
|
setErrors({});
|
|
3281
3504
|
return true;
|
|
3282
|
-
} catch (error) {
|
|
3283
|
-
const formErrors = {};
|
|
3284
|
-
error.errors?.forEach((err) => {
|
|
3285
|
-
const path = err.path.join(".");
|
|
3286
|
-
formErrors[path] = err.message;
|
|
3287
|
-
});
|
|
3288
|
-
setErrors(formErrors);
|
|
3289
|
-
return false;
|
|
3290
3505
|
}
|
|
3506
|
+
setErrors(buildFormErrors(result.error.issues));
|
|
3507
|
+
return false;
|
|
3291
3508
|
}, [schema, values]);
|
|
3292
|
-
const reset = (0,
|
|
3509
|
+
const reset = (0, import_react25.useCallback)(() => {
|
|
3293
3510
|
setValues(defaultValues);
|
|
3294
3511
|
setErrors({});
|
|
3295
3512
|
setIsSubmitting(false);
|
|
3296
3513
|
}, [defaultValues]);
|
|
3297
|
-
const handleSubmit = (0,
|
|
3514
|
+
const handleSubmit = (0, import_react25.useCallback)(
|
|
3298
3515
|
async (onSubmit) => {
|
|
3299
3516
|
const valid = await validate();
|
|
3300
3517
|
if (!valid) return;
|
|
@@ -3323,29 +3540,54 @@ function useForm({
|
|
|
3323
3540
|
}
|
|
3324
3541
|
|
|
3325
3542
|
// src/ui/hooks/useToggle.ts
|
|
3326
|
-
var
|
|
3543
|
+
var import_react26 = require("react");
|
|
3327
3544
|
function useToggle(defaultValue = false) {
|
|
3328
|
-
const [value, setValue] = (0,
|
|
3329
|
-
const toggle = (0,
|
|
3545
|
+
const [value, setValue] = (0, import_react26.useState)(defaultValue);
|
|
3546
|
+
const toggle = (0, import_react26.useCallback)(() => {
|
|
3330
3547
|
setValue((v) => !v);
|
|
3331
3548
|
}, []);
|
|
3332
|
-
const set = (0,
|
|
3549
|
+
const set = (0, import_react26.useCallback)((newValue) => {
|
|
3333
3550
|
setValue(newValue);
|
|
3334
3551
|
}, []);
|
|
3335
|
-
const setTrue = (0,
|
|
3552
|
+
const setTrue = (0, import_react26.useCallback)(() => {
|
|
3336
3553
|
setValue(true);
|
|
3337
3554
|
}, []);
|
|
3338
|
-
const setFalse = (0,
|
|
3555
|
+
const setFalse = (0, import_react26.useCallback)(() => {
|
|
3339
3556
|
setValue(false);
|
|
3340
3557
|
}, []);
|
|
3341
3558
|
return [value, { toggle, set, setTrue, setFalse }];
|
|
3342
3559
|
}
|
|
3343
3560
|
|
|
3561
|
+
// src/ui/hooks/usePageDrawer.ts
|
|
3562
|
+
var import_react27 = require("react");
|
|
3563
|
+
function usePageDrawer(defaultVisible = false) {
|
|
3564
|
+
const [visible, setVisibleState] = (0, import_react27.useState)(defaultVisible);
|
|
3565
|
+
const open = (0, import_react27.useCallback)(() => {
|
|
3566
|
+
setVisibleState(true);
|
|
3567
|
+
}, []);
|
|
3568
|
+
const close = (0, import_react27.useCallback)(() => {
|
|
3569
|
+
setVisibleState(false);
|
|
3570
|
+
}, []);
|
|
3571
|
+
const toggle = (0, import_react27.useCallback)(() => {
|
|
3572
|
+
setVisibleState((current) => !current);
|
|
3573
|
+
}, []);
|
|
3574
|
+
const setVisible = (0, import_react27.useCallback)((nextVisible) => {
|
|
3575
|
+
setVisibleState(nextVisible);
|
|
3576
|
+
}, []);
|
|
3577
|
+
return {
|
|
3578
|
+
visible,
|
|
3579
|
+
open,
|
|
3580
|
+
close,
|
|
3581
|
+
toggle,
|
|
3582
|
+
setVisible
|
|
3583
|
+
};
|
|
3584
|
+
}
|
|
3585
|
+
|
|
3344
3586
|
// src/ui/hooks/useDebounce.ts
|
|
3345
|
-
var
|
|
3587
|
+
var import_react28 = require("react");
|
|
3346
3588
|
function useDebounce(value, delay = 500) {
|
|
3347
|
-
const [debouncedValue, setDebouncedValue] = (0,
|
|
3348
|
-
(0,
|
|
3589
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react28.useState)(value);
|
|
3590
|
+
(0, import_react28.useEffect)(() => {
|
|
3349
3591
|
const timer = setTimeout(() => {
|
|
3350
3592
|
setDebouncedValue(value);
|
|
3351
3593
|
}, delay);
|
|
@@ -3357,11 +3599,11 @@ function useDebounce(value, delay = 500) {
|
|
|
3357
3599
|
}
|
|
3358
3600
|
|
|
3359
3601
|
// src/ui/hooks/useThrottle.ts
|
|
3360
|
-
var
|
|
3602
|
+
var import_react29 = require("react");
|
|
3361
3603
|
function useThrottle(value, delay = 200) {
|
|
3362
|
-
const [throttledValue, setThrottledValue] = (0,
|
|
3363
|
-
const lastUpdatedRef = (0,
|
|
3364
|
-
(0,
|
|
3604
|
+
const [throttledValue, setThrottledValue] = (0, import_react29.useState)(value);
|
|
3605
|
+
const lastUpdatedRef = (0, import_react29.useRef)(Date.now());
|
|
3606
|
+
(0, import_react29.useEffect)(() => {
|
|
3365
3607
|
const now = Date.now();
|
|
3366
3608
|
const timeElapsed = now - lastUpdatedRef.current;
|
|
3367
3609
|
if (timeElapsed >= delay) {
|
|
@@ -3382,12 +3624,12 @@ function useThrottle(value, delay = 200) {
|
|
|
3382
3624
|
}
|
|
3383
3625
|
|
|
3384
3626
|
// src/ui/hooks/useKeyboard.ts
|
|
3385
|
-
var
|
|
3386
|
-
var
|
|
3627
|
+
var import_react30 = require("react");
|
|
3628
|
+
var import_react_native20 = require("react-native");
|
|
3387
3629
|
function useKeyboard() {
|
|
3388
|
-
const [visible, setVisible] = (0,
|
|
3389
|
-
const [height, setHeight] = (0,
|
|
3390
|
-
(0,
|
|
3630
|
+
const [visible, setVisible] = (0, import_react30.useState)(false);
|
|
3631
|
+
const [height, setHeight] = (0, import_react30.useState)(0);
|
|
3632
|
+
(0, import_react30.useEffect)(() => {
|
|
3391
3633
|
const handleKeyboardWillShow = (event) => {
|
|
3392
3634
|
setVisible(true);
|
|
3393
3635
|
setHeight(event.endCoordinates.height);
|
|
@@ -3404,31 +3646,31 @@ function useKeyboard() {
|
|
|
3404
3646
|
setVisible(false);
|
|
3405
3647
|
setHeight(0);
|
|
3406
3648
|
};
|
|
3407
|
-
const willShowSub =
|
|
3408
|
-
|
|
3409
|
-
|
|
3649
|
+
const willShowSub = import_react_native20.Keyboard.addListener(
|
|
3650
|
+
import_react_native20.Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow",
|
|
3651
|
+
import_react_native20.Platform.OS === "ios" ? handleKeyboardWillShow : handleKeyboardDidShow
|
|
3410
3652
|
);
|
|
3411
|
-
const willHideSub =
|
|
3412
|
-
|
|
3413
|
-
|
|
3653
|
+
const willHideSub = import_react_native20.Keyboard.addListener(
|
|
3654
|
+
import_react_native20.Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide",
|
|
3655
|
+
import_react_native20.Platform.OS === "ios" ? handleKeyboardWillHide : handleKeyboardDidHide
|
|
3414
3656
|
);
|
|
3415
3657
|
return () => {
|
|
3416
3658
|
willShowSub.remove();
|
|
3417
3659
|
willHideSub.remove();
|
|
3418
3660
|
};
|
|
3419
3661
|
}, []);
|
|
3420
|
-
const dismiss = (0,
|
|
3421
|
-
|
|
3662
|
+
const dismiss = (0, import_react30.useCallback)(() => {
|
|
3663
|
+
import_react_native20.Keyboard.dismiss();
|
|
3422
3664
|
}, []);
|
|
3423
3665
|
return { visible, height, dismiss };
|
|
3424
3666
|
}
|
|
3425
3667
|
|
|
3426
3668
|
// src/ui/hooks/useDimensions.ts
|
|
3427
|
-
var
|
|
3428
|
-
var
|
|
3669
|
+
var import_react31 = require("react");
|
|
3670
|
+
var import_react_native21 = require("react-native");
|
|
3429
3671
|
function useDimensions() {
|
|
3430
|
-
const [dimensions, setDimensions] = (0,
|
|
3431
|
-
const window =
|
|
3672
|
+
const [dimensions, setDimensions] = (0, import_react31.useState)(() => {
|
|
3673
|
+
const window = import_react_native21.Dimensions.get("window");
|
|
3432
3674
|
return {
|
|
3433
3675
|
width: window.width,
|
|
3434
3676
|
height: window.height,
|
|
@@ -3436,7 +3678,7 @@ function useDimensions() {
|
|
|
3436
3678
|
fontScale: window.fontScale
|
|
3437
3679
|
};
|
|
3438
3680
|
});
|
|
3439
|
-
(0,
|
|
3681
|
+
(0, import_react31.useEffect)(() => {
|
|
3440
3682
|
const handleChange = ({ window }) => {
|
|
3441
3683
|
setDimensions({
|
|
3442
3684
|
width: window.width,
|
|
@@ -3445,7 +3687,7 @@ function useDimensions() {
|
|
|
3445
3687
|
fontScale: window.fontScale
|
|
3446
3688
|
});
|
|
3447
3689
|
};
|
|
3448
|
-
const subscription =
|
|
3690
|
+
const subscription = import_react_native21.Dimensions.addEventListener("change", handleChange);
|
|
3449
3691
|
return () => {
|
|
3450
3692
|
subscription.remove();
|
|
3451
3693
|
};
|
|
@@ -3454,20 +3696,20 @@ function useDimensions() {
|
|
|
3454
3696
|
}
|
|
3455
3697
|
|
|
3456
3698
|
// src/ui/hooks/useOrientation.ts
|
|
3457
|
-
var
|
|
3458
|
-
var
|
|
3699
|
+
var import_react32 = require("react");
|
|
3700
|
+
var import_react_native22 = require("react-native");
|
|
3459
3701
|
function useOrientation() {
|
|
3460
3702
|
const getOrientation = () => {
|
|
3461
|
-
const { width, height } =
|
|
3703
|
+
const { width, height } = import_react_native22.Dimensions.get("window");
|
|
3462
3704
|
return width > height ? "landscape" : "portrait";
|
|
3463
3705
|
};
|
|
3464
|
-
const [orientation, setOrientation] = (0,
|
|
3465
|
-
(0,
|
|
3706
|
+
const [orientation, setOrientation] = (0, import_react32.useState)(getOrientation);
|
|
3707
|
+
(0, import_react32.useEffect)(() => {
|
|
3466
3708
|
const handleChange = ({ window }) => {
|
|
3467
3709
|
const newOrientation = window.width > window.height ? "landscape" : "portrait";
|
|
3468
3710
|
setOrientation(newOrientation);
|
|
3469
3711
|
};
|
|
3470
|
-
const subscription =
|
|
3712
|
+
const subscription = import_react_native22.Dimensions.addEventListener("change", handleChange);
|
|
3471
3713
|
return () => {
|
|
3472
3714
|
subscription.remove();
|
|
3473
3715
|
};
|
|
@@ -3480,7 +3722,7 @@ function useOrientation() {
|
|
|
3480
3722
|
}
|
|
3481
3723
|
|
|
3482
3724
|
// src/navigation/provider.tsx
|
|
3483
|
-
var
|
|
3725
|
+
var import_react33 = __toESM(require("react"));
|
|
3484
3726
|
var import_native = require("@react-navigation/native");
|
|
3485
3727
|
|
|
3486
3728
|
// src/navigation/utils/navigation-theme.ts
|
|
@@ -3506,7 +3748,7 @@ function createNavigationTheme(pantherTheme, isDark) {
|
|
|
3506
3748
|
}
|
|
3507
3749
|
|
|
3508
3750
|
// src/navigation/provider.tsx
|
|
3509
|
-
var
|
|
3751
|
+
var import_jsx_runtime31 = require("nativewind/jsx-runtime");
|
|
3510
3752
|
function NavigationProvider({
|
|
3511
3753
|
children,
|
|
3512
3754
|
linking,
|
|
@@ -3517,11 +3759,11 @@ function NavigationProvider({
|
|
|
3517
3759
|
theme: customTheme
|
|
3518
3760
|
}) {
|
|
3519
3761
|
const { theme, isDark } = useTheme();
|
|
3520
|
-
const navigationTheme =
|
|
3762
|
+
const navigationTheme = import_react33.default.useMemo(
|
|
3521
3763
|
() => customTheme || createNavigationTheme(theme, isDark),
|
|
3522
3764
|
[customTheme, theme, isDark]
|
|
3523
3765
|
);
|
|
3524
|
-
return /* @__PURE__ */ (0,
|
|
3766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
|
|
3525
3767
|
import_native.NavigationContainer,
|
|
3526
3768
|
{
|
|
3527
3769
|
theme: navigationTheme,
|
|
@@ -3539,14 +3781,14 @@ function NavigationProvider({
|
|
|
3539
3781
|
var import_stack = require("@react-navigation/stack");
|
|
3540
3782
|
|
|
3541
3783
|
// src/navigation/navigators/StackNavigator.tsx
|
|
3542
|
-
var
|
|
3784
|
+
var import_jsx_runtime32 = require("nativewind/jsx-runtime");
|
|
3543
3785
|
var NativeStack = (0, import_stack.createStackNavigator)();
|
|
3544
3786
|
var defaultScreenOptions = {
|
|
3545
3787
|
headerShown: false,
|
|
3546
3788
|
...import_stack.TransitionPresets.SlideFromRightIOS
|
|
3547
3789
|
};
|
|
3548
3790
|
function StackNavigator({ initialRouteName, screenOptions, children }) {
|
|
3549
|
-
return /* @__PURE__ */ (0,
|
|
3791
|
+
return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3550
3792
|
NativeStack.Navigator,
|
|
3551
3793
|
{
|
|
3552
3794
|
initialRouteName,
|
|
@@ -3558,7 +3800,7 @@ function StackNavigator({ initialRouteName, screenOptions, children }) {
|
|
|
3558
3800
|
StackNavigator.Screen = NativeStack.Screen;
|
|
3559
3801
|
StackNavigator.Group = NativeStack.Group;
|
|
3560
3802
|
function createStackScreens(routes) {
|
|
3561
|
-
return routes.map((route) => /* @__PURE__ */ (0,
|
|
3803
|
+
return routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
3562
3804
|
StackNavigator.Screen,
|
|
3563
3805
|
{
|
|
3564
3806
|
name: route.name,
|
|
@@ -3571,13 +3813,13 @@ function createStackScreens(routes) {
|
|
|
3571
3813
|
}
|
|
3572
3814
|
|
|
3573
3815
|
// src/navigation/navigators/TabNavigator.tsx
|
|
3574
|
-
var
|
|
3816
|
+
var import_react34 = __toESM(require("react"));
|
|
3575
3817
|
var import_bottom_tabs = require("@react-navigation/bottom-tabs");
|
|
3576
3818
|
|
|
3577
3819
|
// src/navigation/components/BottomTabBar.tsx
|
|
3578
|
-
var
|
|
3820
|
+
var import_react_native23 = require("react-native");
|
|
3579
3821
|
var import_react_native_safe_area_context2 = require("react-native-safe-area-context");
|
|
3580
|
-
var
|
|
3822
|
+
var import_jsx_runtime33 = require("nativewind/jsx-runtime");
|
|
3581
3823
|
var DEFAULT_TAB_BAR_HEIGHT = 65;
|
|
3582
3824
|
function BottomTabBar({
|
|
3583
3825
|
state,
|
|
@@ -3599,11 +3841,11 @@ function BottomTabBar({
|
|
|
3599
3841
|
const inactiveColor = inactiveTintColor || colors.textMuted;
|
|
3600
3842
|
const backgroundColor = style?.backgroundColor || colors.card;
|
|
3601
3843
|
const borderTopColor = colors.divider;
|
|
3602
|
-
return /* @__PURE__ */ (0,
|
|
3603
|
-
|
|
3844
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3845
|
+
import_react_native23.View,
|
|
3604
3846
|
{
|
|
3605
3847
|
style: [
|
|
3606
|
-
|
|
3848
|
+
styles12.container,
|
|
3607
3849
|
{ borderTopColor },
|
|
3608
3850
|
{ backgroundColor, height: height + insets.bottom, paddingBottom: insets.bottom },
|
|
3609
3851
|
style
|
|
@@ -3634,8 +3876,8 @@ function BottomTabBar({
|
|
|
3634
3876
|
size: 24
|
|
3635
3877
|
}) : null;
|
|
3636
3878
|
const badge = options.tabBarBadge;
|
|
3637
|
-
return /* @__PURE__ */ (0,
|
|
3638
|
-
|
|
3879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
3880
|
+
import_react_native23.TouchableOpacity,
|
|
3639
3881
|
{
|
|
3640
3882
|
accessibilityRole: "button",
|
|
3641
3883
|
accessibilityState: isFocused ? { selected: true } : {},
|
|
@@ -3644,21 +3886,21 @@ function BottomTabBar({
|
|
|
3644
3886
|
onPress,
|
|
3645
3887
|
onLongPress,
|
|
3646
3888
|
style: [
|
|
3647
|
-
|
|
3889
|
+
styles12.tab,
|
|
3648
3890
|
{
|
|
3649
3891
|
backgroundColor: isFocused ? activeBackgroundColor : inactiveBackgroundColor
|
|
3650
3892
|
}
|
|
3651
3893
|
],
|
|
3652
3894
|
children: [
|
|
3653
|
-
/* @__PURE__ */ (0,
|
|
3895
|
+
/* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react_native23.View, { style: [styles12.iconContainer, iconStyle], children: [
|
|
3654
3896
|
iconName,
|
|
3655
|
-
badge != null && /* @__PURE__ */ (0,
|
|
3897
|
+
badge != null && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react_native23.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 }) })
|
|
3656
3898
|
] }),
|
|
3657
|
-
showLabel && /* @__PURE__ */ (0,
|
|
3899
|
+
showLabel && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
3658
3900
|
AppText,
|
|
3659
3901
|
{
|
|
3660
3902
|
style: [
|
|
3661
|
-
|
|
3903
|
+
styles12.label,
|
|
3662
3904
|
{ color: isFocused ? activeColor : inactiveColor },
|
|
3663
3905
|
labelStyle
|
|
3664
3906
|
],
|
|
@@ -3674,7 +3916,7 @@ function BottomTabBar({
|
|
|
3674
3916
|
}
|
|
3675
3917
|
);
|
|
3676
3918
|
}
|
|
3677
|
-
var
|
|
3919
|
+
var styles12 = import_react_native23.StyleSheet.create({
|
|
3678
3920
|
container: {
|
|
3679
3921
|
flexDirection: "row",
|
|
3680
3922
|
borderTopWidth: 0.5,
|
|
@@ -3717,7 +3959,7 @@ var styles11 = import_react_native22.StyleSheet.create({
|
|
|
3717
3959
|
});
|
|
3718
3960
|
|
|
3719
3961
|
// src/navigation/navigators/TabNavigator.tsx
|
|
3720
|
-
var
|
|
3962
|
+
var import_jsx_runtime34 = require("nativewind/jsx-runtime");
|
|
3721
3963
|
var NativeTab = (0, import_bottom_tabs.createBottomTabNavigator)();
|
|
3722
3964
|
var defaultScreenOptions2 = {
|
|
3723
3965
|
headerShown: false,
|
|
@@ -3730,7 +3972,7 @@ function TabNavigator({
|
|
|
3730
3972
|
screenOptions,
|
|
3731
3973
|
children
|
|
3732
3974
|
}) {
|
|
3733
|
-
const mergedScreenOptions =
|
|
3975
|
+
const mergedScreenOptions = import_react34.default.useMemo(() => {
|
|
3734
3976
|
const options = { ...defaultScreenOptions2, ...screenOptions };
|
|
3735
3977
|
if (tabBarOptions) {
|
|
3736
3978
|
if (tabBarOptions.showLabel !== void 0) {
|
|
@@ -3763,9 +4005,9 @@ function TabNavigator({
|
|
|
3763
4005
|
}
|
|
3764
4006
|
return options;
|
|
3765
4007
|
}, [tabBarOptions, screenOptions]);
|
|
3766
|
-
const resolvedTabBar =
|
|
4008
|
+
const resolvedTabBar = import_react34.default.useMemo(() => {
|
|
3767
4009
|
if (tabBar) return tabBar;
|
|
3768
|
-
return (props) => /* @__PURE__ */ (0,
|
|
4010
|
+
return (props) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3769
4011
|
BottomTabBar,
|
|
3770
4012
|
{
|
|
3771
4013
|
...props,
|
|
@@ -3792,7 +4034,7 @@ function TabNavigator({
|
|
|
3792
4034
|
tabBarOptions?.style,
|
|
3793
4035
|
tabBarOptions?.height
|
|
3794
4036
|
]);
|
|
3795
|
-
return /* @__PURE__ */ (0,
|
|
4037
|
+
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3796
4038
|
NativeTab.Navigator,
|
|
3797
4039
|
{
|
|
3798
4040
|
initialRouteName,
|
|
@@ -3804,7 +4046,7 @@ function TabNavigator({
|
|
|
3804
4046
|
}
|
|
3805
4047
|
TabNavigator.Screen = NativeTab.Screen;
|
|
3806
4048
|
function createTabScreens(routes) {
|
|
3807
|
-
return routes.map((route) => /* @__PURE__ */ (0,
|
|
4049
|
+
return routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
3808
4050
|
TabNavigator.Screen,
|
|
3809
4051
|
{
|
|
3810
4052
|
name: route.name,
|
|
@@ -3817,9 +4059,9 @@ function createTabScreens(routes) {
|
|
|
3817
4059
|
}
|
|
3818
4060
|
|
|
3819
4061
|
// src/navigation/navigators/DrawerNavigator.tsx
|
|
3820
|
-
var
|
|
4062
|
+
var import_react35 = __toESM(require("react"));
|
|
3821
4063
|
var import_drawer = require("@react-navigation/drawer");
|
|
3822
|
-
var
|
|
4064
|
+
var import_jsx_runtime35 = require("nativewind/jsx-runtime");
|
|
3823
4065
|
var NativeDrawer = (0, import_drawer.createDrawerNavigator)();
|
|
3824
4066
|
function DrawerNavigator({
|
|
3825
4067
|
initialRouteName,
|
|
@@ -3830,7 +4072,7 @@ function DrawerNavigator({
|
|
|
3830
4072
|
}) {
|
|
3831
4073
|
const { theme, isDark } = useTheme();
|
|
3832
4074
|
const navigationTheme = createNavigationTheme(theme, isDark);
|
|
3833
|
-
const mergedScreenOptions =
|
|
4075
|
+
const mergedScreenOptions = import_react35.default.useMemo(() => {
|
|
3834
4076
|
return {
|
|
3835
4077
|
headerShown: false,
|
|
3836
4078
|
drawerStyle: {
|
|
@@ -3849,7 +4091,7 @@ function DrawerNavigator({
|
|
|
3849
4091
|
...screenOptions
|
|
3850
4092
|
};
|
|
3851
4093
|
}, [screenOptions, drawerOptions, navigationTheme, theme]);
|
|
3852
|
-
return /* @__PURE__ */ (0,
|
|
4094
|
+
return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3853
4095
|
NativeDrawer.Navigator,
|
|
3854
4096
|
{
|
|
3855
4097
|
initialRouteName,
|
|
@@ -3861,7 +4103,7 @@ function DrawerNavigator({
|
|
|
3861
4103
|
}
|
|
3862
4104
|
DrawerNavigator.Screen = NativeDrawer.Screen;
|
|
3863
4105
|
function createDrawerScreens(routes) {
|
|
3864
|
-
return routes.map((route) => /* @__PURE__ */ (0,
|
|
4106
|
+
return routes.map((route) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
|
|
3865
4107
|
DrawerNavigator.Screen,
|
|
3866
4108
|
{
|
|
3867
4109
|
name: route.name,
|
|
@@ -3874,9 +4116,9 @@ function createDrawerScreens(routes) {
|
|
|
3874
4116
|
}
|
|
3875
4117
|
|
|
3876
4118
|
// src/navigation/components/AppHeader.tsx
|
|
3877
|
-
var
|
|
4119
|
+
var import_react_native24 = require("react-native");
|
|
3878
4120
|
var import_react_native_safe_area_context3 = require("react-native-safe-area-context");
|
|
3879
|
-
var
|
|
4121
|
+
var import_jsx_runtime36 = require("nativewind/jsx-runtime");
|
|
3880
4122
|
function AppHeader({
|
|
3881
4123
|
title,
|
|
3882
4124
|
subtitle,
|
|
@@ -3890,7 +4132,7 @@ function AppHeader({
|
|
|
3890
4132
|
const colors = useThemeColors();
|
|
3891
4133
|
const insets = (0, import_react_native_safe_area_context3.useSafeAreaInsets)();
|
|
3892
4134
|
const backgroundColor = transparent ? "transparent" : colors.card;
|
|
3893
|
-
return /* @__PURE__ */ (0,
|
|
4135
|
+
return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3894
4136
|
AppView,
|
|
3895
4137
|
{
|
|
3896
4138
|
style: [
|
|
@@ -3900,38 +4142,38 @@ function AppHeader({
|
|
|
3900
4142
|
},
|
|
3901
4143
|
style
|
|
3902
4144
|
],
|
|
3903
|
-
children: /* @__PURE__ */ (0,
|
|
3904
|
-
/* @__PURE__ */ (0,
|
|
3905
|
-
/* @__PURE__ */ (0,
|
|
3906
|
-
title && /* @__PURE__ */ (0,
|
|
4145
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { row: true, items: "center", px: 4, style: styles13.container, children: [
|
|
4146
|
+
/* @__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 }) }) }),
|
|
4147
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(AppView, { style: styles13.centerContainer, children: [
|
|
4148
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3907
4149
|
AppText,
|
|
3908
4150
|
{
|
|
3909
4151
|
size: "lg",
|
|
3910
4152
|
weight: "semibold",
|
|
3911
|
-
style: [
|
|
4153
|
+
style: [styles13.title, { color: colors.text }],
|
|
3912
4154
|
numberOfLines: 1,
|
|
3913
4155
|
children: title
|
|
3914
4156
|
}
|
|
3915
4157
|
),
|
|
3916
|
-
subtitle && /* @__PURE__ */ (0,
|
|
4158
|
+
subtitle && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
|
|
3917
4159
|
AppText,
|
|
3918
4160
|
{
|
|
3919
4161
|
size: "xs",
|
|
3920
|
-
style: [
|
|
4162
|
+
style: [styles13.subtitle, { color: colors.textMuted }],
|
|
3921
4163
|
numberOfLines: 1,
|
|
3922
4164
|
children: subtitle
|
|
3923
4165
|
}
|
|
3924
4166
|
)
|
|
3925
4167
|
] }),
|
|
3926
|
-
/* @__PURE__ */ (0,
|
|
3927
|
-
/* @__PURE__ */ (0,
|
|
3928
|
-
icon.badge ? /* @__PURE__ */ (0,
|
|
4168
|
+
/* @__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: [
|
|
4169
|
+
/* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Icon, { name: icon.icon, size: 24, color: colors.text }),
|
|
4170
|
+
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
|
|
3929
4171
|
] }) }, index)) })
|
|
3930
4172
|
] })
|
|
3931
4173
|
}
|
|
3932
4174
|
);
|
|
3933
4175
|
}
|
|
3934
|
-
var
|
|
4176
|
+
var styles13 = import_react_native24.StyleSheet.create({
|
|
3935
4177
|
container: {
|
|
3936
4178
|
height: 44
|
|
3937
4179
|
// iOS 标准导航栏高度
|
|
@@ -3982,9 +4224,9 @@ var styles12 = import_react_native23.StyleSheet.create({
|
|
|
3982
4224
|
});
|
|
3983
4225
|
|
|
3984
4226
|
// src/navigation/components/DrawerContent.tsx
|
|
3985
|
-
var
|
|
4227
|
+
var import_react_native25 = require("react-native");
|
|
3986
4228
|
var import_drawer2 = require("@react-navigation/drawer");
|
|
3987
|
-
var
|
|
4229
|
+
var import_jsx_runtime37 = require("nativewind/jsx-runtime");
|
|
3988
4230
|
function DrawerContent({
|
|
3989
4231
|
state,
|
|
3990
4232
|
descriptors,
|
|
@@ -4013,20 +4255,20 @@ function DrawerContent({
|
|
|
4013
4255
|
badge: options.tabBarBadge
|
|
4014
4256
|
};
|
|
4015
4257
|
});
|
|
4016
|
-
return /* @__PURE__ */ (0,
|
|
4017
|
-
header && /* @__PURE__ */ (0,
|
|
4018
|
-
/* @__PURE__ */ (0,
|
|
4258
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_drawer2.DrawerContentScrollView, { style: [styles14.container, { backgroundColor }], children: [
|
|
4259
|
+
header && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native25.View, { style: [styles14.header, { borderBottomColor: dividerColor }], children: header }),
|
|
4260
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(AppView, { className: "py-2", children: drawerItems.map((item) => {
|
|
4019
4261
|
const isFocused = state.routes[state.index].name === item.name;
|
|
4020
4262
|
const onPress = () => {
|
|
4021
4263
|
navigation.navigate(item.name);
|
|
4022
4264
|
};
|
|
4023
|
-
return /* @__PURE__ */ (0,
|
|
4024
|
-
|
|
4265
|
+
return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
|
|
4266
|
+
import_react_native25.TouchableOpacity,
|
|
4025
4267
|
{
|
|
4026
4268
|
onPress,
|
|
4027
|
-
style: [
|
|
4269
|
+
style: [styles14.item, isFocused && { backgroundColor: activeBgColor }],
|
|
4028
4270
|
children: [
|
|
4029
|
-
item.icon && /* @__PURE__ */ (0,
|
|
4271
|
+
item.icon && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native25.View, { style: styles14.iconContainer, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4030
4272
|
Icon,
|
|
4031
4273
|
{
|
|
4032
4274
|
name: item.icon,
|
|
@@ -4034,28 +4276,28 @@ function DrawerContent({
|
|
|
4034
4276
|
color: isFocused ? activeColor : inactiveColor
|
|
4035
4277
|
}
|
|
4036
4278
|
) }),
|
|
4037
|
-
/* @__PURE__ */ (0,
|
|
4279
|
+
/* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
|
|
4038
4280
|
AppText,
|
|
4039
4281
|
{
|
|
4040
4282
|
style: [
|
|
4041
|
-
|
|
4283
|
+
styles14.label,
|
|
4042
4284
|
{ color: isFocused ? activeColor : inactiveColor },
|
|
4043
|
-
isFocused &&
|
|
4285
|
+
isFocused && styles14.activeLabel
|
|
4044
4286
|
],
|
|
4045
4287
|
numberOfLines: 1,
|
|
4046
4288
|
children: item.label
|
|
4047
4289
|
}
|
|
4048
4290
|
),
|
|
4049
|
-
item.badge != null && /* @__PURE__ */ (0,
|
|
4291
|
+
item.badge != null && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native25.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 }) })
|
|
4050
4292
|
]
|
|
4051
4293
|
},
|
|
4052
4294
|
item.name
|
|
4053
4295
|
);
|
|
4054
4296
|
}) }),
|
|
4055
|
-
footer && /* @__PURE__ */ (0,
|
|
4297
|
+
footer && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_native25.View, { style: [styles14.footer, { borderTopColor: dividerColor }], children: footer })
|
|
4056
4298
|
] });
|
|
4057
4299
|
}
|
|
4058
|
-
var
|
|
4300
|
+
var styles14 = import_react_native25.StyleSheet.create({
|
|
4059
4301
|
container: {
|
|
4060
4302
|
flex: 1
|
|
4061
4303
|
},
|
|
@@ -4105,7 +4347,7 @@ var styles13 = import_react_native24.StyleSheet.create({
|
|
|
4105
4347
|
});
|
|
4106
4348
|
|
|
4107
4349
|
// src/navigation/hooks/useNavigation.ts
|
|
4108
|
-
var
|
|
4350
|
+
var import_react36 = require("react");
|
|
4109
4351
|
var import_native2 = require("@react-navigation/native");
|
|
4110
4352
|
function useNavigation() {
|
|
4111
4353
|
return (0, import_native2.useNavigation)();
|
|
@@ -4121,7 +4363,7 @@ function useDrawerNavigation() {
|
|
|
4121
4363
|
}
|
|
4122
4364
|
function useBackHandler(handler) {
|
|
4123
4365
|
const navigation = (0, import_native2.useNavigation)();
|
|
4124
|
-
(0,
|
|
4366
|
+
(0, import_react36.useEffect)(() => {
|
|
4125
4367
|
const unsubscribe = navigation.addListener("beforeRemove", (e) => {
|
|
4126
4368
|
if (!handler()) {
|
|
4127
4369
|
e.preventDefault();
|
|
@@ -4150,8 +4392,8 @@ var import_native5 = require("@react-navigation/native");
|
|
|
4150
4392
|
var import_react_native_safe_area_context4 = require("react-native-safe-area-context");
|
|
4151
4393
|
|
|
4152
4394
|
// src/overlay/AppStatusBar.tsx
|
|
4153
|
-
var
|
|
4154
|
-
var
|
|
4395
|
+
var import_react_native26 = require("react-native");
|
|
4396
|
+
var import_jsx_runtime38 = require("nativewind/jsx-runtime");
|
|
4155
4397
|
function AppStatusBar({
|
|
4156
4398
|
barStyle = "auto",
|
|
4157
4399
|
backgroundColor,
|
|
@@ -4161,8 +4403,8 @@ function AppStatusBar({
|
|
|
4161
4403
|
const { theme, isDark } = useTheme();
|
|
4162
4404
|
const resolvedBarStyle = barStyle === "auto" ? isDark ? "light-content" : "dark-content" : barStyle;
|
|
4163
4405
|
const resolvedBackgroundColor = backgroundColor ?? (translucent ? "transparent" : theme.colors.background?.[500] || "#ffffff");
|
|
4164
|
-
return /* @__PURE__ */ (0,
|
|
4165
|
-
|
|
4406
|
+
return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
|
|
4407
|
+
import_react_native26.StatusBar,
|
|
4166
4408
|
{
|
|
4167
4409
|
barStyle: resolvedBarStyle,
|
|
4168
4410
|
backgroundColor: resolvedBackgroundColor,
|
|
@@ -4173,27 +4415,27 @@ function AppStatusBar({
|
|
|
4173
4415
|
}
|
|
4174
4416
|
|
|
4175
4417
|
// src/overlay/loading/provider.tsx
|
|
4176
|
-
var
|
|
4418
|
+
var import_react38 = require("react");
|
|
4177
4419
|
|
|
4178
4420
|
// src/overlay/loading/context.ts
|
|
4179
|
-
var
|
|
4180
|
-
var LoadingContext = (0,
|
|
4421
|
+
var import_react37 = require("react");
|
|
4422
|
+
var LoadingContext = (0, import_react37.createContext)(null);
|
|
4181
4423
|
function useLoadingContext() {
|
|
4182
|
-
const ctx = (0,
|
|
4424
|
+
const ctx = (0, import_react37.useContext)(LoadingContext);
|
|
4183
4425
|
if (!ctx) throw new Error("useLoading must be used within OverlayProvider");
|
|
4184
4426
|
return ctx;
|
|
4185
4427
|
}
|
|
4186
4428
|
|
|
4187
4429
|
// src/overlay/loading/component.tsx
|
|
4188
|
-
var
|
|
4189
|
-
var
|
|
4430
|
+
var import_react_native27 = require("react-native");
|
|
4431
|
+
var import_jsx_runtime39 = require("nativewind/jsx-runtime");
|
|
4190
4432
|
function LoadingModal({ visible, text }) {
|
|
4191
|
-
return /* @__PURE__ */ (0,
|
|
4192
|
-
/* @__PURE__ */ (0,
|
|
4193
|
-
text && /* @__PURE__ */ (0,
|
|
4433
|
+
return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native27.Modal, { transparent: true, visible, animationType: "fade", children: /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native27.View, { style: styles15.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_react_native27.View, { style: [styles15.loadingBox, { backgroundColor: "rgba(0,0,0,0.8)" }], children: [
|
|
4434
|
+
/* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_react_native27.ActivityIndicator, { size: "large", color: "#fff" }),
|
|
4435
|
+
text && /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(AppText, { className: "text-white mt-3 text-sm", children: text })
|
|
4194
4436
|
] }) }) });
|
|
4195
4437
|
}
|
|
4196
|
-
var
|
|
4438
|
+
var styles15 = import_react_native27.StyleSheet.create({
|
|
4197
4439
|
overlay: {
|
|
4198
4440
|
flex: 1,
|
|
4199
4441
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4209,45 +4451,45 @@ var styles14 = import_react_native26.StyleSheet.create({
|
|
|
4209
4451
|
});
|
|
4210
4452
|
|
|
4211
4453
|
// src/overlay/loading/provider.tsx
|
|
4212
|
-
var
|
|
4454
|
+
var import_jsx_runtime40 = require("nativewind/jsx-runtime");
|
|
4213
4455
|
function LoadingProvider({ children }) {
|
|
4214
|
-
const [state, setState] = (0,
|
|
4215
|
-
const show = (0,
|
|
4456
|
+
const [state, setState] = (0, import_react38.useState)({ visible: false });
|
|
4457
|
+
const show = (0, import_react38.useCallback)((text) => {
|
|
4216
4458
|
setState({ visible: true, text });
|
|
4217
4459
|
}, []);
|
|
4218
|
-
const hide = (0,
|
|
4460
|
+
const hide = (0, import_react38.useCallback)(() => {
|
|
4219
4461
|
setState({ visible: false });
|
|
4220
4462
|
}, []);
|
|
4221
|
-
return /* @__PURE__ */ (0,
|
|
4463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(LoadingContext.Provider, { value: { show, hide }, children: [
|
|
4222
4464
|
children,
|
|
4223
|
-
/* @__PURE__ */ (0,
|
|
4465
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(LoadingModal, { ...state })
|
|
4224
4466
|
] });
|
|
4225
4467
|
}
|
|
4226
4468
|
|
|
4227
4469
|
// src/overlay/toast/provider.tsx
|
|
4228
|
-
var
|
|
4229
|
-
var
|
|
4470
|
+
var import_react41 = require("react");
|
|
4471
|
+
var import_react_native29 = require("react-native");
|
|
4230
4472
|
|
|
4231
4473
|
// src/overlay/toast/context.ts
|
|
4232
|
-
var
|
|
4233
|
-
var ToastContext = (0,
|
|
4474
|
+
var import_react39 = require("react");
|
|
4475
|
+
var ToastContext = (0, import_react39.createContext)(null);
|
|
4234
4476
|
function useToastContext() {
|
|
4235
|
-
const ctx = (0,
|
|
4477
|
+
const ctx = (0, import_react39.useContext)(ToastContext);
|
|
4236
4478
|
if (!ctx) throw new Error("useToast must be used within OverlayProvider");
|
|
4237
4479
|
return ctx;
|
|
4238
4480
|
}
|
|
4239
4481
|
|
|
4240
4482
|
// src/overlay/toast/component.tsx
|
|
4241
|
-
var
|
|
4242
|
-
var
|
|
4243
|
-
var
|
|
4483
|
+
var import_react40 = require("react");
|
|
4484
|
+
var import_react_native28 = require("react-native");
|
|
4485
|
+
var import_jsx_runtime41 = require("nativewind/jsx-runtime");
|
|
4244
4486
|
function ToastItemView({ message, type, onHide }) {
|
|
4245
|
-
const fadeAnim = (0,
|
|
4246
|
-
(0,
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4487
|
+
const fadeAnim = (0, import_react40.useRef)(new import_react_native28.Animated.Value(0)).current;
|
|
4488
|
+
(0, import_react40.useEffect)(() => {
|
|
4489
|
+
import_react_native28.Animated.sequence([
|
|
4490
|
+
import_react_native28.Animated.timing(fadeAnim, { toValue: 1, duration: 200, useNativeDriver: true }),
|
|
4491
|
+
import_react_native28.Animated.delay(2500),
|
|
4492
|
+
import_react_native28.Animated.timing(fadeAnim, { toValue: 0, duration: 200, useNativeDriver: true })
|
|
4251
4493
|
]).start(onHide);
|
|
4252
4494
|
}, []);
|
|
4253
4495
|
const bgColors = {
|
|
@@ -4256,8 +4498,8 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4256
4498
|
warning: "bg-warning-500",
|
|
4257
4499
|
info: "bg-primary-500"
|
|
4258
4500
|
};
|
|
4259
|
-
return /* @__PURE__ */ (0,
|
|
4260
|
-
|
|
4501
|
+
return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)(
|
|
4502
|
+
import_react_native28.Animated.View,
|
|
4261
4503
|
{
|
|
4262
4504
|
style: {
|
|
4263
4505
|
opacity: fadeAnim,
|
|
@@ -4270,17 +4512,17 @@ function ToastItemView({ message, type, onHide }) {
|
|
|
4270
4512
|
}
|
|
4271
4513
|
]
|
|
4272
4514
|
},
|
|
4273
|
-
children: /* @__PURE__ */ (0,
|
|
4515
|
+
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 }) })
|
|
4274
4516
|
}
|
|
4275
4517
|
);
|
|
4276
4518
|
}
|
|
4277
4519
|
|
|
4278
4520
|
// src/overlay/toast/provider.tsx
|
|
4279
|
-
var
|
|
4521
|
+
var import_jsx_runtime42 = require("nativewind/jsx-runtime");
|
|
4280
4522
|
function ToastProvider({ children }) {
|
|
4281
|
-
const [toasts, setToasts] = (0,
|
|
4282
|
-
const timersRef = (0,
|
|
4283
|
-
const remove = (0,
|
|
4523
|
+
const [toasts, setToasts] = (0, import_react41.useState)([]);
|
|
4524
|
+
const timersRef = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
|
|
4525
|
+
const remove = (0, import_react41.useCallback)((id) => {
|
|
4284
4526
|
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
4285
4527
|
const timer = timersRef.current.get(id);
|
|
4286
4528
|
if (timer) {
|
|
@@ -4288,7 +4530,7 @@ function ToastProvider({ children }) {
|
|
|
4288
4530
|
timersRef.current.delete(id);
|
|
4289
4531
|
}
|
|
4290
4532
|
}, []);
|
|
4291
|
-
const show = (0,
|
|
4533
|
+
const show = (0, import_react41.useCallback)(
|
|
4292
4534
|
(message, type = "info", duration = 3e3) => {
|
|
4293
4535
|
const id = Math.random().toString(36).substring(7);
|
|
4294
4536
|
const toast = { id, message, type, duration };
|
|
@@ -4298,28 +4540,28 @@ function ToastProvider({ children }) {
|
|
|
4298
4540
|
},
|
|
4299
4541
|
[remove]
|
|
4300
4542
|
);
|
|
4301
|
-
const success = (0,
|
|
4543
|
+
const success = (0, import_react41.useCallback)(
|
|
4302
4544
|
(message, duration) => show(message, "success", duration),
|
|
4303
4545
|
[show]
|
|
4304
4546
|
);
|
|
4305
|
-
const error = (0,
|
|
4547
|
+
const error = (0, import_react41.useCallback)(
|
|
4306
4548
|
(message, duration) => show(message, "error", duration),
|
|
4307
4549
|
[show]
|
|
4308
4550
|
);
|
|
4309
|
-
const info = (0,
|
|
4551
|
+
const info = (0, import_react41.useCallback)(
|
|
4310
4552
|
(message, duration) => show(message, "info", duration),
|
|
4311
4553
|
[show]
|
|
4312
4554
|
);
|
|
4313
|
-
const warning = (0,
|
|
4555
|
+
const warning = (0, import_react41.useCallback)(
|
|
4314
4556
|
(message, duration) => show(message, "warning", duration),
|
|
4315
4557
|
[show]
|
|
4316
4558
|
);
|
|
4317
|
-
return /* @__PURE__ */ (0,
|
|
4559
|
+
return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(ToastContext.Provider, { value: { show, success, error, info, warning }, children: [
|
|
4318
4560
|
children,
|
|
4319
|
-
/* @__PURE__ */ (0,
|
|
4561
|
+
/* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_react_native29.View, { style: styles16.toastContainer, pointerEvents: "none", children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(ToastItemView, { ...toast, onHide: () => remove(toast.id) }, toast.id)) })
|
|
4320
4562
|
] });
|
|
4321
4563
|
}
|
|
4322
|
-
var
|
|
4564
|
+
var styles16 = import_react_native29.StyleSheet.create({
|
|
4323
4565
|
toastContainer: {
|
|
4324
4566
|
position: "absolute",
|
|
4325
4567
|
top: 60,
|
|
@@ -4330,20 +4572,20 @@ var styles15 = import_react_native28.StyleSheet.create({
|
|
|
4330
4572
|
});
|
|
4331
4573
|
|
|
4332
4574
|
// src/overlay/alert/provider.tsx
|
|
4333
|
-
var
|
|
4575
|
+
var import_react43 = require("react");
|
|
4334
4576
|
|
|
4335
4577
|
// src/overlay/alert/context.ts
|
|
4336
|
-
var
|
|
4337
|
-
var AlertContext = (0,
|
|
4578
|
+
var import_react42 = require("react");
|
|
4579
|
+
var AlertContext = (0, import_react42.createContext)(null);
|
|
4338
4580
|
function useAlertContext() {
|
|
4339
|
-
const ctx = (0,
|
|
4581
|
+
const ctx = (0, import_react42.useContext)(AlertContext);
|
|
4340
4582
|
if (!ctx) throw new Error("useAlert must be used within OverlayProvider");
|
|
4341
4583
|
return ctx;
|
|
4342
4584
|
}
|
|
4343
4585
|
|
|
4344
4586
|
// src/overlay/alert/component.tsx
|
|
4345
|
-
var
|
|
4346
|
-
var
|
|
4587
|
+
var import_react_native30 = require("react-native");
|
|
4588
|
+
var import_jsx_runtime43 = require("nativewind/jsx-runtime");
|
|
4347
4589
|
function AlertModal({
|
|
4348
4590
|
visible,
|
|
4349
4591
|
title,
|
|
@@ -4355,16 +4597,16 @@ function AlertModal({
|
|
|
4355
4597
|
onCancel
|
|
4356
4598
|
}) {
|
|
4357
4599
|
if (!visible) return null;
|
|
4358
|
-
return /* @__PURE__ */ (0,
|
|
4359
|
-
title && /* @__PURE__ */ (0,
|
|
4360
|
-
message && /* @__PURE__ */ (0,
|
|
4361
|
-
/* @__PURE__ */ (0,
|
|
4362
|
-
showCancel && /* @__PURE__ */ (0,
|
|
4363
|
-
/* @__PURE__ */ (0,
|
|
4600
|
+
return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native30.Modal, { transparent: true, visible: true, animationType: "fade", children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native30.View, { style: styles17.overlay, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native30.View, { style: styles17.alertBox, children: [
|
|
4601
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppText, { className: "text-lg font-semibold text-center mb-2", children: title }),
|
|
4602
|
+
message && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(AppText, { className: "text-gray-600 text-center mb-4", children: message }),
|
|
4603
|
+
/* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(AppView, { row: true, gap: 3, className: "mt-2", children: [
|
|
4604
|
+
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" }) }),
|
|
4605
|
+
/* @__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" }) })
|
|
4364
4606
|
] })
|
|
4365
4607
|
] }) }) });
|
|
4366
4608
|
}
|
|
4367
|
-
var
|
|
4609
|
+
var styles17 = import_react_native30.StyleSheet.create({
|
|
4368
4610
|
overlay: {
|
|
4369
4611
|
flex: 1,
|
|
4370
4612
|
backgroundColor: "rgba(0,0,0,0.5)",
|
|
@@ -4386,32 +4628,32 @@ var styles16 = import_react_native29.StyleSheet.create({
|
|
|
4386
4628
|
});
|
|
4387
4629
|
|
|
4388
4630
|
// src/overlay/alert/provider.tsx
|
|
4389
|
-
var
|
|
4631
|
+
var import_jsx_runtime44 = require("nativewind/jsx-runtime");
|
|
4390
4632
|
function AlertProvider({ children }) {
|
|
4391
|
-
const [alert, setAlert] = (0,
|
|
4392
|
-
const showAlert = (0,
|
|
4633
|
+
const [alert, setAlert] = (0, import_react43.useState)(null);
|
|
4634
|
+
const showAlert = (0, import_react43.useCallback)((options) => {
|
|
4393
4635
|
setAlert({ ...options, visible: true });
|
|
4394
4636
|
}, []);
|
|
4395
|
-
const confirm = (0,
|
|
4637
|
+
const confirm = (0, import_react43.useCallback)(
|
|
4396
4638
|
(options) => {
|
|
4397
4639
|
showAlert({ ...options, showCancel: true });
|
|
4398
4640
|
},
|
|
4399
4641
|
[showAlert]
|
|
4400
4642
|
);
|
|
4401
|
-
const hide = (0,
|
|
4643
|
+
const hide = (0, import_react43.useCallback)(() => {
|
|
4402
4644
|
setAlert(null);
|
|
4403
4645
|
}, []);
|
|
4404
|
-
const handleConfirm = (0,
|
|
4646
|
+
const handleConfirm = (0, import_react43.useCallback)(() => {
|
|
4405
4647
|
alert?.onConfirm?.();
|
|
4406
4648
|
hide();
|
|
4407
4649
|
}, [alert, hide]);
|
|
4408
|
-
const handleCancel = (0,
|
|
4650
|
+
const handleCancel = (0, import_react43.useCallback)(() => {
|
|
4409
4651
|
alert?.onCancel?.();
|
|
4410
4652
|
hide();
|
|
4411
4653
|
}, [alert, hide]);
|
|
4412
|
-
return /* @__PURE__ */ (0,
|
|
4654
|
+
return /* @__PURE__ */ (0, import_jsx_runtime44.jsxs)(AlertContext.Provider, { value: { alert: showAlert, confirm }, children: [
|
|
4413
4655
|
children,
|
|
4414
|
-
/* @__PURE__ */ (0,
|
|
4656
|
+
/* @__PURE__ */ (0, import_jsx_runtime44.jsx)(
|
|
4415
4657
|
AlertModal,
|
|
4416
4658
|
{
|
|
4417
4659
|
visible: alert?.visible ?? false,
|
|
@@ -4428,13 +4670,13 @@ function AlertProvider({ children }) {
|
|
|
4428
4670
|
}
|
|
4429
4671
|
|
|
4430
4672
|
// src/overlay/provider.tsx
|
|
4431
|
-
var
|
|
4673
|
+
var import_jsx_runtime45 = require("nativewind/jsx-runtime");
|
|
4432
4674
|
function OverlayProvider({ children }) {
|
|
4433
|
-
return /* @__PURE__ */ (0,
|
|
4675
|
+
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 }) }) });
|
|
4434
4676
|
}
|
|
4435
4677
|
|
|
4436
4678
|
// src/overlay/AppProvider.tsx
|
|
4437
|
-
var
|
|
4679
|
+
var import_jsx_runtime46 = require("nativewind/jsx-runtime");
|
|
4438
4680
|
var defaultLightTheme = {
|
|
4439
4681
|
colors: {
|
|
4440
4682
|
primary: "#f38b32",
|
|
@@ -4471,21 +4713,21 @@ function AppProvider({
|
|
|
4471
4713
|
}) {
|
|
4472
4714
|
let content = children;
|
|
4473
4715
|
if (enableOverlay) {
|
|
4474
|
-
content = /* @__PURE__ */ (0,
|
|
4716
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(OverlayProvider, { children: content });
|
|
4475
4717
|
}
|
|
4476
4718
|
if (enableNavigation) {
|
|
4477
|
-
content = /* @__PURE__ */ (0,
|
|
4719
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(NavigationProvider, { ...navigationProps, children: content });
|
|
4478
4720
|
}
|
|
4479
4721
|
if (enableTheme) {
|
|
4480
|
-
content = /* @__PURE__ */ (0,
|
|
4481
|
-
enableStatusBar && /* @__PURE__ */ (0,
|
|
4722
|
+
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: [
|
|
4723
|
+
enableStatusBar && /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(AppStatusBar, { testID: "status-bar", ...statusBarProps }),
|
|
4482
4724
|
content
|
|
4483
4725
|
] }) });
|
|
4484
4726
|
}
|
|
4485
4727
|
if (enableSafeArea) {
|
|
4486
|
-
content = /* @__PURE__ */ (0,
|
|
4728
|
+
content = /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native_safe_area_context4.SafeAreaProvider, { children: content });
|
|
4487
4729
|
}
|
|
4488
|
-
return /* @__PURE__ */ (0,
|
|
4730
|
+
return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_jsx_runtime46.Fragment, { children: content });
|
|
4489
4731
|
}
|
|
4490
4732
|
|
|
4491
4733
|
// src/overlay/loading/hooks.ts
|
|
@@ -4532,6 +4774,7 @@ var import_react_native_safe_area_context5 = require("react-native-safe-area-con
|
|
|
4532
4774
|
ErrorCode,
|
|
4533
4775
|
FileIcons,
|
|
4534
4776
|
FormItem,
|
|
4777
|
+
GradientView,
|
|
4535
4778
|
Icon,
|
|
4536
4779
|
Loading,
|
|
4537
4780
|
MemoryStorage,
|
|
@@ -4540,6 +4783,7 @@ var import_react_native_safe_area_context5 = require("react-native-safe-area-con
|
|
|
4540
4783
|
NavigationProvider,
|
|
4541
4784
|
OverlayProvider,
|
|
4542
4785
|
Page,
|
|
4786
|
+
PageDrawer,
|
|
4543
4787
|
Progress,
|
|
4544
4788
|
Radio,
|
|
4545
4789
|
RadioGroup,
|
|
@@ -4605,6 +4849,7 @@ var import_react_native_safe_area_context5 = require("react-native-safe-area-con
|
|
|
4605
4849
|
useNavigation,
|
|
4606
4850
|
useNavigationState,
|
|
4607
4851
|
useOrientation,
|
|
4852
|
+
usePageDrawer,
|
|
4608
4853
|
usePagination,
|
|
4609
4854
|
usePrevious,
|
|
4610
4855
|
useQuery,
|