@retray-dev/ui-kit 1.7.0 → 2.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/COMPONENTS.md +258 -54
- package/README.md +6 -5
- package/dist/index.d.mts +113 -44
- package/dist/index.d.ts +113 -44
- package/dist/index.js +802 -324
- package/dist/index.mjs +794 -323
- package/package.json +6 -2
- package/src/components/Alert/Alert.tsx +24 -12
- package/src/components/AlertBanner/AlertBanner.tsx +83 -0
- package/src/components/AlertBanner/index.ts +2 -0
- package/src/components/Avatar/Avatar.tsx +1 -0
- package/src/components/Badge/Badge.tsx +44 -8
- package/src/components/Button/Button.tsx +12 -5
- package/src/components/Card/Card.tsx +86 -9
- package/src/components/Chip/Chip.tsx +173 -0
- package/src/components/Chip/index.ts +2 -0
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +87 -0
- package/src/components/ConfirmDialog/index.ts +2 -0
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +4 -2
- package/src/components/CurrencyInput/CurrencyInput.tsx +9 -1
- package/src/components/EmptyState/EmptyState.tsx +42 -7
- package/src/components/Input/Input.tsx +102 -21
- package/src/components/LabelValue/LabelValue.tsx +47 -0
- package/src/components/LabelValue/index.ts +2 -0
- package/src/components/ListItem/ListItem.tsx +121 -0
- package/src/components/ListItem/index.ts +2 -0
- package/src/components/MonthPicker/MonthPicker.tsx +92 -0
- package/src/components/MonthPicker/index.ts +2 -0
- package/src/components/Select/Select.tsx +189 -125
- package/src/components/Slider/Slider.tsx +64 -100
- package/src/components/Switch/Switch.tsx +25 -21
- package/src/components/Textarea/Textarea.tsx +12 -2
- package/src/components/Toggle/Toggle.tsx +13 -6
- package/src/index.ts +8 -2
- package/src/theme/ThemeProvider.tsx +11 -8
- package/src/theme/colors.ts +19 -18
- package/src/theme/types.ts +2 -0
- package/src/components/Alert/index.ts +0 -2
- package/src/components/CurrencyInputLarge/CurrencyInputLarge.tsx +0 -66
- package/src/components/CurrencyInputLarge/index.ts +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React23, { createContext, useMemo, useContext, useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { StyleSheet, useColorScheme, Animated, TouchableOpacity, ActivityIndicator, Text, View, TextInput, Image, Easing,
|
|
3
|
-
import * as
|
|
2
|
+
import { Platform, StyleSheet, useColorScheme, Animated, TouchableOpacity, ActivityIndicator, Text, View, TextInput, Image, Easing, Modal } from 'react-native';
|
|
3
|
+
import * as Haptics12 from 'expo-haptics';
|
|
4
4
|
import { LinearGradient } from 'expo-linear-gradient';
|
|
5
5
|
import ReanimatedAnimated, { useSharedValue, useAnimatedStyle, withTiming, Easing as Easing$1, withSpring } from 'react-native-reanimated';
|
|
6
|
+
import RNSlider from '@react-native-community/slider';
|
|
6
7
|
import { BottomSheetModal, BottomSheetView, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
|
|
7
8
|
export { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
9
|
+
import { Picker } from '@react-native-picker/picker';
|
|
8
10
|
import { scheduleOnRN } from 'react-native-worklets';
|
|
9
11
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
10
12
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
@@ -18,41 +20,41 @@ var defaultLight = {
|
|
|
18
20
|
card: "#ffffff",
|
|
19
21
|
cardForeground: "#171717",
|
|
20
22
|
primary: "#1a1a1a",
|
|
21
|
-
primaryForeground: "#
|
|
22
|
-
secondary: "#
|
|
23
|
-
secondaryForeground: "#
|
|
24
|
-
muted: "#
|
|
25
|
-
mutedForeground: "#
|
|
26
|
-
accent: "#
|
|
27
|
-
accentForeground: "#
|
|
23
|
+
primaryForeground: "#ffffff",
|
|
24
|
+
secondary: "#f1f1f1",
|
|
25
|
+
secondaryForeground: "#171717",
|
|
26
|
+
muted: "#f1f1f1",
|
|
27
|
+
mutedForeground: "#a2a2a2",
|
|
28
|
+
accent: "#e4e4e4",
|
|
29
|
+
accentForeground: "#171717",
|
|
28
30
|
destructive: "#ef4444",
|
|
29
|
-
destructiveForeground: "#
|
|
31
|
+
destructiveForeground: "#1a1a1a",
|
|
30
32
|
border: "#e5e5e5",
|
|
31
33
|
input: "#e5e5e5",
|
|
32
|
-
ring: "#
|
|
34
|
+
ring: "#1a1a1a",
|
|
33
35
|
success: "#16a34a",
|
|
34
|
-
successForeground: "#
|
|
36
|
+
successForeground: "#1a1a1a"
|
|
35
37
|
};
|
|
36
38
|
var defaultDark = {
|
|
37
39
|
background: "#171717",
|
|
38
40
|
foreground: "#fafafa",
|
|
39
|
-
card: "#
|
|
41
|
+
card: "#222222",
|
|
40
42
|
cardForeground: "#fafafa",
|
|
41
43
|
primary: "#fafafa",
|
|
42
44
|
primaryForeground: "#1a1a1a",
|
|
43
|
-
secondary: "#
|
|
45
|
+
secondary: "#323232",
|
|
44
46
|
secondaryForeground: "#fafafa",
|
|
45
|
-
muted: "#
|
|
46
|
-
mutedForeground: "#
|
|
47
|
-
accent: "#
|
|
47
|
+
muted: "#323232",
|
|
48
|
+
mutedForeground: "#888888",
|
|
49
|
+
accent: "#323232",
|
|
48
50
|
accentForeground: "#fafafa",
|
|
49
51
|
destructive: "#dc2626",
|
|
50
|
-
destructiveForeground: "#
|
|
52
|
+
destructiveForeground: "#1a1a1a",
|
|
51
53
|
border: "#2a2a2a",
|
|
52
54
|
input: "#2a2a2a",
|
|
53
|
-
ring: "#
|
|
55
|
+
ring: "#fafafa",
|
|
54
56
|
success: "#22c55e",
|
|
55
|
-
successForeground: "#
|
|
57
|
+
successForeground: "#1a1a1a"
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
// src/theme/ThemeProvider.tsx
|
|
@@ -65,14 +67,19 @@ function ThemeProvider({ children, theme, colorScheme = "system" }) {
|
|
|
65
67
|
const resolvedScheme = colorScheme === "system" ? systemScheme : colorScheme;
|
|
66
68
|
const colors = useMemo(() => {
|
|
67
69
|
const base = resolvedScheme === "dark" ? defaultDark : defaultLight;
|
|
68
|
-
const
|
|
69
|
-
return { ...base, ...
|
|
70
|
+
const override = resolvedScheme === "dark" ? theme?.dark : theme?.light;
|
|
71
|
+
return override ? { ...base, ...override } : base;
|
|
70
72
|
}, [resolvedScheme, theme]);
|
|
71
73
|
return /* @__PURE__ */ React23.createElement(ThemeContext.Provider, { value: { colors, colorScheme: resolvedScheme } }, children);
|
|
72
74
|
}
|
|
73
75
|
function useTheme() {
|
|
74
|
-
|
|
76
|
+
const context = useContext(ThemeContext);
|
|
77
|
+
if (!context) {
|
|
78
|
+
throw new Error("useTheme must be used within a ThemeProvider");
|
|
79
|
+
}
|
|
80
|
+
return context;
|
|
75
81
|
}
|
|
82
|
+
var nativeDriver = Platform.OS !== "web";
|
|
76
83
|
var containerSizeStyles = {
|
|
77
84
|
sm: { paddingHorizontal: 20, paddingVertical: 12 },
|
|
78
85
|
md: { paddingHorizontal: 24, paddingVertical: 16 },
|
|
@@ -103,31 +110,33 @@ function Button({
|
|
|
103
110
|
if (isDisabled) return;
|
|
104
111
|
Animated.spring(scale, {
|
|
105
112
|
toValue: 0.95,
|
|
106
|
-
useNativeDriver:
|
|
113
|
+
useNativeDriver: nativeDriver,
|
|
107
114
|
speed: 40,
|
|
108
115
|
bounciness: 0
|
|
109
116
|
}).start();
|
|
110
117
|
};
|
|
111
118
|
const handlePressOut = () => {
|
|
112
|
-
Animated.spring(scale, { toValue: 1, useNativeDriver:
|
|
119
|
+
Animated.spring(scale, { toValue: 1, useNativeDriver: nativeDriver, speed: 40, bounciness: 4 }).start();
|
|
113
120
|
};
|
|
114
121
|
const handlePress = (e) => {
|
|
115
|
-
|
|
122
|
+
Haptics12.impactAsync(Haptics12.ImpactFeedbackStyle.Light);
|
|
116
123
|
onPress?.(e);
|
|
117
124
|
};
|
|
118
125
|
const containerVariantStyle = {
|
|
119
126
|
primary: { backgroundColor: colors.primary },
|
|
120
127
|
secondary: { backgroundColor: colors.secondary },
|
|
121
128
|
outline: { backgroundColor: "transparent", borderWidth: 1.5, borderColor: colors.border },
|
|
122
|
-
ghost: { backgroundColor: "transparent" }
|
|
129
|
+
ghost: { backgroundColor: "transparent" },
|
|
130
|
+
destructive: { backgroundColor: colors.destructive }
|
|
123
131
|
}[variant];
|
|
124
132
|
const labelVariantStyle = {
|
|
125
133
|
primary: { color: colors.primaryForeground },
|
|
126
134
|
secondary: { color: colors.secondaryForeground },
|
|
127
135
|
outline: { color: colors.foreground },
|
|
128
|
-
ghost: { color: colors.foreground }
|
|
136
|
+
ghost: { color: colors.foreground },
|
|
137
|
+
destructive: { color: colors.destructiveForeground }
|
|
129
138
|
}[variant];
|
|
130
|
-
const spinnerColor = variant === "primary" || variant === "secondary" ? colors.primaryForeground : colors.foreground;
|
|
139
|
+
const spinnerColor = variant === "destructive" ? colors.destructiveForeground : variant === "primary" || variant === "secondary" ? colors.primaryForeground : colors.foreground;
|
|
131
140
|
return /* @__PURE__ */ React23.createElement(Animated.View, { style: [fullWidth && styles.fullWidth, { transform: [{ scale }] }] }, /* @__PURE__ */ React23.createElement(
|
|
132
141
|
TouchableOpacity,
|
|
133
142
|
{
|
|
@@ -161,7 +170,7 @@ var styles = StyleSheet.create({
|
|
|
161
170
|
width: "100%"
|
|
162
171
|
},
|
|
163
172
|
disabled: {
|
|
164
|
-
opacity: 0.
|
|
173
|
+
opacity: 0.5
|
|
165
174
|
},
|
|
166
175
|
label: {
|
|
167
176
|
fontWeight: "600"
|
|
@@ -191,33 +200,52 @@ function Text2({ variant = "body", color, style, children, ...props }) {
|
|
|
191
200
|
children
|
|
192
201
|
);
|
|
193
202
|
}
|
|
194
|
-
|
|
203
|
+
var webInputResetStyle = Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
204
|
+
function Input({ label, error, hint, prefix, suffix, prefixStyle, suffixStyle, type = "text", containerStyle, style, onFocus, onBlur, secureTextEntry, ...props }) {
|
|
195
205
|
const { colors } = useTheme();
|
|
196
206
|
const [focused, setFocused] = useState(false);
|
|
207
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
208
|
+
const isPassword = type === "password";
|
|
209
|
+
const effectiveSecure = isPassword ? !showPassword : secureTextEntry;
|
|
210
|
+
const effectiveSuffix = isPassword && !suffix ? /* @__PURE__ */ React23.createElement(TouchableOpacity, { onPress: () => setShowPassword(!showPassword), style: styles2.passwordToggle, activeOpacity: 0.6 }, /* @__PURE__ */ React23.createElement(Text, { style: [styles2.suffixText, { color: colors.mutedForeground }] }, showPassword ? "\u{1F441}" : "\u{1F441}\u200D\u{1F5E8}")) : suffix;
|
|
197
211
|
return /* @__PURE__ */ React23.createElement(View, { style: [styles2.container, containerStyle] }, label ? /* @__PURE__ */ React23.createElement(Text, { style: [styles2.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, /* @__PURE__ */ React23.createElement(
|
|
198
|
-
|
|
212
|
+
View,
|
|
199
213
|
{
|
|
200
214
|
style: [
|
|
201
|
-
styles2.
|
|
215
|
+
styles2.inputWrapper,
|
|
202
216
|
{
|
|
203
|
-
borderColor: error ? colors.destructive : focused ? colors.ring : colors.border,
|
|
204
|
-
color: colors.foreground,
|
|
217
|
+
borderColor: error ? colors.destructive : focused ? colors.ring ?? colors.primary : colors.border,
|
|
205
218
|
backgroundColor: colors.background
|
|
219
|
+
}
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
prefix ? typeof prefix === "string" ? /* @__PURE__ */ React23.createElement(Text, { style: [styles2.prefixText, { color: colors.mutedForeground }, prefixStyle], allowFontScaling: true }, prefix) : /* @__PURE__ */ React23.createElement(View, { style: styles2.prefixContainer }, prefix) : null,
|
|
223
|
+
/* @__PURE__ */ React23.createElement(
|
|
224
|
+
TextInput,
|
|
225
|
+
{
|
|
226
|
+
style: [
|
|
227
|
+
styles2.input,
|
|
228
|
+
{
|
|
229
|
+
color: colors.foreground
|
|
230
|
+
},
|
|
231
|
+
webInputResetStyle,
|
|
232
|
+
style
|
|
233
|
+
],
|
|
234
|
+
onFocus: (e) => {
|
|
235
|
+
setFocused(true);
|
|
236
|
+
onFocus?.(e);
|
|
206
237
|
},
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
allowFontScaling: true,
|
|
219
|
-
...props
|
|
220
|
-
}
|
|
238
|
+
onBlur: (e) => {
|
|
239
|
+
setFocused(false);
|
|
240
|
+
onBlur?.(e);
|
|
241
|
+
},
|
|
242
|
+
placeholderTextColor: colors.mutedForeground,
|
|
243
|
+
allowFontScaling: true,
|
|
244
|
+
secureTextEntry: effectiveSecure,
|
|
245
|
+
...props
|
|
246
|
+
}
|
|
247
|
+
),
|
|
248
|
+
effectiveSuffix ? typeof effectiveSuffix === "string" ? /* @__PURE__ */ React23.createElement(Text, { style: [styles2.suffixText, { color: colors.mutedForeground }, suffixStyle], allowFontScaling: true }, effectiveSuffix) : /* @__PURE__ */ React23.createElement(View, { style: styles2.suffixContainer }, effectiveSuffix) : null
|
|
221
249
|
), error ? /* @__PURE__ */ React23.createElement(Text, { style: [styles2.helperText, { color: colors.destructive }], allowFontScaling: true }, error) : null, !error && hint ? /* @__PURE__ */ React23.createElement(Text, { style: [styles2.helperText, { color: colors.mutedForeground }], allowFontScaling: true }, hint) : null);
|
|
222
250
|
}
|
|
223
251
|
var styles2 = StyleSheet.create({
|
|
@@ -229,18 +257,56 @@ var styles2 = StyleSheet.create({
|
|
|
229
257
|
fontWeight: "500",
|
|
230
258
|
marginBottom: 6
|
|
231
259
|
},
|
|
232
|
-
|
|
260
|
+
inputWrapper: {
|
|
261
|
+
flexDirection: "row",
|
|
262
|
+
alignItems: "center",
|
|
233
263
|
borderWidth: 1.5,
|
|
234
264
|
borderRadius: 14,
|
|
235
265
|
paddingHorizontal: 20,
|
|
236
|
-
paddingVertical: 16
|
|
237
|
-
|
|
266
|
+
paddingVertical: 16
|
|
267
|
+
},
|
|
268
|
+
input: {
|
|
269
|
+
flex: 1,
|
|
270
|
+
fontSize: 17,
|
|
271
|
+
paddingVertical: 0
|
|
272
|
+
},
|
|
273
|
+
prefixContainer: {
|
|
274
|
+
marginRight: 8
|
|
275
|
+
},
|
|
276
|
+
prefixText: {
|
|
277
|
+
fontSize: 17,
|
|
278
|
+
marginRight: 8
|
|
279
|
+
},
|
|
280
|
+
suffixContainer: {
|
|
281
|
+
marginLeft: 8
|
|
282
|
+
},
|
|
283
|
+
suffixText: {
|
|
284
|
+
fontSize: 17,
|
|
285
|
+
marginLeft: 8
|
|
286
|
+
},
|
|
287
|
+
passwordToggle: {
|
|
288
|
+
padding: 4
|
|
238
289
|
},
|
|
239
290
|
helperText: {
|
|
240
291
|
fontSize: 13
|
|
241
292
|
}
|
|
242
293
|
});
|
|
243
|
-
|
|
294
|
+
var sizePadding = {
|
|
295
|
+
sm: { paddingHorizontal: 8, paddingVertical: 2 },
|
|
296
|
+
md: { paddingHorizontal: 10, paddingVertical: 4 },
|
|
297
|
+
lg: { paddingHorizontal: 12, paddingVertical: 6 }
|
|
298
|
+
};
|
|
299
|
+
var sizeFontSize = {
|
|
300
|
+
sm: { fontSize: 11 },
|
|
301
|
+
md: { fontSize: 13 },
|
|
302
|
+
lg: { fontSize: 15 }
|
|
303
|
+
};
|
|
304
|
+
var sizeIconGap = {
|
|
305
|
+
sm: 4,
|
|
306
|
+
md: 6,
|
|
307
|
+
lg: 6
|
|
308
|
+
};
|
|
309
|
+
function Badge({ label, children, variant = "default", size = "md", icon, style }) {
|
|
244
310
|
const { colors } = useTheme();
|
|
245
311
|
const containerStyle = {
|
|
246
312
|
default: { backgroundColor: colors.primary },
|
|
@@ -254,40 +320,100 @@ function Badge({ label, variant = "default", style }) {
|
|
|
254
320
|
destructive: colors.destructiveForeground,
|
|
255
321
|
outline: colors.foreground
|
|
256
322
|
}[variant];
|
|
257
|
-
|
|
323
|
+
const content = children ?? label;
|
|
324
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles3.container, containerStyle, sizePadding[size], { gap: sizeIconGap[size] }, style] }, icon ? /* @__PURE__ */ React23.createElement(View, { style: styles3.iconContainer }, icon) : null, typeof content === "string" ? /* @__PURE__ */ React23.createElement(Text, { style: [styles3.label, { color: textColor }, sizeFontSize[size]], allowFontScaling: true }, content) : content);
|
|
258
325
|
}
|
|
259
326
|
var styles3 = StyleSheet.create({
|
|
260
327
|
container: {
|
|
261
328
|
borderRadius: 8,
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
329
|
+
alignSelf: "flex-start",
|
|
330
|
+
flexDirection: "row",
|
|
331
|
+
alignItems: "center"
|
|
332
|
+
},
|
|
333
|
+
iconContainer: {
|
|
334
|
+
justifyContent: "center",
|
|
335
|
+
alignItems: "center"
|
|
265
336
|
},
|
|
266
337
|
label: {
|
|
267
|
-
fontSize: 13,
|
|
268
338
|
fontWeight: "500"
|
|
269
339
|
}
|
|
270
340
|
});
|
|
271
|
-
|
|
341
|
+
var nativeDriver2 = Platform.OS !== "web";
|
|
342
|
+
function Card({ children, variant = "elevated", onPress, style }) {
|
|
272
343
|
const { colors } = useTheme();
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
344
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
345
|
+
const handlePressIn = () => {
|
|
346
|
+
if (!onPress) return;
|
|
347
|
+
Animated.spring(scale, {
|
|
348
|
+
toValue: 0.98,
|
|
349
|
+
useNativeDriver: nativeDriver2,
|
|
350
|
+
speed: 40,
|
|
351
|
+
bounciness: 0
|
|
352
|
+
}).start();
|
|
353
|
+
};
|
|
354
|
+
const handlePressOut = () => {
|
|
355
|
+
if (!onPress) return;
|
|
356
|
+
Animated.spring(scale, {
|
|
357
|
+
toValue: 1,
|
|
358
|
+
useNativeDriver: nativeDriver2,
|
|
359
|
+
speed: 40,
|
|
360
|
+
bounciness: 4
|
|
361
|
+
}).start();
|
|
362
|
+
};
|
|
363
|
+
const handlePress = () => {
|
|
364
|
+
if (!onPress) return;
|
|
365
|
+
Haptics12.impactAsync(Haptics12.ImpactFeedbackStyle.Light);
|
|
366
|
+
onPress();
|
|
367
|
+
};
|
|
368
|
+
const variantStyle = {
|
|
369
|
+
elevated: {
|
|
370
|
+
backgroundColor: colors.card,
|
|
371
|
+
borderColor: colors.border,
|
|
372
|
+
shadowColor: "#000",
|
|
373
|
+
shadowOffset: { width: 0, height: 1 },
|
|
374
|
+
shadowOpacity: 0.05,
|
|
375
|
+
shadowRadius: 2,
|
|
376
|
+
elevation: 1
|
|
277
377
|
},
|
|
278
|
-
|
|
279
|
-
|
|
378
|
+
outlined: {
|
|
379
|
+
backgroundColor: colors.card,
|
|
380
|
+
borderColor: colors.border,
|
|
381
|
+
shadowOpacity: 0,
|
|
382
|
+
elevation: 0
|
|
383
|
+
},
|
|
384
|
+
filled: {
|
|
385
|
+
backgroundColor: colors.accent,
|
|
386
|
+
borderColor: colors.border,
|
|
387
|
+
shadowOpacity: 0,
|
|
388
|
+
elevation: 0
|
|
389
|
+
}
|
|
390
|
+
}[variant];
|
|
391
|
+
const cardContent = /* @__PURE__ */ React23.createElement(View, { style: [styles4.card, variantStyle, style] }, children);
|
|
392
|
+
if (onPress) {
|
|
393
|
+
return /* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(
|
|
394
|
+
TouchableOpacity,
|
|
395
|
+
{
|
|
396
|
+
onPress: handlePress,
|
|
397
|
+
onPressIn: handlePressIn,
|
|
398
|
+
onPressOut: handlePressOut,
|
|
399
|
+
activeOpacity: 1,
|
|
400
|
+
touchSoundDisabled: true
|
|
401
|
+
},
|
|
402
|
+
cardContent
|
|
403
|
+
));
|
|
404
|
+
}
|
|
405
|
+
return cardContent;
|
|
280
406
|
}
|
|
281
407
|
function CardHeader({ children, style }) {
|
|
282
408
|
return /* @__PURE__ */ React23.createElement(View, { style: [styles4.header, style] }, children);
|
|
283
409
|
}
|
|
284
410
|
function CardTitle({ children, style }) {
|
|
285
411
|
const { colors } = useTheme();
|
|
286
|
-
return /* @__PURE__ */ React23.createElement(Text, { style: [styles4.title, { color: colors.cardForeground }, style] }, children);
|
|
412
|
+
return /* @__PURE__ */ React23.createElement(Text, { style: [styles4.title, { color: colors.cardForeground }, style], allowFontScaling: true }, children);
|
|
287
413
|
}
|
|
288
414
|
function CardDescription({ children, style }) {
|
|
289
415
|
const { colors } = useTheme();
|
|
290
|
-
return /* @__PURE__ */ React23.createElement(Text, { style: [styles4.description, { color: colors.mutedForeground }, style] }, children);
|
|
416
|
+
return /* @__PURE__ */ React23.createElement(Text, { style: [styles4.description, { color: colors.mutedForeground }, style], allowFontScaling: true }, children);
|
|
291
417
|
}
|
|
292
418
|
function CardContent({ children, style }) {
|
|
293
419
|
return /* @__PURE__ */ React23.createElement(View, { style: [styles4.content, style] }, children);
|
|
@@ -441,7 +567,8 @@ function Avatar({ src, fallback, size = "md", style }) {
|
|
|
441
567
|
) : /* @__PURE__ */ React23.createElement(
|
|
442
568
|
Text,
|
|
443
569
|
{
|
|
444
|
-
style: [styles7.fallback, { color: colors.mutedForeground, fontSize: fontSizeMap[size] }]
|
|
570
|
+
style: [styles7.fallback, { color: colors.mutedForeground, fontSize: fontSizeMap[size] }],
|
|
571
|
+
allowFontScaling: true
|
|
445
572
|
},
|
|
446
573
|
fallback?.slice(0, 2).toUpperCase() ?? "?"
|
|
447
574
|
));
|
|
@@ -455,12 +582,13 @@ var styles7 = StyleSheet.create({
|
|
|
455
582
|
fontWeight: "500"
|
|
456
583
|
}
|
|
457
584
|
});
|
|
458
|
-
function
|
|
585
|
+
function AlertBanner({ title, description, variant = "default", icon, style }) {
|
|
459
586
|
const { colors } = useTheme();
|
|
460
|
-
const borderColor = variant === "destructive" ? colors.destructive : colors.border;
|
|
461
|
-
const titleColor = variant === "destructive" ? colors.destructive : colors.foreground;
|
|
462
|
-
const descColor = variant === "destructive" ? colors.destructive : colors.mutedForeground;
|
|
463
|
-
|
|
587
|
+
const borderColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.border;
|
|
588
|
+
const titleColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.foreground;
|
|
589
|
+
const descColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.mutedForeground;
|
|
590
|
+
const defaultIcon = variant === "destructive" ? "\u26A0" : variant === "success" ? "\u2713" : "\u2139";
|
|
591
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles8.container, { backgroundColor: colors.card, borderColor }, style] }, icon ? /* @__PURE__ */ React23.createElement(View, { style: styles8.icon }, icon) : /* @__PURE__ */ React23.createElement(View, { style: styles8.icon }, /* @__PURE__ */ React23.createElement(Text, { style: [styles8.defaultIcon, { color: titleColor }], allowFontScaling: true }, defaultIcon)), /* @__PURE__ */ React23.createElement(View, { style: styles8.content }, title ? /* @__PURE__ */ React23.createElement(Text, { style: [styles8.title, { color: titleColor }], allowFontScaling: true }, title) : null, description ? /* @__PURE__ */ React23.createElement(Text, { style: [styles8.description, { color: descColor }], allowFontScaling: true }, description) : null));
|
|
464
592
|
}
|
|
465
593
|
var styles8 = StyleSheet.create({
|
|
466
594
|
container: {
|
|
@@ -531,9 +659,40 @@ var styles9 = StyleSheet.create({
|
|
|
531
659
|
borderRadius: 999
|
|
532
660
|
}
|
|
533
661
|
});
|
|
534
|
-
function EmptyState({ icon, title, description, action, style }) {
|
|
662
|
+
function EmptyState({ icon, title, description, action, size = "default", style }) {
|
|
535
663
|
const { colors } = useTheme();
|
|
536
|
-
|
|
664
|
+
const isCompact = size === "compact";
|
|
665
|
+
return /* @__PURE__ */ React23.createElement(
|
|
666
|
+
View,
|
|
667
|
+
{
|
|
668
|
+
style: [
|
|
669
|
+
styles10.container,
|
|
670
|
+
isCompact && styles10.containerCompact,
|
|
671
|
+
{ borderColor: colors.border },
|
|
672
|
+
style
|
|
673
|
+
]
|
|
674
|
+
},
|
|
675
|
+
icon ? /* @__PURE__ */ React23.createElement(
|
|
676
|
+
View,
|
|
677
|
+
{
|
|
678
|
+
style: [
|
|
679
|
+
styles10.iconWrapper,
|
|
680
|
+
isCompact && styles10.iconWrapperCompact,
|
|
681
|
+
{ backgroundColor: colors.muted }
|
|
682
|
+
]
|
|
683
|
+
},
|
|
684
|
+
icon
|
|
685
|
+
) : null,
|
|
686
|
+
/* @__PURE__ */ React23.createElement(View, { style: styles10.textWrapper }, /* @__PURE__ */ React23.createElement(
|
|
687
|
+
Text,
|
|
688
|
+
{
|
|
689
|
+
style: [styles10.title, isCompact && styles10.titleCompact, { color: colors.foreground }],
|
|
690
|
+
allowFontScaling: true
|
|
691
|
+
},
|
|
692
|
+
title
|
|
693
|
+
), description && !isCompact ? /* @__PURE__ */ React23.createElement(Text, { style: [styles10.description, { color: colors.mutedForeground }], allowFontScaling: true }, description) : null),
|
|
694
|
+
action && !isCompact ? /* @__PURE__ */ React23.createElement(View, { style: styles10.action }, action) : null
|
|
695
|
+
);
|
|
537
696
|
}
|
|
538
697
|
var styles10 = StyleSheet.create({
|
|
539
698
|
container: {
|
|
@@ -545,6 +704,10 @@ var styles10 = StyleSheet.create({
|
|
|
545
704
|
padding: 32,
|
|
546
705
|
gap: 16
|
|
547
706
|
},
|
|
707
|
+
containerCompact: {
|
|
708
|
+
padding: 20,
|
|
709
|
+
gap: 10
|
|
710
|
+
},
|
|
548
711
|
iconWrapper: {
|
|
549
712
|
width: 48,
|
|
550
713
|
height: 48,
|
|
@@ -552,6 +715,11 @@ var styles10 = StyleSheet.create({
|
|
|
552
715
|
alignItems: "center",
|
|
553
716
|
justifyContent: "center"
|
|
554
717
|
},
|
|
718
|
+
iconWrapperCompact: {
|
|
719
|
+
width: 36,
|
|
720
|
+
height: 36,
|
|
721
|
+
borderRadius: 8
|
|
722
|
+
},
|
|
555
723
|
textWrapper: {
|
|
556
724
|
alignItems: "center",
|
|
557
725
|
gap: 8,
|
|
@@ -562,6 +730,9 @@ var styles10 = StyleSheet.create({
|
|
|
562
730
|
fontWeight: "500",
|
|
563
731
|
textAlign: "center"
|
|
564
732
|
},
|
|
733
|
+
titleCompact: {
|
|
734
|
+
fontSize: 15
|
|
735
|
+
},
|
|
565
736
|
description: {
|
|
566
737
|
fontSize: 14,
|
|
567
738
|
lineHeight: 20,
|
|
@@ -571,6 +742,7 @@ var styles10 = StyleSheet.create({
|
|
|
571
742
|
marginTop: 8
|
|
572
743
|
}
|
|
573
744
|
});
|
|
745
|
+
var webInputResetStyle2 = Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
574
746
|
function Textarea({
|
|
575
747
|
label,
|
|
576
748
|
error,
|
|
@@ -593,11 +765,12 @@ function Textarea({
|
|
|
593
765
|
style: [
|
|
594
766
|
styles11.input,
|
|
595
767
|
{
|
|
596
|
-
borderColor: error ? colors.destructive : focused ? colors.ring : colors.border,
|
|
768
|
+
borderColor: error ? colors.destructive : focused ? colors.ring ?? colors.primary : colors.border,
|
|
597
769
|
color: colors.foreground,
|
|
598
770
|
backgroundColor: colors.background,
|
|
599
771
|
minHeight: rows * 30
|
|
600
772
|
},
|
|
773
|
+
webInputResetStyle2,
|
|
601
774
|
style
|
|
602
775
|
],
|
|
603
776
|
onFocus: (e) => {
|
|
@@ -655,7 +828,7 @@ function Checkbox({
|
|
|
655
828
|
{
|
|
656
829
|
style: [styles12.row, style],
|
|
657
830
|
onPress: () => {
|
|
658
|
-
|
|
831
|
+
Haptics12.selectionAsync();
|
|
659
832
|
onCheckedChange?.(!checked);
|
|
660
833
|
},
|
|
661
834
|
onPressIn: handlePressIn,
|
|
@@ -713,6 +886,7 @@ var styles12 = StyleSheet.create({
|
|
|
713
886
|
lineHeight: 22
|
|
714
887
|
}
|
|
715
888
|
});
|
|
889
|
+
var nativeDriver3 = Platform.OS !== "web";
|
|
716
890
|
var TRACK_WIDTH = 60;
|
|
717
891
|
var TRACK_HEIGHT = 36;
|
|
718
892
|
var THUMB_SIZE = 28;
|
|
@@ -726,7 +900,7 @@ function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
|
726
900
|
Animated.parallel([
|
|
727
901
|
Animated.spring(translateX, {
|
|
728
902
|
toValue: checked ? THUMB_TRAVEL : 0,
|
|
729
|
-
useNativeDriver:
|
|
903
|
+
useNativeDriver: nativeDriver3,
|
|
730
904
|
bounciness: 4
|
|
731
905
|
}),
|
|
732
906
|
Animated.timing(trackOpacity, {
|
|
@@ -740,17 +914,17 @@ function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
|
740
914
|
inputRange: [0, 1],
|
|
741
915
|
outputRange: [colors.muted, colors.primary]
|
|
742
916
|
});
|
|
743
|
-
return /* @__PURE__ */ React23.createElement(
|
|
917
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [{ opacity: disabled ? 0.45 : 1 }, style] }, /* @__PURE__ */ React23.createElement(
|
|
744
918
|
TouchableOpacity,
|
|
745
919
|
{
|
|
746
920
|
onPress: () => {
|
|
747
|
-
|
|
921
|
+
Haptics12.selectionAsync();
|
|
748
922
|
onCheckedChange?.(!checked);
|
|
749
923
|
},
|
|
750
924
|
disabled,
|
|
751
925
|
activeOpacity: 0.8,
|
|
752
926
|
touchSoundDisabled: true,
|
|
753
|
-
style:
|
|
927
|
+
style: styles13.wrapper
|
|
754
928
|
},
|
|
755
929
|
/* @__PURE__ */ React23.createElement(Animated.View, { style: [styles13.track, { backgroundColor: trackColor }] }, /* @__PURE__ */ React23.createElement(
|
|
756
930
|
Animated.View,
|
|
@@ -761,7 +935,7 @@ function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
|
761
935
|
]
|
|
762
936
|
}
|
|
763
937
|
))
|
|
764
|
-
);
|
|
938
|
+
));
|
|
765
939
|
}
|
|
766
940
|
var styles13 = StyleSheet.create({
|
|
767
941
|
wrapper: {},
|
|
@@ -839,10 +1013,14 @@ function Toggle({
|
|
|
839
1013
|
if (typeof prop === "function") return prop(pressed);
|
|
840
1014
|
return prop;
|
|
841
1015
|
};
|
|
842
|
-
if (
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
1016
|
+
if (pressed) {
|
|
1017
|
+
const active = renderProp(activeIcon);
|
|
1018
|
+
if (active) return /* @__PURE__ */ React23.createElement(React23.Fragment, null, active);
|
|
1019
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles14.checkContainer, { borderColor: colors.primary, backgroundColor: colors.primary }] }, /* @__PURE__ */ React23.createElement(Text, { style: [styles14.checkMark, { color: colors.primaryForeground }] }, "\u2713"));
|
|
1020
|
+
}
|
|
1021
|
+
const custom = renderProp(icon);
|
|
1022
|
+
if (custom) return /* @__PURE__ */ React23.createElement(React23.Fragment, null, custom);
|
|
1023
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles14.checkContainer, { borderColor: colors.mutedForeground }] });
|
|
846
1024
|
};
|
|
847
1025
|
return /* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(
|
|
848
1026
|
Animated.View,
|
|
@@ -860,7 +1038,7 @@ function Toggle({
|
|
|
860
1038
|
{
|
|
861
1039
|
style: styles14.touchable,
|
|
862
1040
|
onPress: () => {
|
|
863
|
-
|
|
1041
|
+
Haptics12.selectionAsync();
|
|
864
1042
|
onPressedChange?.(!pressed);
|
|
865
1043
|
},
|
|
866
1044
|
onPressIn: handlePressIn,
|
|
@@ -927,7 +1105,7 @@ function RadioItem({
|
|
|
927
1105
|
style: styles15.row,
|
|
928
1106
|
onPress: () => {
|
|
929
1107
|
if (!option.disabled) {
|
|
930
|
-
|
|
1108
|
+
Haptics12.selectionAsync();
|
|
931
1109
|
onSelect();
|
|
932
1110
|
}
|
|
933
1111
|
},
|
|
@@ -1085,7 +1263,7 @@ function Tabs({ tabs, value, onValueChange, children, style }) {
|
|
|
1085
1263
|
}
|
|
1086
1264
|
}, [active]);
|
|
1087
1265
|
const handlePress = (v) => {
|
|
1088
|
-
|
|
1266
|
+
Haptics12.selectionAsync();
|
|
1089
1267
|
if (!value) setInternal(v);
|
|
1090
1268
|
onValueChange?.(v);
|
|
1091
1269
|
};
|
|
@@ -1210,7 +1388,7 @@ function AccordionItemComponent({
|
|
|
1210
1388
|
{
|
|
1211
1389
|
style: styles17.trigger,
|
|
1212
1390
|
onPress: () => {
|
|
1213
|
-
|
|
1391
|
+
Haptics12.selectionAsync();
|
|
1214
1392
|
onToggle();
|
|
1215
1393
|
},
|
|
1216
1394
|
onPressIn: handlePressIn,
|
|
@@ -1284,116 +1462,63 @@ function Slider({
|
|
|
1284
1462
|
step = 0,
|
|
1285
1463
|
onValueChange,
|
|
1286
1464
|
onSlidingComplete,
|
|
1465
|
+
label,
|
|
1466
|
+
showValue = false,
|
|
1467
|
+
formatValue: formatValue2 = (v) => v.toFixed(2),
|
|
1468
|
+
accessibilityLabel,
|
|
1287
1469
|
disabled,
|
|
1288
1470
|
style
|
|
1289
1471
|
}) {
|
|
1290
1472
|
const { colors } = useTheme();
|
|
1291
|
-
const trackWidth = useRef(0);
|
|
1292
1473
|
const lastSteppedValue = useRef(value);
|
|
1293
|
-
const
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
};
|
|
1300
|
-
const xToValue = (x) => {
|
|
1301
|
-
const ratio = Math.min(Math.max(x / trackWidth.current, 0), 1);
|
|
1302
|
-
const raw = ratio * (maximumValue - minimumValue) + minimumValue;
|
|
1303
|
-
return clamp(snapToStep(raw));
|
|
1304
|
-
};
|
|
1305
|
-
const panResponder = useRef(
|
|
1306
|
-
PanResponder.create({
|
|
1307
|
-
onStartShouldSetPanResponder: () => !disabled,
|
|
1308
|
-
onMoveShouldSetPanResponder: () => !disabled,
|
|
1309
|
-
onPanResponderGrant: (e) => {
|
|
1310
|
-
const x = e.nativeEvent.locationX;
|
|
1311
|
-
const newValue = xToValue(x);
|
|
1312
|
-
setInternalValue(newValue);
|
|
1313
|
-
onValueChange?.(newValue);
|
|
1314
|
-
},
|
|
1315
|
-
onPanResponderMove: (e) => {
|
|
1316
|
-
const x = e.nativeEvent.locationX;
|
|
1317
|
-
const newValue = xToValue(x);
|
|
1318
|
-
if (newValue !== lastSteppedValue.current) {
|
|
1319
|
-
lastSteppedValue.current = newValue;
|
|
1320
|
-
Haptics11.selectionAsync();
|
|
1321
|
-
}
|
|
1322
|
-
setInternalValue(newValue);
|
|
1323
|
-
onValueChange?.(newValue);
|
|
1324
|
-
},
|
|
1325
|
-
onPanResponderRelease: (e) => {
|
|
1326
|
-
const x = e.nativeEvent.locationX;
|
|
1327
|
-
const newValue = xToValue(x);
|
|
1328
|
-
setInternalValue(newValue);
|
|
1329
|
-
onSlidingComplete?.(newValue);
|
|
1330
|
-
}
|
|
1331
|
-
})
|
|
1332
|
-
).current;
|
|
1333
|
-
const onLayout = (e) => {
|
|
1334
|
-
trackWidth.current = e.nativeEvent.layout.width;
|
|
1474
|
+
const handleValueChange = (v) => {
|
|
1475
|
+
if (step && v !== lastSteppedValue.current) {
|
|
1476
|
+
lastSteppedValue.current = v;
|
|
1477
|
+
Haptics12.selectionAsync();
|
|
1478
|
+
}
|
|
1479
|
+
onValueChange?.(v);
|
|
1335
1480
|
};
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
View,
|
|
1481
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles18.wrapper, style], accessibilityLabel }, label || showValue ? /* @__PURE__ */ React23.createElement(View, { style: styles18.header }, label ? /* @__PURE__ */ React23.createElement(Text, { style: [styles18.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, showValue ? /* @__PURE__ */ React23.createElement(Text, { style: [styles18.valueText, { color: colors.mutedForeground }], allowFontScaling: true }, formatValue2(value)) : null) : null, /* @__PURE__ */ React23.createElement(View, { style: disabled ? styles18.disabled : void 0 }, /* @__PURE__ */ React23.createElement(
|
|
1482
|
+
RNSlider,
|
|
1339
1483
|
{
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
styles18.thumb,
|
|
1355
|
-
{
|
|
1356
|
-
left: `${percent}%`,
|
|
1357
|
-
backgroundColor: colors.primary,
|
|
1358
|
-
borderColor: colors.background,
|
|
1359
|
-
transform: [{ translateX: -14 }]
|
|
1360
|
-
}
|
|
1361
|
-
],
|
|
1362
|
-
pointerEvents: "none"
|
|
1363
|
-
}
|
|
1364
|
-
)
|
|
1365
|
-
);
|
|
1484
|
+
value,
|
|
1485
|
+
minimumValue,
|
|
1486
|
+
maximumValue,
|
|
1487
|
+
step: step || 0,
|
|
1488
|
+
disabled,
|
|
1489
|
+
onValueChange: handleValueChange,
|
|
1490
|
+
onSlidingComplete,
|
|
1491
|
+
minimumTrackTintColor: colors.primary,
|
|
1492
|
+
maximumTrackTintColor: colors.muted,
|
|
1493
|
+
thumbTintColor: colors.primary,
|
|
1494
|
+
style: styles18.slider,
|
|
1495
|
+
accessibilityLabel
|
|
1496
|
+
}
|
|
1497
|
+
)));
|
|
1366
1498
|
}
|
|
1367
1499
|
var styles18 = StyleSheet.create({
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
justifyContent: "center",
|
|
1371
|
-
position: "relative"
|
|
1500
|
+
wrapper: {
|
|
1501
|
+
gap: 8
|
|
1372
1502
|
},
|
|
1373
|
-
|
|
1374
|
-
|
|
1503
|
+
header: {
|
|
1504
|
+
flexDirection: "row",
|
|
1505
|
+
justifyContent: "space-between",
|
|
1506
|
+
alignItems: "center"
|
|
1375
1507
|
},
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
overflow: "hidden",
|
|
1380
|
-
width: "100%"
|
|
1508
|
+
label: {
|
|
1509
|
+
fontSize: 15,
|
|
1510
|
+
fontWeight: "500"
|
|
1381
1511
|
},
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1512
|
+
valueText: {
|
|
1513
|
+
fontSize: 14,
|
|
1514
|
+
fontWeight: "500"
|
|
1385
1515
|
},
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
shadowColor: "#000",
|
|
1393
|
-
shadowOffset: { width: 0, height: 1 },
|
|
1394
|
-
shadowOpacity: 0.2,
|
|
1395
|
-
shadowRadius: 2,
|
|
1396
|
-
elevation: 2
|
|
1516
|
+
slider: {
|
|
1517
|
+
width: "100%",
|
|
1518
|
+
height: 40
|
|
1519
|
+
},
|
|
1520
|
+
disabled: {
|
|
1521
|
+
opacity: 0.45
|
|
1397
1522
|
}
|
|
1398
1523
|
});
|
|
1399
1524
|
function Sheet({
|
|
@@ -1409,7 +1534,7 @@ function Sheet({
|
|
|
1409
1534
|
const ref = useRef(null);
|
|
1410
1535
|
useEffect(() => {
|
|
1411
1536
|
if (open) {
|
|
1412
|
-
|
|
1537
|
+
Haptics12.impactAsync(Haptics12.ImpactFeedbackStyle.Light);
|
|
1413
1538
|
ref.current?.present();
|
|
1414
1539
|
} else {
|
|
1415
1540
|
ref.current?.dismiss();
|
|
@@ -1465,6 +1590,9 @@ var styles19 = StyleSheet.create({
|
|
|
1465
1590
|
lineHeight: 20
|
|
1466
1591
|
}
|
|
1467
1592
|
});
|
|
1593
|
+
var isIOS = Platform.OS === "ios";
|
|
1594
|
+
var isAndroid = Platform.OS === "android";
|
|
1595
|
+
var isWeb = Platform.OS === "web";
|
|
1468
1596
|
function Select({
|
|
1469
1597
|
options,
|
|
1470
1598
|
value,
|
|
@@ -1476,8 +1604,10 @@ function Select({
|
|
|
1476
1604
|
style
|
|
1477
1605
|
}) {
|
|
1478
1606
|
const { colors } = useTheme();
|
|
1479
|
-
const bottomSheetRef = useRef(null);
|
|
1480
1607
|
const scale = useRef(new Animated.Value(1)).current;
|
|
1608
|
+
const [pickerVisible, setPickerVisible] = useState(false);
|
|
1609
|
+
const [pendingValue, setPendingValue] = useState(value);
|
|
1610
|
+
const pickerRef = useRef(null);
|
|
1481
1611
|
const selected = options.find((o) => o.value === value);
|
|
1482
1612
|
const handlePressIn = () => {
|
|
1483
1613
|
if (disabled) return;
|
|
@@ -1487,24 +1617,26 @@ function Select({
|
|
|
1487
1617
|
Animated.spring(scale, { toValue: 1, useNativeDriver: true, speed: 40, bounciness: 4 }).start();
|
|
1488
1618
|
};
|
|
1489
1619
|
const handleOpen = () => {
|
|
1490
|
-
if (
|
|
1491
|
-
|
|
1492
|
-
|
|
1620
|
+
if (disabled) return;
|
|
1621
|
+
Haptics12.selectionAsync();
|
|
1622
|
+
if (isIOS) {
|
|
1623
|
+
setPendingValue(value);
|
|
1624
|
+
setPickerVisible(true);
|
|
1625
|
+
} else if (isAndroid) {
|
|
1626
|
+
pickerRef.current?.focus();
|
|
1493
1627
|
}
|
|
1494
1628
|
};
|
|
1495
|
-
const
|
|
1496
|
-
(
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
);
|
|
1507
|
-
return /* @__PURE__ */ React23.createElement(View, { style: [styles20.container, style] }, label ? /* @__PURE__ */ React23.createElement(Text, { style: [styles20.label, { color: colors.foreground }] }, label) : null, /* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }], opacity: disabled ? 0.45 : 1 } }, /* @__PURE__ */ React23.createElement(
|
|
1629
|
+
const handleDismiss = () => {
|
|
1630
|
+
setPickerVisible(false);
|
|
1631
|
+
};
|
|
1632
|
+
const handleConfirm = () => {
|
|
1633
|
+
if (pendingValue !== void 0 && pendingValue !== "") {
|
|
1634
|
+
Haptics12.selectionAsync();
|
|
1635
|
+
onValueChange?.(pendingValue);
|
|
1636
|
+
}
|
|
1637
|
+
setPickerVisible(false);
|
|
1638
|
+
};
|
|
1639
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles20.container, style] }, label ? /* @__PURE__ */ React23.createElement(Text, { style: [styles20.label, { color: colors.foreground }] }, label) : null, !isWeb ? /* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }], opacity: disabled ? 0.45 : 1 } }, /* @__PURE__ */ React23.createElement(
|
|
1508
1640
|
TouchableOpacity,
|
|
1509
1641
|
{
|
|
1510
1642
|
style: [
|
|
@@ -1527,57 +1659,97 @@ function Select({
|
|
|
1527
1659
|
styles20.triggerText,
|
|
1528
1660
|
{ color: selected ? colors.foreground : colors.mutedForeground }
|
|
1529
1661
|
],
|
|
1530
|
-
numberOfLines: 1
|
|
1662
|
+
numberOfLines: 1,
|
|
1663
|
+
allowFontScaling: true
|
|
1531
1664
|
},
|
|
1532
1665
|
selected?.label ?? placeholder
|
|
1533
1666
|
),
|
|
1534
1667
|
/* @__PURE__ */ React23.createElement(Text, { style: [styles20.chevron, { color: colors.mutedForeground }] }, "\u25BE")
|
|
1535
|
-
))
|
|
1536
|
-
|
|
1668
|
+
)) : null, isIOS ? /* @__PURE__ */ React23.createElement(
|
|
1669
|
+
Modal,
|
|
1537
1670
|
{
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
backgroundStyle: [styles20.sheetBackground, { backgroundColor: colors.card }],
|
|
1543
|
-
handleIndicatorStyle: [styles20.sheetHandle, { backgroundColor: colors.border }]
|
|
1671
|
+
visible: pickerVisible,
|
|
1672
|
+
transparent: true,
|
|
1673
|
+
animationType: "slide",
|
|
1674
|
+
onRequestClose: handleDismiss
|
|
1544
1675
|
},
|
|
1545
|
-
/* @__PURE__ */ React23.createElement(
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1676
|
+
/* @__PURE__ */ React23.createElement(TouchableOpacity, { style: styles20.iosBackdrop, activeOpacity: 1, onPress: handleDismiss }),
|
|
1677
|
+
/* @__PURE__ */ React23.createElement(View, { style: [styles20.iosSheet, { backgroundColor: colors.card }] }, /* @__PURE__ */ React23.createElement(View, { style: [styles20.iosToolbar, { borderBottomColor: colors.border }] }, label ? /* @__PURE__ */ React23.createElement(Text, { style: [styles20.iosToolbarTitle, { color: colors.foreground }], allowFontScaling: true }, label) : /* @__PURE__ */ React23.createElement(View, null), /* @__PURE__ */ React23.createElement(TouchableOpacity, { onPress: handleConfirm, style: styles20.iosDoneBtn, hitSlop: { top: 8, bottom: 8, left: 8, right: 8 } }, /* @__PURE__ */ React23.createElement(Text, { style: [styles20.iosDoneBtnText, { color: colors.primary }], allowFontScaling: true }, "Done"))), /* @__PURE__ */ React23.createElement(
|
|
1678
|
+
Picker,
|
|
1679
|
+
{
|
|
1680
|
+
selectedValue: pendingValue ?? "",
|
|
1681
|
+
onValueChange: (val) => setPendingValue(val),
|
|
1682
|
+
itemStyle: { color: colors.foreground }
|
|
1683
|
+
},
|
|
1684
|
+
!value ? /* @__PURE__ */ React23.createElement(Picker.Item, { label: placeholder, value: "", color: colors.mutedForeground, enabled: false }) : null,
|
|
1685
|
+
options.map((o) => /* @__PURE__ */ React23.createElement(
|
|
1686
|
+
Picker.Item,
|
|
1549
1687
|
{
|
|
1550
|
-
key:
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1688
|
+
key: o.value,
|
|
1689
|
+
label: o.label,
|
|
1690
|
+
value: o.value,
|
|
1691
|
+
enabled: !o.disabled,
|
|
1692
|
+
color: o.disabled ? colors.mutedForeground : colors.foreground
|
|
1693
|
+
}
|
|
1694
|
+
))
|
|
1695
|
+
))
|
|
1696
|
+
) : null, isAndroid ? /* @__PURE__ */ React23.createElement(
|
|
1697
|
+
Picker,
|
|
1698
|
+
{
|
|
1699
|
+
ref: pickerRef,
|
|
1700
|
+
selectedValue: value ?? "",
|
|
1701
|
+
onValueChange: (val) => {
|
|
1702
|
+
if (val !== "") {
|
|
1703
|
+
Haptics12.selectionAsync();
|
|
1704
|
+
onValueChange?.(val);
|
|
1705
|
+
}
|
|
1706
|
+
},
|
|
1707
|
+
mode: "dialog",
|
|
1708
|
+
enabled: !disabled,
|
|
1709
|
+
prompt: label,
|
|
1710
|
+
style: styles20.androidHiddenPicker
|
|
1711
|
+
},
|
|
1712
|
+
!value ? /* @__PURE__ */ React23.createElement(Picker.Item, { label: placeholder, value: "", enabled: false }) : null,
|
|
1713
|
+
options.map((o) => /* @__PURE__ */ React23.createElement(
|
|
1714
|
+
Picker.Item,
|
|
1715
|
+
{
|
|
1716
|
+
key: o.value,
|
|
1717
|
+
label: o.label,
|
|
1718
|
+
value: o.value,
|
|
1719
|
+
enabled: !o.disabled
|
|
1720
|
+
}
|
|
1721
|
+
))
|
|
1722
|
+
) : null, isWeb ? /* @__PURE__ */ React23.createElement(
|
|
1723
|
+
Picker,
|
|
1724
|
+
{
|
|
1725
|
+
selectedValue: value ?? "",
|
|
1726
|
+
onValueChange: (val) => {
|
|
1727
|
+
if (val !== "") {
|
|
1728
|
+
onValueChange?.(val);
|
|
1729
|
+
}
|
|
1730
|
+
},
|
|
1731
|
+
enabled: !disabled,
|
|
1732
|
+
style: [
|
|
1733
|
+
styles20.webPicker,
|
|
1734
|
+
{
|
|
1735
|
+
borderColor: error ? colors.destructive : colors.border,
|
|
1736
|
+
color: selected ? colors.foreground : colors.mutedForeground,
|
|
1737
|
+
backgroundColor: colors.background,
|
|
1738
|
+
opacity: disabled ? 0.45 : 1
|
|
1739
|
+
}
|
|
1740
|
+
]
|
|
1741
|
+
},
|
|
1742
|
+
/* @__PURE__ */ React23.createElement(Picker.Item, { label: placeholder, value: "", enabled: false }),
|
|
1743
|
+
options.map((o) => /* @__PURE__ */ React23.createElement(
|
|
1744
|
+
Picker.Item,
|
|
1745
|
+
{
|
|
1746
|
+
key: o.value,
|
|
1747
|
+
label: o.label,
|
|
1748
|
+
value: o.value,
|
|
1749
|
+
enabled: !o.disabled
|
|
1750
|
+
}
|
|
1751
|
+
))
|
|
1752
|
+
) : null, error ? /* @__PURE__ */ React23.createElement(Text, { style: [styles20.helperText, { color: colors.destructive }] }, error) : null);
|
|
1581
1753
|
}
|
|
1582
1754
|
var styles20 = StyleSheet.create({
|
|
1583
1755
|
container: {
|
|
@@ -1608,44 +1780,45 @@ var styles20 = StyleSheet.create({
|
|
|
1608
1780
|
helperText: {
|
|
1609
1781
|
fontSize: 13
|
|
1610
1782
|
},
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1783
|
+
iosBackdrop: {
|
|
1784
|
+
flex: 1,
|
|
1785
|
+
backgroundColor: "rgba(0,0,0,0.4)"
|
|
1614
1786
|
},
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1787
|
+
iosSheet: {
|
|
1788
|
+
borderTopLeftRadius: 24,
|
|
1789
|
+
borderTopRightRadius: 24,
|
|
1790
|
+
paddingBottom: 32
|
|
1619
1791
|
},
|
|
1620
|
-
|
|
1792
|
+
iosToolbar: {
|
|
1793
|
+
flexDirection: "row",
|
|
1794
|
+
alignItems: "center",
|
|
1795
|
+
justifyContent: "space-between",
|
|
1621
1796
|
paddingHorizontal: 20,
|
|
1622
|
-
|
|
1797
|
+
paddingVertical: 12,
|
|
1798
|
+
borderBottomWidth: 1
|
|
1623
1799
|
},
|
|
1624
|
-
|
|
1800
|
+
iosToolbarTitle: {
|
|
1625
1801
|
fontSize: 17,
|
|
1626
|
-
fontWeight: "600"
|
|
1627
|
-
paddingVertical: 16,
|
|
1628
|
-
paddingHorizontal: 4
|
|
1802
|
+
fontWeight: "600"
|
|
1629
1803
|
},
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
alignItems: "center",
|
|
1633
|
-
justifyContent: "space-between",
|
|
1634
|
-
paddingHorizontal: 16,
|
|
1635
|
-
paddingVertical: 16,
|
|
1636
|
-
borderRadius: 12
|
|
1804
|
+
iosDoneBtn: {
|
|
1805
|
+
padding: 4
|
|
1637
1806
|
},
|
|
1638
|
-
|
|
1807
|
+
iosDoneBtnText: {
|
|
1639
1808
|
fontSize: 17,
|
|
1640
|
-
|
|
1809
|
+
fontWeight: "600"
|
|
1641
1810
|
},
|
|
1642
|
-
|
|
1643
|
-
|
|
1811
|
+
androidHiddenPicker: {
|
|
1812
|
+
height: 0,
|
|
1813
|
+
opacity: 0,
|
|
1814
|
+
position: "absolute"
|
|
1644
1815
|
},
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1816
|
+
webPicker: {
|
|
1817
|
+
borderWidth: 1.5,
|
|
1818
|
+
borderRadius: 14,
|
|
1819
|
+
paddingHorizontal: 20,
|
|
1820
|
+
paddingVertical: 16,
|
|
1821
|
+
fontSize: 17
|
|
1649
1822
|
}
|
|
1650
1823
|
});
|
|
1651
1824
|
var ToastContext = createContext({
|
|
@@ -1712,11 +1885,11 @@ function ToastProvider({ children }) {
|
|
|
1712
1885
|
const toast = useCallback((item) => {
|
|
1713
1886
|
const id = Math.random().toString(36).slice(2);
|
|
1714
1887
|
if (item.variant === "success") {
|
|
1715
|
-
|
|
1888
|
+
Haptics12.notificationAsync(Haptics12.NotificationFeedbackType.Success);
|
|
1716
1889
|
} else if (item.variant === "destructive") {
|
|
1717
|
-
|
|
1890
|
+
Haptics12.notificationAsync(Haptics12.NotificationFeedbackType.Error);
|
|
1718
1891
|
} else {
|
|
1719
|
-
|
|
1892
|
+
Haptics12.impactAsync(Haptics12.ImpactFeedbackStyle.Light);
|
|
1720
1893
|
}
|
|
1721
1894
|
setToasts((prev) => [{ ...item, id }, ...prev].slice(0, 3));
|
|
1722
1895
|
}, []);
|
|
@@ -1785,12 +1958,14 @@ function CurrencyInput({
|
|
|
1785
1958
|
onChangeValue,
|
|
1786
1959
|
prefix = "$",
|
|
1787
1960
|
thousandsSeparator = ".",
|
|
1961
|
+
size = "default",
|
|
1788
1962
|
label,
|
|
1789
1963
|
error,
|
|
1790
1964
|
hint,
|
|
1791
1965
|
placeholder,
|
|
1792
1966
|
editable,
|
|
1793
|
-
containerStyle
|
|
1967
|
+
containerStyle,
|
|
1968
|
+
style
|
|
1794
1969
|
}) {
|
|
1795
1970
|
const handleChange = (text) => {
|
|
1796
1971
|
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
@@ -1801,6 +1976,7 @@ function CurrencyInput({
|
|
|
1801
1976
|
const raw = parseFloat(formatted.replace(separatorRegex, "") || "0");
|
|
1802
1977
|
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
1803
1978
|
};
|
|
1979
|
+
const inputStyle = size === "large" ? { fontSize: 36 } : {};
|
|
1804
1980
|
return /* @__PURE__ */ React23.createElement(
|
|
1805
1981
|
Input,
|
|
1806
1982
|
{
|
|
@@ -1812,7 +1988,8 @@ function CurrencyInput({
|
|
|
1812
1988
|
hint,
|
|
1813
1989
|
placeholder: placeholder ?? `${prefix}0`,
|
|
1814
1990
|
editable,
|
|
1815
|
-
containerStyle
|
|
1991
|
+
containerStyle,
|
|
1992
|
+
style: [inputStyle, style]
|
|
1816
1993
|
}
|
|
1817
1994
|
);
|
|
1818
1995
|
}
|
|
@@ -1828,10 +2005,10 @@ function formatValue(value, prefix, showDecimals) {
|
|
|
1828
2005
|
}
|
|
1829
2006
|
return `${sign}${prefix}${intPart}`;
|
|
1830
2007
|
}
|
|
1831
|
-
function CurrencyDisplay({ value, prefix = "$", showDecimals = false, style }) {
|
|
2008
|
+
function CurrencyDisplay({ value, prefix = "$", showDecimals = false, textColor, style }) {
|
|
1832
2009
|
const { colors } = useTheme();
|
|
1833
2010
|
const formatted = formatValue(value, prefix, showDecimals);
|
|
1834
|
-
return /* @__PURE__ */ React23.createElement(View, { style: [styles22.container, style] }, /* @__PURE__ */ React23.createElement(Text, { style: [styles22.amount, { color: colors.foreground }], allowFontScaling: true }, formatted));
|
|
2011
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles22.container, style] }, /* @__PURE__ */ React23.createElement(Text, { style: [styles22.amount, { color: textColor ?? colors.foreground }], allowFontScaling: true }, formatted));
|
|
1835
2012
|
}
|
|
1836
2013
|
var styles22 = StyleSheet.create({
|
|
1837
2014
|
container: {},
|
|
@@ -1840,48 +2017,342 @@ var styles22 = StyleSheet.create({
|
|
|
1840
2017
|
fontWeight: "700"
|
|
1841
2018
|
}
|
|
1842
2019
|
});
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
2020
|
+
var nativeDriver4 = Platform.OS !== "web";
|
|
2021
|
+
function ListItem({ icon, title, subtitle, trailing, onPress, disabled, style }) {
|
|
2022
|
+
const { colors } = useTheme();
|
|
2023
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
2024
|
+
const handlePressIn = () => {
|
|
2025
|
+
if (!onPress || disabled) return;
|
|
2026
|
+
Animated.spring(scale, {
|
|
2027
|
+
toValue: 0.97,
|
|
2028
|
+
useNativeDriver: nativeDriver4,
|
|
2029
|
+
speed: 40,
|
|
2030
|
+
bounciness: 0
|
|
2031
|
+
}).start();
|
|
2032
|
+
};
|
|
2033
|
+
const handlePressOut = () => {
|
|
2034
|
+
Animated.spring(scale, {
|
|
2035
|
+
toValue: 1,
|
|
2036
|
+
useNativeDriver: nativeDriver4,
|
|
2037
|
+
speed: 40,
|
|
2038
|
+
bounciness: 4
|
|
2039
|
+
}).start();
|
|
2040
|
+
};
|
|
2041
|
+
const handlePress = () => {
|
|
2042
|
+
Haptics12.selectionAsync();
|
|
2043
|
+
onPress?.();
|
|
2044
|
+
};
|
|
2045
|
+
return /* @__PURE__ */ React23.createElement(Animated.View, { style: [{ transform: [{ scale }] }, disabled && styles23.disabled] }, /* @__PURE__ */ React23.createElement(
|
|
2046
|
+
TouchableOpacity,
|
|
2047
|
+
{
|
|
2048
|
+
style: [styles23.container, style],
|
|
2049
|
+
onPress: onPress ? handlePress : void 0,
|
|
2050
|
+
onPressIn: handlePressIn,
|
|
2051
|
+
onPressOut: handlePressOut,
|
|
2052
|
+
disabled,
|
|
2053
|
+
activeOpacity: 1,
|
|
2054
|
+
touchSoundDisabled: true
|
|
2055
|
+
},
|
|
2056
|
+
icon ? /* @__PURE__ */ React23.createElement(View, { style: styles23.iconWrapper }, icon) : null,
|
|
2057
|
+
/* @__PURE__ */ React23.createElement(View, { style: styles23.content }, /* @__PURE__ */ React23.createElement(Text, { style: [styles23.title, { color: colors.foreground }], allowFontScaling: true }, title), subtitle ? /* @__PURE__ */ React23.createElement(Text, { style: [styles23.subtitle, { color: colors.mutedForeground }], allowFontScaling: true }, subtitle) : null),
|
|
2058
|
+
trailing !== void 0 ? typeof trailing === "string" ? /* @__PURE__ */ React23.createElement(Text, { style: [styles23.trailing, { color: colors.mutedForeground }], allowFontScaling: true }, trailing) : trailing : null
|
|
2059
|
+
));
|
|
1847
2060
|
}
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
2061
|
+
var styles23 = StyleSheet.create({
|
|
2062
|
+
container: {
|
|
2063
|
+
flexDirection: "row",
|
|
2064
|
+
alignItems: "center",
|
|
2065
|
+
paddingHorizontal: 16,
|
|
2066
|
+
paddingVertical: 14,
|
|
2067
|
+
gap: 12
|
|
2068
|
+
},
|
|
2069
|
+
iconWrapper: {
|
|
2070
|
+
alignItems: "center",
|
|
2071
|
+
justifyContent: "center"
|
|
2072
|
+
},
|
|
2073
|
+
content: {
|
|
2074
|
+
flex: 1,
|
|
2075
|
+
gap: 3
|
|
2076
|
+
},
|
|
2077
|
+
title: {
|
|
2078
|
+
fontSize: 16,
|
|
2079
|
+
fontWeight: "500",
|
|
2080
|
+
lineHeight: 22
|
|
2081
|
+
},
|
|
2082
|
+
subtitle: {
|
|
2083
|
+
fontSize: 13,
|
|
2084
|
+
lineHeight: 18
|
|
2085
|
+
},
|
|
2086
|
+
trailing: {
|
|
2087
|
+
fontSize: 15
|
|
2088
|
+
},
|
|
2089
|
+
disabled: {
|
|
2090
|
+
opacity: 0.45
|
|
2091
|
+
}
|
|
2092
|
+
});
|
|
2093
|
+
var nativeDriver5 = Platform.OS !== "web";
|
|
2094
|
+
function Chip({ label, selected = false, onPress, style }) {
|
|
2095
|
+
const { colors } = useTheme();
|
|
2096
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
2097
|
+
const pressAnim = useRef(new Animated.Value(selected ? 1 : 0)).current;
|
|
2098
|
+
useEffect(() => {
|
|
2099
|
+
Animated.timing(pressAnim, {
|
|
2100
|
+
toValue: selected ? 1 : 0,
|
|
2101
|
+
duration: 150,
|
|
2102
|
+
easing: Easing.out(Easing.ease),
|
|
2103
|
+
useNativeDriver: false
|
|
2104
|
+
}).start();
|
|
2105
|
+
}, [selected, pressAnim]);
|
|
2106
|
+
const handlePressIn = () => {
|
|
2107
|
+
Animated.spring(scale, {
|
|
2108
|
+
toValue: 0.95,
|
|
2109
|
+
useNativeDriver: nativeDriver5,
|
|
2110
|
+
speed: 40,
|
|
2111
|
+
bounciness: 0
|
|
2112
|
+
}).start();
|
|
1869
2113
|
};
|
|
1870
|
-
|
|
1871
|
-
|
|
2114
|
+
const handlePressOut = () => {
|
|
2115
|
+
Animated.spring(scale, {
|
|
2116
|
+
toValue: 1,
|
|
2117
|
+
useNativeDriver: nativeDriver5,
|
|
2118
|
+
speed: 40,
|
|
2119
|
+
bounciness: 4
|
|
2120
|
+
}).start();
|
|
2121
|
+
};
|
|
2122
|
+
const handlePress = () => {
|
|
2123
|
+
Haptics12.selectionAsync();
|
|
2124
|
+
onPress?.();
|
|
2125
|
+
};
|
|
2126
|
+
const backgroundColor = pressAnim.interpolate({
|
|
2127
|
+
inputRange: [0, 1],
|
|
2128
|
+
outputRange: [colors.secondary, colors.primary]
|
|
2129
|
+
});
|
|
2130
|
+
const textColor = pressAnim.interpolate({
|
|
2131
|
+
inputRange: [0, 1],
|
|
2132
|
+
outputRange: [colors.foreground, colors.primaryForeground]
|
|
2133
|
+
});
|
|
2134
|
+
const borderColor = pressAnim.interpolate({
|
|
2135
|
+
inputRange: [0, 1],
|
|
2136
|
+
outputRange: [colors.border, colors.primary]
|
|
2137
|
+
});
|
|
2138
|
+
return /* @__PURE__ */ React23.createElement(Animated.View, { style: [styles24.wrapper, { transform: [{ scale }] }, style] }, /* @__PURE__ */ React23.createElement(
|
|
2139
|
+
TouchableOpacity,
|
|
1872
2140
|
{
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
2141
|
+
onPress: handlePress,
|
|
2142
|
+
onPressIn: handlePressIn,
|
|
2143
|
+
onPressOut: handlePressOut,
|
|
2144
|
+
activeOpacity: 1,
|
|
2145
|
+
touchSoundDisabled: true
|
|
2146
|
+
},
|
|
2147
|
+
/* @__PURE__ */ React23.createElement(Animated.View, { style: [styles24.chip, { backgroundColor, borderColor }] }, /* @__PURE__ */ React23.createElement(Animated.Text, { style: [styles24.label, { color: textColor }], allowFontScaling: true }, label))
|
|
2148
|
+
));
|
|
2149
|
+
}
|
|
2150
|
+
function ChipGroup({ options, value, onValueChange, multiSelect = false, style }) {
|
|
2151
|
+
const handlePress = (optionValue) => {
|
|
2152
|
+
if (!multiSelect) {
|
|
2153
|
+
onValueChange?.(optionValue);
|
|
2154
|
+
return;
|
|
1883
2155
|
}
|
|
1884
|
-
|
|
2156
|
+
const currentArray = Array.isArray(value) ? value : value ? [value] : [];
|
|
2157
|
+
const isSelected2 = currentArray.includes(optionValue);
|
|
2158
|
+
let newArray;
|
|
2159
|
+
if (isSelected2) {
|
|
2160
|
+
newArray = currentArray.filter((v) => v !== optionValue);
|
|
2161
|
+
} else {
|
|
2162
|
+
newArray = [...currentArray, optionValue];
|
|
2163
|
+
}
|
|
2164
|
+
onValueChange?.(newArray);
|
|
2165
|
+
};
|
|
2166
|
+
const isSelected = (optionValue) => {
|
|
2167
|
+
if (Array.isArray(value)) {
|
|
2168
|
+
return value.includes(optionValue);
|
|
2169
|
+
}
|
|
2170
|
+
return optionValue === value;
|
|
2171
|
+
};
|
|
2172
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles24.group, style] }, options.map((opt) => /* @__PURE__ */ React23.createElement(
|
|
2173
|
+
Chip,
|
|
2174
|
+
{
|
|
2175
|
+
key: opt.value,
|
|
2176
|
+
label: opt.label,
|
|
2177
|
+
selected: isSelected(opt.value),
|
|
2178
|
+
onPress: () => handlePress(opt.value)
|
|
2179
|
+
}
|
|
2180
|
+
)));
|
|
1885
2181
|
}
|
|
2182
|
+
var styles24 = StyleSheet.create({
|
|
2183
|
+
wrapper: {},
|
|
2184
|
+
chip: {
|
|
2185
|
+
borderRadius: 999,
|
|
2186
|
+
paddingHorizontal: 14,
|
|
2187
|
+
paddingVertical: 8,
|
|
2188
|
+
borderWidth: 1.5,
|
|
2189
|
+
alignItems: "center",
|
|
2190
|
+
justifyContent: "center"
|
|
2191
|
+
},
|
|
2192
|
+
label: {
|
|
2193
|
+
fontSize: 14,
|
|
2194
|
+
fontWeight: "500",
|
|
2195
|
+
lineHeight: 20
|
|
2196
|
+
},
|
|
2197
|
+
group: {
|
|
2198
|
+
flexDirection: "row",
|
|
2199
|
+
flexWrap: "wrap",
|
|
2200
|
+
gap: 8
|
|
2201
|
+
}
|
|
2202
|
+
});
|
|
2203
|
+
function ConfirmDialog({
|
|
2204
|
+
visible,
|
|
2205
|
+
title,
|
|
2206
|
+
description,
|
|
2207
|
+
confirmLabel = "Confirm",
|
|
2208
|
+
cancelLabel = "Cancel",
|
|
2209
|
+
confirmVariant = "primary",
|
|
2210
|
+
onConfirm,
|
|
2211
|
+
onCancel
|
|
2212
|
+
}) {
|
|
2213
|
+
const { colors } = useTheme();
|
|
2214
|
+
return /* @__PURE__ */ React23.createElement(Modal, { visible, transparent: true, animationType: "fade", onRequestClose: onCancel }, /* @__PURE__ */ React23.createElement(TouchableOpacity, { style: styles25.overlay, activeOpacity: 1, onPress: onCancel }, /* @__PURE__ */ React23.createElement(
|
|
2215
|
+
View,
|
|
2216
|
+
{
|
|
2217
|
+
style: [styles25.dialog, { backgroundColor: colors.card }],
|
|
2218
|
+
onStartShouldSetResponder: () => true
|
|
2219
|
+
},
|
|
2220
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles25.title, { color: colors.cardForeground }], allowFontScaling: true }, title),
|
|
2221
|
+
description ? /* @__PURE__ */ React23.createElement(Text, { style: [styles25.description, { color: colors.mutedForeground }], allowFontScaling: true }, description) : null,
|
|
2222
|
+
/* @__PURE__ */ React23.createElement(View, { style: styles25.actions }, /* @__PURE__ */ React23.createElement(Button, { label: cancelLabel, variant: "outline", fullWidth: true, onPress: onCancel }), /* @__PURE__ */ React23.createElement(Button, { label: confirmLabel, variant: confirmVariant, fullWidth: true, onPress: onConfirm }))
|
|
2223
|
+
)));
|
|
2224
|
+
}
|
|
2225
|
+
var styles25 = StyleSheet.create({
|
|
2226
|
+
overlay: {
|
|
2227
|
+
flex: 1,
|
|
2228
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
2229
|
+
justifyContent: "center",
|
|
2230
|
+
alignItems: "center",
|
|
2231
|
+
padding: 24
|
|
2232
|
+
},
|
|
2233
|
+
dialog: {
|
|
2234
|
+
width: "100%",
|
|
2235
|
+
maxWidth: 400,
|
|
2236
|
+
borderRadius: 16,
|
|
2237
|
+
padding: 24,
|
|
2238
|
+
gap: 12,
|
|
2239
|
+
shadowColor: "#000",
|
|
2240
|
+
shadowOffset: { width: 0, height: 8 },
|
|
2241
|
+
shadowOpacity: 0.15,
|
|
2242
|
+
shadowRadius: 16,
|
|
2243
|
+
elevation: 8
|
|
2244
|
+
},
|
|
2245
|
+
title: {
|
|
2246
|
+
fontSize: 18,
|
|
2247
|
+
fontWeight: "600",
|
|
2248
|
+
lineHeight: 26
|
|
2249
|
+
},
|
|
2250
|
+
description: {
|
|
2251
|
+
fontSize: 15,
|
|
2252
|
+
lineHeight: 22
|
|
2253
|
+
},
|
|
2254
|
+
actions: {
|
|
2255
|
+
gap: 10,
|
|
2256
|
+
marginTop: 8
|
|
2257
|
+
}
|
|
2258
|
+
});
|
|
2259
|
+
function LabelValue({ label, value, style }) {
|
|
2260
|
+
const { colors } = useTheme();
|
|
2261
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles26.container, style] }, /* @__PURE__ */ React23.createElement(Text, { style: [styles26.label, { color: colors.mutedForeground }], allowFontScaling: true }, label), typeof value === "string" ? /* @__PURE__ */ React23.createElement(Text, { style: [styles26.value, { color: colors.foreground }], allowFontScaling: true }, value) : value);
|
|
2262
|
+
}
|
|
2263
|
+
var styles26 = StyleSheet.create({
|
|
2264
|
+
container: {
|
|
2265
|
+
flexDirection: "row",
|
|
2266
|
+
justifyContent: "space-between",
|
|
2267
|
+
alignItems: "center",
|
|
2268
|
+
gap: 12
|
|
2269
|
+
},
|
|
2270
|
+
label: {
|
|
2271
|
+
fontSize: 13,
|
|
2272
|
+
lineHeight: 18
|
|
2273
|
+
},
|
|
2274
|
+
value: {
|
|
2275
|
+
fontSize: 15,
|
|
2276
|
+
fontWeight: "500",
|
|
2277
|
+
lineHeight: 22,
|
|
2278
|
+
textAlign: "right"
|
|
2279
|
+
}
|
|
2280
|
+
});
|
|
2281
|
+
var MONTH_NAMES = [
|
|
2282
|
+
"January",
|
|
2283
|
+
"February",
|
|
2284
|
+
"March",
|
|
2285
|
+
"April",
|
|
2286
|
+
"May",
|
|
2287
|
+
"June",
|
|
2288
|
+
"July",
|
|
2289
|
+
"August",
|
|
2290
|
+
"September",
|
|
2291
|
+
"October",
|
|
2292
|
+
"November",
|
|
2293
|
+
"December"
|
|
2294
|
+
];
|
|
2295
|
+
function MonthPicker({ value, onChange, style }) {
|
|
2296
|
+
const { colors } = useTheme();
|
|
2297
|
+
const handlePrev = () => {
|
|
2298
|
+
Haptics12.selectionAsync();
|
|
2299
|
+
if (value.month === 1) {
|
|
2300
|
+
onChange({ month: 12, year: value.year - 1 });
|
|
2301
|
+
} else {
|
|
2302
|
+
onChange({ month: value.month - 1, year: value.year });
|
|
2303
|
+
}
|
|
2304
|
+
};
|
|
2305
|
+
const handleNext = () => {
|
|
2306
|
+
Haptics12.selectionAsync();
|
|
2307
|
+
if (value.month === 12) {
|
|
2308
|
+
onChange({ month: 1, year: value.year + 1 });
|
|
2309
|
+
} else {
|
|
2310
|
+
onChange({ month: value.month + 1, year: value.year });
|
|
2311
|
+
}
|
|
2312
|
+
};
|
|
2313
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles27.container, style] }, /* @__PURE__ */ React23.createElement(
|
|
2314
|
+
TouchableOpacity,
|
|
2315
|
+
{
|
|
2316
|
+
style: styles27.arrow,
|
|
2317
|
+
onPress: handlePrev,
|
|
2318
|
+
activeOpacity: 0.6,
|
|
2319
|
+
touchSoundDisabled: true
|
|
2320
|
+
},
|
|
2321
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }], allowFontScaling: true }, "\u2039")
|
|
2322
|
+
), /* @__PURE__ */ React23.createElement(Text, { style: [styles27.label, { color: colors.foreground }], allowFontScaling: true }, MONTH_NAMES[value.month - 1], " ", value.year), /* @__PURE__ */ React23.createElement(
|
|
2323
|
+
TouchableOpacity,
|
|
2324
|
+
{
|
|
2325
|
+
style: styles27.arrow,
|
|
2326
|
+
onPress: handleNext,
|
|
2327
|
+
activeOpacity: 0.6,
|
|
2328
|
+
touchSoundDisabled: true
|
|
2329
|
+
},
|
|
2330
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }], allowFontScaling: true }, "\u203A")
|
|
2331
|
+
));
|
|
2332
|
+
}
|
|
2333
|
+
var styles27 = StyleSheet.create({
|
|
2334
|
+
container: {
|
|
2335
|
+
flexDirection: "row",
|
|
2336
|
+
alignItems: "center",
|
|
2337
|
+
justifyContent: "space-between"
|
|
2338
|
+
},
|
|
2339
|
+
arrow: {
|
|
2340
|
+
width: 44,
|
|
2341
|
+
height: 44,
|
|
2342
|
+
alignItems: "center",
|
|
2343
|
+
justifyContent: "center"
|
|
2344
|
+
},
|
|
2345
|
+
arrowText: {
|
|
2346
|
+
fontSize: 24,
|
|
2347
|
+
lineHeight: 30
|
|
2348
|
+
},
|
|
2349
|
+
label: {
|
|
2350
|
+
fontSize: 17,
|
|
2351
|
+
fontWeight: "500",
|
|
2352
|
+
lineHeight: 24,
|
|
2353
|
+
textAlign: "center",
|
|
2354
|
+
minWidth: 160
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
1886
2357
|
|
|
1887
|
-
export { Accordion,
|
|
2358
|
+
export { Accordion, AlertBanner, Avatar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Chip, ChipGroup, ConfirmDialog, CurrencyDisplay, CurrencyInput, CurrencyInput as CurrencyInputLarge, EmptyState, Input, LabelValue, ListItem, MonthPicker, Progress, RadioGroup, Select, Separator, Sheet, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, Text2 as Text, Textarea, ThemeProvider, ToastProvider, Toggle, defaultDark, defaultLight, useTheme, useToast };
|