@gaozh1024/rn-kit 0.3.1 → 0.3.2
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 +23 -7
- package/dist/index.d.mts +43 -7
- package/dist/index.d.ts +43 -7
- package/dist/index.js +79 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +77 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1243,7 +1243,7 @@ var styles = StyleSheet2.create({
|
|
|
1243
1243
|
flex: 1
|
|
1244
1244
|
}
|
|
1245
1245
|
});
|
|
1246
|
-
function
|
|
1246
|
+
function AppScreen({
|
|
1247
1247
|
children,
|
|
1248
1248
|
className,
|
|
1249
1249
|
...props
|
|
@@ -1612,7 +1612,15 @@ function Icon({ name, size = "md", color = "gray-600", style, onPress, testID })
|
|
|
1612
1612
|
return onPress ? /* @__PURE__ */ jsx16(AppPressable, { onPress, children: fallback }) : fallback;
|
|
1613
1613
|
}
|
|
1614
1614
|
if (onPress) {
|
|
1615
|
-
return /* @__PURE__ */ jsx16(AppPressable, { onPress, testID, children: /* @__PURE__ */ jsx16(
|
|
1615
|
+
return /* @__PURE__ */ jsx16(AppPressable, { onPress, testID, children: /* @__PURE__ */ jsx16(
|
|
1616
|
+
MaterialIconComponent,
|
|
1617
|
+
{
|
|
1618
|
+
name,
|
|
1619
|
+
size: resolvedSize,
|
|
1620
|
+
color: resolvedColor,
|
|
1621
|
+
style
|
|
1622
|
+
}
|
|
1623
|
+
) });
|
|
1616
1624
|
}
|
|
1617
1625
|
return /* @__PURE__ */ jsx16(
|
|
1618
1626
|
MaterialIconComponent,
|
|
@@ -1865,12 +1873,18 @@ function EmptyState({
|
|
|
1865
1873
|
description && /* @__PURE__ */ jsx18(AppText, { size: "sm", className: "mt-2", style: { color: colors.textMuted }, children: description })
|
|
1866
1874
|
] });
|
|
1867
1875
|
}
|
|
1868
|
-
function ErrorState({
|
|
1876
|
+
function ErrorState({
|
|
1877
|
+
error,
|
|
1878
|
+
onRetry,
|
|
1879
|
+
errorTitle,
|
|
1880
|
+
errorDescription,
|
|
1881
|
+
retryText
|
|
1882
|
+
}) {
|
|
1869
1883
|
const colors = useThemeColors();
|
|
1870
1884
|
return /* @__PURE__ */ jsxs4(Center, { py: 20, children: [
|
|
1871
1885
|
/* @__PURE__ */ jsx18(Icon, { name: "error-outline", size: 64, color: "error-300" }),
|
|
1872
|
-
/* @__PURE__ */ jsx18(AppText, { size: "lg", weight: "medium", color: "error-500", className: "mt-4", children: "\u52A0\u8F7D\u5931\u8D25" }),
|
|
1873
|
-
/* @__PURE__ */ jsx18(AppText, { size: "sm", style: { color: colors.textMuted }, className: "mt-2 text-center px-8", children: error.message || "\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5" }),
|
|
1886
|
+
/* @__PURE__ */ jsx18(AppText, { size: "lg", weight: "medium", color: "error-500", className: "mt-4", children: errorTitle || "\u52A0\u8F7D\u5931\u8D25" }),
|
|
1887
|
+
/* @__PURE__ */ jsx18(AppText, { size: "sm", style: { color: colors.textMuted }, className: "mt-2 text-center px-8", children: error.message || errorDescription || "\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5" }),
|
|
1874
1888
|
onRetry && /* @__PURE__ */ jsx18(
|
|
1875
1889
|
AppPressable,
|
|
1876
1890
|
{
|
|
@@ -1880,7 +1894,7 @@ function ErrorState({ error, onRetry }) {
|
|
|
1880
1894
|
styles3.retryButton,
|
|
1881
1895
|
{ backgroundColor: colors.cardElevated, borderColor: colors.border }
|
|
1882
1896
|
],
|
|
1883
|
-
children: /* @__PURE__ */ jsx18(AppText, { style: { color: colors.textSecondary }, className: "text-center", children: "\u91CD\u65B0\u52A0\u8F7D" })
|
|
1897
|
+
children: /* @__PURE__ */ jsx18(AppText, { style: { color: colors.textSecondary }, className: "text-center", children: retryText || "\u91CD\u65B0\u52A0\u8F7D" })
|
|
1884
1898
|
}
|
|
1885
1899
|
)
|
|
1886
1900
|
] });
|
|
@@ -1911,6 +1925,9 @@ function AppList({
|
|
|
1911
1925
|
onEndReachedThreshold = 0.5,
|
|
1912
1926
|
error,
|
|
1913
1927
|
onRetry,
|
|
1928
|
+
errorTitle,
|
|
1929
|
+
errorDescription,
|
|
1930
|
+
retryText,
|
|
1914
1931
|
emptyTitle,
|
|
1915
1932
|
emptyDescription,
|
|
1916
1933
|
emptyIcon,
|
|
@@ -1979,7 +1996,16 @@ function AppList({
|
|
|
1979
1996
|
);
|
|
1980
1997
|
}
|
|
1981
1998
|
if (error && data.length === 0) {
|
|
1982
|
-
return /* @__PURE__ */ jsx18(Center, { style, children: /* @__PURE__ */ jsx18(
|
|
1999
|
+
return /* @__PURE__ */ jsx18(Center, { style, children: /* @__PURE__ */ jsx18(
|
|
2000
|
+
ErrorState,
|
|
2001
|
+
{
|
|
2002
|
+
error,
|
|
2003
|
+
onRetry,
|
|
2004
|
+
errorTitle,
|
|
2005
|
+
errorDescription,
|
|
2006
|
+
retryText
|
|
2007
|
+
}
|
|
2008
|
+
) });
|
|
1983
2009
|
}
|
|
1984
2010
|
const ListEmptyComponent = useMemo3(() => {
|
|
1985
2011
|
if (EmptyComponent) return /* @__PURE__ */ jsx18(EmptyComponent, {});
|
|
@@ -2141,14 +2167,7 @@ function PageDrawer({
|
|
|
2141
2167
|
}
|
|
2142
2168
|
),
|
|
2143
2169
|
/* @__PURE__ */ jsx19(AppScrollView, { flex: true, className: "px-4 py-4", children }),
|
|
2144
|
-
footer && /* @__PURE__ */ jsx19(
|
|
2145
|
-
AppView,
|
|
2146
|
-
{
|
|
2147
|
-
className: "px-4 py-4",
|
|
2148
|
-
style: [styles4.footer, { borderTopColor: colors.divider }],
|
|
2149
|
-
children: footer
|
|
2150
|
-
}
|
|
2151
|
-
)
|
|
2170
|
+
footer && /* @__PURE__ */ jsx19(AppView, { className: "px-4 py-4", style: [styles4.footer, { borderTopColor: colors.divider }], children: footer })
|
|
2152
2171
|
]
|
|
2153
2172
|
}
|
|
2154
2173
|
);
|
|
@@ -2810,6 +2829,9 @@ import {
|
|
|
2810
2829
|
StyleSheet as StyleSheet11
|
|
2811
2830
|
} from "react-native";
|
|
2812
2831
|
import { Fragment as Fragment2, jsx as jsx28, jsxs as jsxs10 } from "nativewind/jsx-runtime";
|
|
2832
|
+
function formatSelectedCountText(template, count) {
|
|
2833
|
+
return template.replace("{{count}}", String(count));
|
|
2834
|
+
}
|
|
2813
2835
|
function Select({
|
|
2814
2836
|
value,
|
|
2815
2837
|
onChange,
|
|
@@ -2820,6 +2842,12 @@ function Select({
|
|
|
2820
2842
|
onSearch,
|
|
2821
2843
|
disabled = false,
|
|
2822
2844
|
clearable = true,
|
|
2845
|
+
singleSelectTitle = "\u8BF7\u9009\u62E9",
|
|
2846
|
+
multipleSelectTitle = "\u9009\u62E9\u9009\u9879",
|
|
2847
|
+
searchPlaceholder = "\u641C\u7D22...",
|
|
2848
|
+
emptyText = "\u6682\u65E0\u9009\u9879",
|
|
2849
|
+
selectedCountText = "\u5DF2\u9009\u62E9 {{count}} \u9879",
|
|
2850
|
+
confirmText = "\u786E\u5B9A",
|
|
2823
2851
|
className
|
|
2824
2852
|
}) {
|
|
2825
2853
|
const colors = useFormThemeColors();
|
|
@@ -2943,7 +2971,7 @@ function Select({
|
|
|
2943
2971
|
className: "px-4 py-3",
|
|
2944
2972
|
style: [styles10.header, { borderBottomColor: colors.divider }],
|
|
2945
2973
|
children: [
|
|
2946
|
-
/* @__PURE__ */ jsx28(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: multiple ?
|
|
2974
|
+
/* @__PURE__ */ jsx28(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: multiple ? multipleSelectTitle : singleSelectTitle }),
|
|
2947
2975
|
/* @__PURE__ */ jsx28(TouchableOpacity5, { onPress: () => setVisible(false), children: /* @__PURE__ */ jsx28(Icon, { name: "close", size: "md", color: colors.icon }) })
|
|
2948
2976
|
]
|
|
2949
2977
|
}
|
|
@@ -2967,7 +2995,7 @@ function Select({
|
|
|
2967
2995
|
{
|
|
2968
2996
|
className: "flex-1 text-base",
|
|
2969
2997
|
style: { color: colors.text },
|
|
2970
|
-
placeholder:
|
|
2998
|
+
placeholder: searchPlaceholder,
|
|
2971
2999
|
placeholderTextColor: colors.textMuted,
|
|
2972
3000
|
value: searchKeyword,
|
|
2973
3001
|
onChangeText: handleSearch,
|
|
@@ -2986,7 +3014,7 @@ function Select({
|
|
|
2986
3014
|
data: filteredOptions,
|
|
2987
3015
|
keyExtractor: (item) => item.value,
|
|
2988
3016
|
renderItem: renderOption,
|
|
2989
|
-
ListEmptyComponent: /* @__PURE__ */ jsx28(AppView, { center: true, className: "py-8", children: /* @__PURE__ */ jsx28(AppText, { style: { color: colors.textMuted }, children:
|
|
3017
|
+
ListEmptyComponent: /* @__PURE__ */ jsx28(AppView, { center: true, className: "py-8", children: /* @__PURE__ */ jsx28(AppText, { style: { color: colors.textMuted }, children: emptyText }) })
|
|
2990
3018
|
}
|
|
2991
3019
|
),
|
|
2992
3020
|
multiple && /* @__PURE__ */ jsxs10(
|
|
@@ -2998,18 +3026,14 @@ function Select({
|
|
|
2998
3026
|
className: "px-4 py-3",
|
|
2999
3027
|
style: [styles10.footer, { borderTopColor: colors.divider }],
|
|
3000
3028
|
children: [
|
|
3001
|
-
/* @__PURE__ */
|
|
3002
|
-
"\u5DF2\u9009\u62E9 ",
|
|
3003
|
-
selectedValues.length,
|
|
3004
|
-
" \u9879"
|
|
3005
|
-
] }),
|
|
3029
|
+
/* @__PURE__ */ jsx28(AppText, { style: { color: colors.textMuted }, children: formatSelectedCountText(selectedCountText, selectedValues.length) }),
|
|
3006
3030
|
/* @__PURE__ */ jsx28(
|
|
3007
3031
|
TouchableOpacity5,
|
|
3008
3032
|
{
|
|
3009
3033
|
className: "px-4 py-2 rounded-lg",
|
|
3010
3034
|
style: { backgroundColor: colors.primary },
|
|
3011
3035
|
onPress: () => setVisible(false),
|
|
3012
|
-
children: /* @__PURE__ */ jsx28(AppText, { className: "font-medium", style: { color: colors.textInverse }, children:
|
|
3036
|
+
children: /* @__PURE__ */ jsx28(AppText, { className: "font-medium", style: { color: colors.textInverse }, children: confirmText })
|
|
3013
3037
|
}
|
|
3014
3038
|
)
|
|
3015
3039
|
]
|
|
@@ -3100,7 +3124,17 @@ function DatePicker({
|
|
|
3100
3124
|
format = "yyyy-MM-dd",
|
|
3101
3125
|
minDate,
|
|
3102
3126
|
maxDate,
|
|
3103
|
-
className
|
|
3127
|
+
className,
|
|
3128
|
+
cancelText = "\u53D6\u6D88",
|
|
3129
|
+
confirmText = "\u786E\u5B9A",
|
|
3130
|
+
pickerTitle = "\u9009\u62E9\u65E5\u671F",
|
|
3131
|
+
pickerDateFormat = "yyyy\u5E74MM\u6708dd\u65E5",
|
|
3132
|
+
yearLabel = "\u5E74",
|
|
3133
|
+
monthLabel = "\u6708",
|
|
3134
|
+
dayLabel = "\u65E5",
|
|
3135
|
+
todayText = "\u4ECA\u5929",
|
|
3136
|
+
minDateText = "\u6700\u65E9",
|
|
3137
|
+
maxDateText = "\u6700\u665A"
|
|
3104
3138
|
}) {
|
|
3105
3139
|
const colors = useFormThemeColors();
|
|
3106
3140
|
const [visible, setVisible] = useState18(false);
|
|
@@ -3194,18 +3228,18 @@ function DatePicker({
|
|
|
3194
3228
|
className: "px-4 py-3",
|
|
3195
3229
|
style: [styles11.header, { borderBottomColor: colors.divider }],
|
|
3196
3230
|
children: [
|
|
3197
|
-
/* @__PURE__ */ jsx29(TouchableOpacity6, { onPress: () => setVisible(false), children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.textMuted }, children:
|
|
3198
|
-
/* @__PURE__ */ jsx29(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children:
|
|
3199
|
-
/* @__PURE__ */ jsx29(TouchableOpacity6, { onPress: handleConfirm, children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.primary }, className: "font-medium", children:
|
|
3231
|
+
/* @__PURE__ */ jsx29(TouchableOpacity6, { onPress: () => setVisible(false), children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.textMuted }, children: cancelText }) }),
|
|
3232
|
+
/* @__PURE__ */ jsx29(AppText, { className: "text-lg font-semibold", style: { color: colors.text }, children: pickerTitle }),
|
|
3233
|
+
/* @__PURE__ */ jsx29(TouchableOpacity6, { onPress: handleConfirm, children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.primary }, className: "font-medium", children: confirmText }) })
|
|
3200
3234
|
]
|
|
3201
3235
|
}
|
|
3202
3236
|
),
|
|
3203
|
-
/* @__PURE__ */ jsx29(AppView, { center: true, className: "py-4", style: { backgroundColor: colors.headerSurface }, children: /* @__PURE__ */ jsx29(AppText, { className: "text-2xl font-semibold", style: { color: colors.text }, children: formatDate(tempDate,
|
|
3237
|
+
/* @__PURE__ */ jsx29(AppView, { center: true, className: "py-4", style: { backgroundColor: colors.headerSurface }, children: /* @__PURE__ */ jsx29(AppText, { className: "text-2xl font-semibold", style: { color: colors.text }, children: formatDate(tempDate, pickerDateFormat) }) }),
|
|
3204
3238
|
/* @__PURE__ */ jsxs11(AppView, { row: true, className: "h-48", children: [
|
|
3205
3239
|
/* @__PURE__ */ jsx29(
|
|
3206
3240
|
PickerColumn,
|
|
3207
3241
|
{
|
|
3208
|
-
title:
|
|
3242
|
+
title: yearLabel,
|
|
3209
3243
|
values: years,
|
|
3210
3244
|
selectedValue: tempDate.getFullYear(),
|
|
3211
3245
|
onSelect: (year) => updateTempDate(year),
|
|
@@ -3217,7 +3251,7 @@ function DatePicker({
|
|
|
3217
3251
|
/* @__PURE__ */ jsx29(
|
|
3218
3252
|
PickerColumn,
|
|
3219
3253
|
{
|
|
3220
|
-
title:
|
|
3254
|
+
title: monthLabel,
|
|
3221
3255
|
values: months,
|
|
3222
3256
|
selectedValue: tempDate.getMonth() + 1,
|
|
3223
3257
|
onSelect: (month) => updateTempDate(void 0, month),
|
|
@@ -3230,7 +3264,7 @@ function DatePicker({
|
|
|
3230
3264
|
/* @__PURE__ */ jsx29(
|
|
3231
3265
|
PickerColumn,
|
|
3232
3266
|
{
|
|
3233
|
-
title:
|
|
3267
|
+
title: dayLabel,
|
|
3234
3268
|
values: days,
|
|
3235
3269
|
selectedValue: tempDate.getDate(),
|
|
3236
3270
|
onSelect: (day) => updateTempDate(void 0, void 0, day),
|
|
@@ -3252,7 +3286,7 @@ function DatePicker({
|
|
|
3252
3286
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3253
3287
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3254
3288
|
onPress: () => setTempDate(/* @__PURE__ */ new Date()),
|
|
3255
|
-
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children:
|
|
3289
|
+
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children: todayText })
|
|
3256
3290
|
}
|
|
3257
3291
|
),
|
|
3258
3292
|
minDate && /* @__PURE__ */ jsx29(
|
|
@@ -3261,7 +3295,7 @@ function DatePicker({
|
|
|
3261
3295
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3262
3296
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3263
3297
|
onPress: () => setTempDate(minDate),
|
|
3264
|
-
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children:
|
|
3298
|
+
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children: minDateText })
|
|
3265
3299
|
}
|
|
3266
3300
|
),
|
|
3267
3301
|
maxDate && /* @__PURE__ */ jsx29(
|
|
@@ -3270,7 +3304,7 @@ function DatePicker({
|
|
|
3270
3304
|
className: "flex-1 py-2 items-center rounded-lg",
|
|
3271
3305
|
style: { backgroundColor: colors.surfaceMuted },
|
|
3272
3306
|
onPress: () => setTempDate(maxDate),
|
|
3273
|
-
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children:
|
|
3307
|
+
children: /* @__PURE__ */ jsx29(AppText, { style: { color: colors.text }, children: maxDateText })
|
|
3274
3308
|
}
|
|
3275
3309
|
)
|
|
3276
3310
|
]
|
|
@@ -4293,6 +4327,7 @@ import { SafeAreaProvider } from "react-native-safe-area-context";
|
|
|
4293
4327
|
|
|
4294
4328
|
// src/overlay/AppStatusBar.tsx
|
|
4295
4329
|
import { StatusBar } from "react-native";
|
|
4330
|
+
import { useIsFocused as useIsFocused2 } from "@react-navigation/native";
|
|
4296
4331
|
import { jsx as jsx38 } from "nativewind/jsx-runtime";
|
|
4297
4332
|
function AppStatusBar({
|
|
4298
4333
|
barStyle = "auto",
|
|
@@ -4313,6 +4348,11 @@ function AppStatusBar({
|
|
|
4313
4348
|
}
|
|
4314
4349
|
);
|
|
4315
4350
|
}
|
|
4351
|
+
function AppFocusedStatusBar(props) {
|
|
4352
|
+
const isFocused = useIsFocused2();
|
|
4353
|
+
if (!isFocused) return null;
|
|
4354
|
+
return /* @__PURE__ */ jsx38(AppStatusBar, { ...props });
|
|
4355
|
+
}
|
|
4316
4356
|
|
|
4317
4357
|
// src/overlay/loading/provider.tsx
|
|
4318
4358
|
import { useState as useState27, useCallback as useCallback19 } from "react";
|
|
@@ -4651,12 +4691,14 @@ export {
|
|
|
4651
4691
|
ActionIcons,
|
|
4652
4692
|
Alert,
|
|
4653
4693
|
AppButton,
|
|
4694
|
+
AppFocusedStatusBar,
|
|
4654
4695
|
AppHeader,
|
|
4655
4696
|
AppImage,
|
|
4656
4697
|
AppInput,
|
|
4657
4698
|
AppList,
|
|
4658
4699
|
AppPressable,
|
|
4659
4700
|
AppProvider,
|
|
4701
|
+
AppScreen,
|
|
4660
4702
|
AppScrollView,
|
|
4661
4703
|
AppStatusBar,
|
|
4662
4704
|
AppText,
|
|
@@ -4681,7 +4723,6 @@ export {
|
|
|
4681
4723
|
NavigationIcons,
|
|
4682
4724
|
NavigationProvider,
|
|
4683
4725
|
OverlayProvider,
|
|
4684
|
-
Page,
|
|
4685
4726
|
PageDrawer,
|
|
4686
4727
|
Progress,
|
|
4687
4728
|
Radio,
|