@retray-dev/ui-kit 1.6.0 → 1.8.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 +264 -15
- package/README.md +7 -6
- package/dist/index.d.mts +114 -11
- package/dist/index.d.ts +114 -11
- package/dist/index.js +660 -134
- package/dist/index.mjs +656 -138
- package/package.json +8 -8
- package/src/components/Accordion/Accordion.tsx +4 -4
- package/src/components/Alert/Alert.tsx +32 -8
- package/src/components/Alert/index.ts +2 -2
- package/src/components/Avatar/Avatar.tsx +8 -8
- package/src/components/Badge/Badge.tsx +4 -4
- package/src/components/Button/Button.tsx +21 -14
- package/src/components/Card/Card.tsx +9 -9
- package/src/components/Checkbox/Checkbox.tsx +8 -8
- package/src/components/Chip/Chip.tsx +142 -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 +48 -0
- package/src/components/CurrencyDisplay/index.ts +1 -0
- package/src/components/CurrencyInputLarge/CurrencyInputLarge.tsx +66 -0
- package/src/components/CurrencyInputLarge/index.ts +1 -0
- package/src/components/EmptyState/EmptyState.tsx +40 -6
- package/src/components/Input/Input.tsx +8 -8
- 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 +19 -19
- package/src/components/Switch/Switch.tsx +12 -7
- package/src/components/Tabs/Tabs.tsx +34 -15
- package/src/components/Text/Text.tsx +6 -6
- package/src/components/Textarea/Textarea.tsx +9 -9
- package/src/components/Toast/Toast.tsx +25 -7
- package/src/components/Toggle/Toggle.tsx +93 -24
- package/src/index.ts +7 -0
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React23, { createContext, useMemo, useContext, useRef, useState, useEffect, useCallback } from 'react';
|
|
2
|
-
import { StyleSheet, useColorScheme, Animated, TouchableOpacity, ActivityIndicator, Text, View, TextInput, Image, PanResponder } from 'react-native';
|
|
2
|
+
import { Platform, StyleSheet, useColorScheme, Animated, TouchableOpacity, ActivityIndicator, Text, View, TextInput, Image, Easing, PanResponder, Modal } from 'react-native';
|
|
3
3
|
import * as Haptics11 from 'expo-haptics';
|
|
4
4
|
import { LinearGradient } from 'expo-linear-gradient';
|
|
5
|
-
import ReanimatedAnimated, { useSharedValue, useAnimatedStyle, withTiming, Easing, withSpring } from 'react-native-reanimated';
|
|
5
|
+
import ReanimatedAnimated, { useSharedValue, useAnimatedStyle, withTiming, Easing as Easing$1, withSpring } from 'react-native-reanimated';
|
|
6
6
|
import { BottomSheetModal, BottomSheetView, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
|
|
7
7
|
export { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
|
|
8
8
|
import { scheduleOnRN } from 'react-native-worklets';
|
|
@@ -73,14 +73,15 @@ function ThemeProvider({ children, theme, colorScheme = "system" }) {
|
|
|
73
73
|
function useTheme() {
|
|
74
74
|
return useContext(ThemeContext);
|
|
75
75
|
}
|
|
76
|
+
var nativeDriver = Platform.OS !== "web";
|
|
76
77
|
var containerSizeStyles = {
|
|
77
|
-
sm: { paddingHorizontal:
|
|
78
|
-
md: { paddingHorizontal:
|
|
79
|
-
lg: { paddingHorizontal:
|
|
78
|
+
sm: { paddingHorizontal: 20, paddingVertical: 12 },
|
|
79
|
+
md: { paddingHorizontal: 24, paddingVertical: 16 },
|
|
80
|
+
lg: { paddingHorizontal: 32, paddingVertical: 20 }
|
|
80
81
|
};
|
|
81
82
|
var labelSizeStyles = {
|
|
82
|
-
sm: { fontSize:
|
|
83
|
-
md: { fontSize:
|
|
83
|
+
sm: { fontSize: 15 },
|
|
84
|
+
md: { fontSize: 17 },
|
|
84
85
|
lg: { fontSize: 18 }
|
|
85
86
|
};
|
|
86
87
|
function Button({
|
|
@@ -103,13 +104,13 @@ function Button({
|
|
|
103
104
|
if (isDisabled) return;
|
|
104
105
|
Animated.spring(scale, {
|
|
105
106
|
toValue: 0.95,
|
|
106
|
-
useNativeDriver:
|
|
107
|
+
useNativeDriver: nativeDriver,
|
|
107
108
|
speed: 40,
|
|
108
109
|
bounciness: 0
|
|
109
110
|
}).start();
|
|
110
111
|
};
|
|
111
112
|
const handlePressOut = () => {
|
|
112
|
-
Animated.spring(scale, { toValue: 1, useNativeDriver:
|
|
113
|
+
Animated.spring(scale, { toValue: 1, useNativeDriver: nativeDriver, speed: 40, bounciness: 4 }).start();
|
|
113
114
|
};
|
|
114
115
|
const handlePress = (e) => {
|
|
115
116
|
Haptics11.impactAsync(Haptics11.ImpactFeedbackStyle.Light);
|
|
@@ -119,15 +120,17 @@ function Button({
|
|
|
119
120
|
primary: { backgroundColor: colors.primary },
|
|
120
121
|
secondary: { backgroundColor: colors.secondary },
|
|
121
122
|
outline: { backgroundColor: "transparent", borderWidth: 1.5, borderColor: colors.border },
|
|
122
|
-
ghost: { backgroundColor: "transparent" }
|
|
123
|
+
ghost: { backgroundColor: "transparent" },
|
|
124
|
+
destructive: { backgroundColor: colors.destructive }
|
|
123
125
|
}[variant];
|
|
124
126
|
const labelVariantStyle = {
|
|
125
127
|
primary: { color: colors.primaryForeground },
|
|
126
128
|
secondary: { color: colors.secondaryForeground },
|
|
127
129
|
outline: { color: colors.foreground },
|
|
128
|
-
ghost: { color: colors.foreground }
|
|
130
|
+
ghost: { color: colors.foreground },
|
|
131
|
+
destructive: { color: colors.destructiveForeground }
|
|
129
132
|
}[variant];
|
|
130
|
-
const spinnerColor = variant === "primary" || variant === "secondary" ? colors.primaryForeground : colors.foreground;
|
|
133
|
+
const spinnerColor = variant === "destructive" ? colors.destructiveForeground : variant === "primary" || variant === "secondary" ? colors.primaryForeground : colors.foreground;
|
|
131
134
|
return /* @__PURE__ */ React23.createElement(Animated.View, { style: [fullWidth && styles.fullWidth, { transform: [{ scale }] }] }, /* @__PURE__ */ React23.createElement(
|
|
132
135
|
TouchableOpacity,
|
|
133
136
|
{
|
|
@@ -147,12 +150,12 @@ function Button({
|
|
|
147
150
|
onPressOut: handlePressOut,
|
|
148
151
|
...props
|
|
149
152
|
},
|
|
150
|
-
loading ? /* @__PURE__ */ React23.createElement(ActivityIndicator, { size: "small", color: spinnerColor }) : /* @__PURE__ */ React23.createElement(React23.Fragment, null, icon && iconPosition === "left" && /* @__PURE__ */ React23.createElement(React23.Fragment, null, icon), /* @__PURE__ */ React23.createElement(Text, { style: [styles.label, labelVariantStyle, labelSizeStyles[size], icon ? styles.labelWithIcon : void 0] }, label), icon && iconPosition === "right" && /* @__PURE__ */ React23.createElement(React23.Fragment, null, icon))
|
|
153
|
+
loading ? /* @__PURE__ */ React23.createElement(ActivityIndicator, { size: "small", color: spinnerColor }) : /* @__PURE__ */ React23.createElement(React23.Fragment, null, icon && iconPosition === "left" && /* @__PURE__ */ React23.createElement(React23.Fragment, null, typeof icon === "function" ? icon({ label, size, variant }) : icon), /* @__PURE__ */ React23.createElement(Text, { style: [styles.label, labelVariantStyle, labelSizeStyles[size], icon ? styles.labelWithIcon : void 0] }, label), icon && iconPosition === "right" && /* @__PURE__ */ React23.createElement(React23.Fragment, null, typeof icon === "function" ? icon({ label, size, variant }) : icon))
|
|
151
154
|
));
|
|
152
155
|
}
|
|
153
156
|
var styles = StyleSheet.create({
|
|
154
157
|
base: {
|
|
155
|
-
borderRadius:
|
|
158
|
+
borderRadius: 999,
|
|
156
159
|
alignItems: "center",
|
|
157
160
|
justifyContent: "center",
|
|
158
161
|
flexDirection: "row"
|
|
@@ -171,12 +174,12 @@ var styles = StyleSheet.create({
|
|
|
171
174
|
}
|
|
172
175
|
});
|
|
173
176
|
var variantStyles = {
|
|
174
|
-
h1: { fontSize:
|
|
175
|
-
h2: { fontSize:
|
|
176
|
-
h3: { fontSize:
|
|
177
|
-
body: { fontSize:
|
|
178
|
-
caption: { fontSize:
|
|
179
|
-
label: { fontSize:
|
|
177
|
+
h1: { fontSize: 40, fontWeight: "700", lineHeight: 52 },
|
|
178
|
+
h2: { fontSize: 28, fontWeight: "700", lineHeight: 36 },
|
|
179
|
+
h3: { fontSize: 22, fontWeight: "600", lineHeight: 30 },
|
|
180
|
+
body: { fontSize: 17, fontWeight: "400", lineHeight: 26 },
|
|
181
|
+
caption: { fontSize: 13, fontWeight: "400", lineHeight: 20 },
|
|
182
|
+
label: { fontSize: 15, fontWeight: "500", lineHeight: 22 }
|
|
180
183
|
};
|
|
181
184
|
function Text2({ variant = "body", color, style, children, ...props }) {
|
|
182
185
|
const { colors } = useTheme();
|
|
@@ -222,22 +225,22 @@ function Input({ label, error, hint, containerStyle, style, onFocus, onBlur, ...
|
|
|
222
225
|
}
|
|
223
226
|
var styles2 = StyleSheet.create({
|
|
224
227
|
container: {
|
|
225
|
-
gap:
|
|
228
|
+
gap: 6
|
|
226
229
|
},
|
|
227
230
|
label: {
|
|
228
|
-
fontSize:
|
|
231
|
+
fontSize: 15,
|
|
229
232
|
fontWeight: "500",
|
|
230
|
-
marginBottom:
|
|
233
|
+
marginBottom: 6
|
|
231
234
|
},
|
|
232
235
|
input: {
|
|
233
236
|
borderWidth: 1.5,
|
|
234
|
-
borderRadius:
|
|
235
|
-
paddingHorizontal:
|
|
236
|
-
paddingVertical:
|
|
237
|
-
fontSize:
|
|
237
|
+
borderRadius: 14,
|
|
238
|
+
paddingHorizontal: 20,
|
|
239
|
+
paddingVertical: 16,
|
|
240
|
+
fontSize: 17
|
|
238
241
|
},
|
|
239
242
|
helperText: {
|
|
240
|
-
fontSize:
|
|
243
|
+
fontSize: 13
|
|
241
244
|
}
|
|
242
245
|
});
|
|
243
246
|
function Badge({ label, variant = "default", style }) {
|
|
@@ -258,13 +261,13 @@ function Badge({ label, variant = "default", style }) {
|
|
|
258
261
|
}
|
|
259
262
|
var styles3 = StyleSheet.create({
|
|
260
263
|
container: {
|
|
261
|
-
borderRadius:
|
|
262
|
-
paddingHorizontal:
|
|
263
|
-
paddingVertical:
|
|
264
|
+
borderRadius: 8,
|
|
265
|
+
paddingHorizontal: 10,
|
|
266
|
+
paddingVertical: 4,
|
|
264
267
|
alignSelf: "flex-start"
|
|
265
268
|
},
|
|
266
269
|
label: {
|
|
267
|
-
fontSize:
|
|
270
|
+
fontSize: 13,
|
|
268
271
|
fontWeight: "500"
|
|
269
272
|
}
|
|
270
273
|
});
|
|
@@ -297,7 +300,7 @@ function CardFooter({ children, style }) {
|
|
|
297
300
|
}
|
|
298
301
|
var styles4 = StyleSheet.create({
|
|
299
302
|
card: {
|
|
300
|
-
borderRadius:
|
|
303
|
+
borderRadius: 20,
|
|
301
304
|
borderWidth: 1,
|
|
302
305
|
shadowColor: "#000",
|
|
303
306
|
shadowOffset: { width: 0, height: 1 },
|
|
@@ -306,24 +309,24 @@ var styles4 = StyleSheet.create({
|
|
|
306
309
|
elevation: 1
|
|
307
310
|
},
|
|
308
311
|
header: {
|
|
309
|
-
padding:
|
|
312
|
+
padding: 28,
|
|
310
313
|
paddingBottom: 0,
|
|
311
|
-
gap:
|
|
314
|
+
gap: 8
|
|
312
315
|
},
|
|
313
316
|
title: {
|
|
314
|
-
fontSize:
|
|
317
|
+
fontSize: 20,
|
|
315
318
|
fontWeight: "600",
|
|
316
|
-
lineHeight:
|
|
319
|
+
lineHeight: 28
|
|
317
320
|
},
|
|
318
321
|
description: {
|
|
319
|
-
fontSize:
|
|
320
|
-
lineHeight:
|
|
322
|
+
fontSize: 15,
|
|
323
|
+
lineHeight: 22
|
|
321
324
|
},
|
|
322
325
|
content: {
|
|
323
|
-
padding:
|
|
326
|
+
padding: 28
|
|
324
327
|
},
|
|
325
328
|
footer: {
|
|
326
|
-
padding:
|
|
329
|
+
padding: 28,
|
|
327
330
|
paddingTop: 0,
|
|
328
331
|
flexDirection: "row",
|
|
329
332
|
alignItems: "center"
|
|
@@ -408,16 +411,16 @@ var styles6 = StyleSheet.create({
|
|
|
408
411
|
}
|
|
409
412
|
});
|
|
410
413
|
var sizeMap2 = {
|
|
411
|
-
sm:
|
|
412
|
-
md:
|
|
413
|
-
lg:
|
|
414
|
-
xl:
|
|
414
|
+
sm: 28,
|
|
415
|
+
md: 40,
|
|
416
|
+
lg: 56,
|
|
417
|
+
xl: 72
|
|
415
418
|
};
|
|
416
419
|
var fontSizeMap = {
|
|
417
|
-
sm:
|
|
418
|
-
md:
|
|
419
|
-
lg:
|
|
420
|
-
xl:
|
|
420
|
+
sm: 12,
|
|
421
|
+
md: 16,
|
|
422
|
+
lg: 22,
|
|
423
|
+
xl: 28
|
|
421
424
|
};
|
|
422
425
|
function Avatar({ src, fallback, size = "md", style }) {
|
|
423
426
|
const { colors } = useTheme();
|
|
@@ -455,12 +458,13 @@ var styles7 = StyleSheet.create({
|
|
|
455
458
|
fontWeight: "500"
|
|
456
459
|
}
|
|
457
460
|
});
|
|
458
|
-
function
|
|
461
|
+
function AlertBanner({ title, description, variant = "default", icon, style }) {
|
|
459
462
|
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
|
-
|
|
463
|
+
const borderColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.border;
|
|
464
|
+
const titleColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.foreground;
|
|
465
|
+
const descColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.mutedForeground;
|
|
466
|
+
const defaultIcon = variant === "destructive" ? "\u26A0" : variant === "success" ? "\u2713" : "\u2139";
|
|
467
|
+
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 }] }, defaultIcon)), /* @__PURE__ */ React23.createElement(View, { style: styles8.content }, title ? /* @__PURE__ */ React23.createElement(Text, { style: [styles8.title, { color: titleColor }] }, title) : null, description ? /* @__PURE__ */ React23.createElement(Text, { style: [styles8.description, { color: descColor }] }, description) : null));
|
|
464
468
|
}
|
|
465
469
|
var styles8 = StyleSheet.create({
|
|
466
470
|
container: {
|
|
@@ -485,6 +489,10 @@ var styles8 = StyleSheet.create({
|
|
|
485
489
|
description: {
|
|
486
490
|
fontSize: 14,
|
|
487
491
|
lineHeight: 20
|
|
492
|
+
},
|
|
493
|
+
defaultIcon: {
|
|
494
|
+
fontSize: 18,
|
|
495
|
+
fontWeight: "700"
|
|
488
496
|
}
|
|
489
497
|
});
|
|
490
498
|
function Progress({ value = 0, max = 100, style }) {
|
|
@@ -527,9 +535,39 @@ var styles9 = StyleSheet.create({
|
|
|
527
535
|
borderRadius: 999
|
|
528
536
|
}
|
|
529
537
|
});
|
|
530
|
-
function EmptyState({ icon, title, description, action, style }) {
|
|
538
|
+
function EmptyState({ icon, title, description, action, size = "default", style }) {
|
|
531
539
|
const { colors } = useTheme();
|
|
532
|
-
|
|
540
|
+
const isCompact = size === "compact";
|
|
541
|
+
return /* @__PURE__ */ React23.createElement(
|
|
542
|
+
View,
|
|
543
|
+
{
|
|
544
|
+
style: [
|
|
545
|
+
styles10.container,
|
|
546
|
+
isCompact && styles10.containerCompact,
|
|
547
|
+
{ borderColor: colors.border },
|
|
548
|
+
style
|
|
549
|
+
]
|
|
550
|
+
},
|
|
551
|
+
icon ? /* @__PURE__ */ React23.createElement(
|
|
552
|
+
View,
|
|
553
|
+
{
|
|
554
|
+
style: [
|
|
555
|
+
styles10.iconWrapper,
|
|
556
|
+
isCompact && styles10.iconWrapperCompact,
|
|
557
|
+
{ backgroundColor: colors.muted }
|
|
558
|
+
]
|
|
559
|
+
},
|
|
560
|
+
icon
|
|
561
|
+
) : null,
|
|
562
|
+
/* @__PURE__ */ React23.createElement(View, { style: styles10.textWrapper }, /* @__PURE__ */ React23.createElement(
|
|
563
|
+
Text,
|
|
564
|
+
{
|
|
565
|
+
style: [styles10.title, isCompact && styles10.titleCompact, { color: colors.foreground }]
|
|
566
|
+
},
|
|
567
|
+
title
|
|
568
|
+
), description && !isCompact ? /* @__PURE__ */ React23.createElement(Text, { style: [styles10.description, { color: colors.mutedForeground }] }, description) : null),
|
|
569
|
+
action && !isCompact ? /* @__PURE__ */ React23.createElement(View, { style: styles10.action }, action) : null
|
|
570
|
+
);
|
|
533
571
|
}
|
|
534
572
|
var styles10 = StyleSheet.create({
|
|
535
573
|
container: {
|
|
@@ -541,6 +579,10 @@ var styles10 = StyleSheet.create({
|
|
|
541
579
|
padding: 32,
|
|
542
580
|
gap: 16
|
|
543
581
|
},
|
|
582
|
+
containerCompact: {
|
|
583
|
+
padding: 20,
|
|
584
|
+
gap: 10
|
|
585
|
+
},
|
|
544
586
|
iconWrapper: {
|
|
545
587
|
width: 48,
|
|
546
588
|
height: 48,
|
|
@@ -548,6 +590,11 @@ var styles10 = StyleSheet.create({
|
|
|
548
590
|
alignItems: "center",
|
|
549
591
|
justifyContent: "center"
|
|
550
592
|
},
|
|
593
|
+
iconWrapperCompact: {
|
|
594
|
+
width: 36,
|
|
595
|
+
height: 36,
|
|
596
|
+
borderRadius: 8
|
|
597
|
+
},
|
|
551
598
|
textWrapper: {
|
|
552
599
|
alignItems: "center",
|
|
553
600
|
gap: 8,
|
|
@@ -558,6 +605,9 @@ var styles10 = StyleSheet.create({
|
|
|
558
605
|
fontWeight: "500",
|
|
559
606
|
textAlign: "center"
|
|
560
607
|
},
|
|
608
|
+
titleCompact: {
|
|
609
|
+
fontSize: 15
|
|
610
|
+
},
|
|
561
611
|
description: {
|
|
562
612
|
fontSize: 14,
|
|
563
613
|
lineHeight: 20,
|
|
@@ -592,7 +642,7 @@ function Textarea({
|
|
|
592
642
|
borderColor: error ? colors.destructive : focused ? colors.ring : colors.border,
|
|
593
643
|
color: colors.foreground,
|
|
594
644
|
backgroundColor: colors.background,
|
|
595
|
-
minHeight: rows *
|
|
645
|
+
minHeight: rows * 30
|
|
596
646
|
},
|
|
597
647
|
style
|
|
598
648
|
],
|
|
@@ -612,22 +662,22 @@ function Textarea({
|
|
|
612
662
|
}
|
|
613
663
|
var styles11 = StyleSheet.create({
|
|
614
664
|
container: {
|
|
615
|
-
gap:
|
|
665
|
+
gap: 6
|
|
616
666
|
},
|
|
617
667
|
label: {
|
|
618
|
-
fontSize:
|
|
668
|
+
fontSize: 15,
|
|
619
669
|
fontWeight: "500",
|
|
620
|
-
marginBottom:
|
|
670
|
+
marginBottom: 6
|
|
621
671
|
},
|
|
622
672
|
input: {
|
|
623
673
|
borderWidth: 1.5,
|
|
624
|
-
borderRadius:
|
|
625
|
-
paddingHorizontal:
|
|
626
|
-
paddingVertical:
|
|
627
|
-
fontSize:
|
|
674
|
+
borderRadius: 14,
|
|
675
|
+
paddingHorizontal: 20,
|
|
676
|
+
paddingVertical: 16,
|
|
677
|
+
fontSize: 17
|
|
628
678
|
},
|
|
629
679
|
helperText: {
|
|
630
|
-
fontSize:
|
|
680
|
+
fontSize: 13
|
|
631
681
|
}
|
|
632
682
|
});
|
|
633
683
|
function Checkbox({
|
|
@@ -687,31 +737,32 @@ var styles12 = StyleSheet.create({
|
|
|
687
737
|
row: {
|
|
688
738
|
flexDirection: "row",
|
|
689
739
|
alignItems: "center",
|
|
690
|
-
gap:
|
|
740
|
+
gap: 12
|
|
691
741
|
},
|
|
692
742
|
box: {
|
|
693
|
-
width:
|
|
694
|
-
height:
|
|
695
|
-
borderRadius:
|
|
743
|
+
width: 28,
|
|
744
|
+
height: 28,
|
|
745
|
+
borderRadius: 8,
|
|
696
746
|
borderWidth: 1.5,
|
|
697
747
|
alignItems: "center",
|
|
698
748
|
justifyContent: "center"
|
|
699
749
|
},
|
|
700
750
|
checkmark: {
|
|
701
|
-
width:
|
|
702
|
-
height:
|
|
751
|
+
width: 15,
|
|
752
|
+
height: 9,
|
|
703
753
|
borderLeftWidth: 2,
|
|
704
754
|
borderBottomWidth: 2,
|
|
705
755
|
transform: [{ rotate: "-45deg" }, { translateY: -1 }]
|
|
706
756
|
},
|
|
707
757
|
label: {
|
|
708
|
-
fontSize:
|
|
709
|
-
lineHeight:
|
|
758
|
+
fontSize: 15,
|
|
759
|
+
lineHeight: 22
|
|
710
760
|
}
|
|
711
761
|
});
|
|
712
|
-
var
|
|
713
|
-
var
|
|
714
|
-
var
|
|
762
|
+
var nativeDriver2 = Platform.OS !== "web";
|
|
763
|
+
var TRACK_WIDTH = 60;
|
|
764
|
+
var TRACK_HEIGHT = 36;
|
|
765
|
+
var THUMB_SIZE = 28;
|
|
715
766
|
var THUMB_OFFSET = 4;
|
|
716
767
|
var THUMB_TRAVEL = TRACK_WIDTH - THUMB_SIZE - THUMB_OFFSET * 2;
|
|
717
768
|
function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
@@ -722,7 +773,7 @@ function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
|
722
773
|
Animated.parallel([
|
|
723
774
|
Animated.spring(translateX, {
|
|
724
775
|
toValue: checked ? THUMB_TRAVEL : 0,
|
|
725
|
-
useNativeDriver:
|
|
776
|
+
useNativeDriver: nativeDriver2,
|
|
726
777
|
bounciness: 4
|
|
727
778
|
}),
|
|
728
779
|
Animated.timing(trackOpacity, {
|
|
@@ -764,11 +815,14 @@ var styles13 = StyleSheet.create({
|
|
|
764
815
|
track: {
|
|
765
816
|
width: TRACK_WIDTH,
|
|
766
817
|
height: TRACK_HEIGHT,
|
|
767
|
-
borderRadius: TRACK_HEIGHT / 2
|
|
768
|
-
justifyContent
|
|
769
|
-
|
|
818
|
+
borderRadius: TRACK_HEIGHT / 2
|
|
819
|
+
// No justifyContent/alignItems — thumb uses absolute positioning
|
|
820
|
+
// so the track's flex layout doesn't interfere with translateX animation
|
|
770
821
|
},
|
|
771
822
|
thumb: {
|
|
823
|
+
position: "absolute",
|
|
824
|
+
top: THUMB_OFFSET,
|
|
825
|
+
left: THUMB_OFFSET,
|
|
772
826
|
width: THUMB_SIZE,
|
|
773
827
|
height: THUMB_SIZE,
|
|
774
828
|
borderRadius: THUMB_SIZE / 2,
|
|
@@ -791,12 +845,22 @@ function Toggle({
|
|
|
791
845
|
size = "md",
|
|
792
846
|
label,
|
|
793
847
|
icon,
|
|
848
|
+
activeIcon,
|
|
794
849
|
disabled,
|
|
795
850
|
style,
|
|
796
851
|
...props
|
|
797
852
|
}) {
|
|
798
853
|
const { colors } = useTheme();
|
|
799
854
|
const scale = useRef(new Animated.Value(1)).current;
|
|
855
|
+
const pressAnim = useRef(new Animated.Value(pressed ? 1 : 0)).current;
|
|
856
|
+
useEffect(() => {
|
|
857
|
+
Animated.timing(pressAnim, {
|
|
858
|
+
toValue: pressed ? 1 : 0,
|
|
859
|
+
duration: 150,
|
|
860
|
+
easing: Easing.out(Easing.ease),
|
|
861
|
+
useNativeDriver: false
|
|
862
|
+
}).start();
|
|
863
|
+
}, [pressed, pressAnim]);
|
|
800
864
|
const handlePressIn = () => {
|
|
801
865
|
if (disabled) return;
|
|
802
866
|
Animated.spring(scale, { toValue: 0.95, useNativeDriver: true, speed: 40, bounciness: 0 }).start();
|
|
@@ -804,34 +868,71 @@ function Toggle({
|
|
|
804
868
|
const handlePressOut = () => {
|
|
805
869
|
Animated.spring(scale, { toValue: 1, useNativeDriver: true, speed: 40, bounciness: 4 }).start();
|
|
806
870
|
};
|
|
807
|
-
const
|
|
808
|
-
|
|
871
|
+
const borderColor = pressAnim.interpolate({
|
|
872
|
+
inputRange: [0, 1],
|
|
873
|
+
outputRange: [variant === "outline" ? colors.border : "transparent", colors.primary]
|
|
874
|
+
});
|
|
875
|
+
const backgroundColor = pressAnim.interpolate({
|
|
876
|
+
inputRange: [0, 1],
|
|
877
|
+
outputRange: ["transparent", colors.accent]
|
|
878
|
+
});
|
|
879
|
+
const textColor = pressAnim.interpolate({
|
|
880
|
+
inputRange: [0, 1],
|
|
881
|
+
outputRange: [colors.foreground, colors.primary]
|
|
882
|
+
});
|
|
883
|
+
const LeftIcon = () => {
|
|
884
|
+
const renderProp = (prop) => {
|
|
885
|
+
if (!prop) return null;
|
|
886
|
+
if (typeof prop === "function") return prop(pressed);
|
|
887
|
+
return prop;
|
|
888
|
+
};
|
|
889
|
+
if (!pressed) return renderProp(icon);
|
|
890
|
+
const active = renderProp(activeIcon);
|
|
891
|
+
if (active) return /* @__PURE__ */ React23.createElement(React23.Fragment, null, active);
|
|
892
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles14.checkContainer, { borderColor: colors.primary }] }, /* @__PURE__ */ React23.createElement(Text, { style: [styles14.checkMark, { color: colors.primary }] }, "\u2713"));
|
|
893
|
+
};
|
|
809
894
|
return /* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(
|
|
810
|
-
|
|
895
|
+
Animated.View,
|
|
811
896
|
{
|
|
812
|
-
style: [
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
disabled,
|
|
820
|
-
activeOpacity: 1,
|
|
821
|
-
touchSoundDisabled: true,
|
|
822
|
-
...props
|
|
897
|
+
style: [
|
|
898
|
+
styles14.base,
|
|
899
|
+
sizeStyles[size],
|
|
900
|
+
{ borderColor, backgroundColor, borderWidth: 2 },
|
|
901
|
+
disabled && styles14.disabled,
|
|
902
|
+
style
|
|
903
|
+
]
|
|
823
904
|
},
|
|
824
|
-
|
|
825
|
-
|
|
905
|
+
/* @__PURE__ */ React23.createElement(
|
|
906
|
+
TouchableOpacity,
|
|
907
|
+
{
|
|
908
|
+
style: styles14.touchable,
|
|
909
|
+
onPress: () => {
|
|
910
|
+
Haptics11.selectionAsync();
|
|
911
|
+
onPressedChange?.(!pressed);
|
|
912
|
+
},
|
|
913
|
+
onPressIn: handlePressIn,
|
|
914
|
+
onPressOut: handlePressOut,
|
|
915
|
+
disabled,
|
|
916
|
+
activeOpacity: 1,
|
|
917
|
+
touchSoundDisabled: true,
|
|
918
|
+
...props
|
|
919
|
+
},
|
|
920
|
+
/* @__PURE__ */ React23.createElement(LeftIcon, null),
|
|
921
|
+
label ? /* @__PURE__ */ React23.createElement(Animated.Text, { style: [styles14.label, { color: textColor }] }, label) : null
|
|
922
|
+
)
|
|
826
923
|
));
|
|
827
924
|
}
|
|
828
925
|
var styles14 = StyleSheet.create({
|
|
829
926
|
base: {
|
|
830
927
|
borderRadius: 8,
|
|
928
|
+
overflow: "hidden"
|
|
929
|
+
},
|
|
930
|
+
touchable: {
|
|
831
931
|
flexDirection: "row",
|
|
832
932
|
alignItems: "center",
|
|
833
933
|
justifyContent: "center",
|
|
834
|
-
gap: 8
|
|
934
|
+
gap: 8,
|
|
935
|
+
flex: 1
|
|
835
936
|
},
|
|
836
937
|
disabled: {
|
|
837
938
|
opacity: 0.45
|
|
@@ -839,6 +940,18 @@ var styles14 = StyleSheet.create({
|
|
|
839
940
|
label: {
|
|
840
941
|
fontSize: 14,
|
|
841
942
|
fontWeight: "500"
|
|
943
|
+
},
|
|
944
|
+
checkContainer: {
|
|
945
|
+
width: 24,
|
|
946
|
+
height: 24,
|
|
947
|
+
borderRadius: 12,
|
|
948
|
+
borderWidth: 2,
|
|
949
|
+
alignItems: "center",
|
|
950
|
+
justifyContent: "center"
|
|
951
|
+
},
|
|
952
|
+
checkMark: {
|
|
953
|
+
fontSize: 14,
|
|
954
|
+
fontWeight: "700"
|
|
842
955
|
}
|
|
843
956
|
});
|
|
844
957
|
function RadioItem({
|
|
@@ -969,7 +1082,7 @@ function TabTrigger({
|
|
|
969
1082
|
activeOpacity: 1,
|
|
970
1083
|
touchSoundDisabled: true
|
|
971
1084
|
},
|
|
972
|
-
/* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(
|
|
1085
|
+
/* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(View, { style: styles16.triggerInner }, tab.icon ? /* @__PURE__ */ React23.createElement(View, { style: styles16.triggerIcon }, typeof tab.icon === "function" ? tab.icon(isActive) : tab.icon) : null, /* @__PURE__ */ React23.createElement(
|
|
973
1086
|
Text,
|
|
974
1087
|
{
|
|
975
1088
|
style: [
|
|
@@ -979,7 +1092,7 @@ function TabTrigger({
|
|
|
979
1092
|
]
|
|
980
1093
|
},
|
|
981
1094
|
tab.label
|
|
982
|
-
))
|
|
1095
|
+
)))
|
|
983
1096
|
);
|
|
984
1097
|
}
|
|
985
1098
|
function Tabs({ tabs, value, onValueChange, children, style }) {
|
|
@@ -1035,7 +1148,7 @@ function Tabs({ tabs, value, onValueChange, children, style }) {
|
|
|
1035
1148
|
bottom: 4,
|
|
1036
1149
|
left: pillX,
|
|
1037
1150
|
width: pillWidth,
|
|
1038
|
-
borderRadius:
|
|
1151
|
+
borderRadius: 8,
|
|
1039
1152
|
shadowColor: "#000",
|
|
1040
1153
|
shadowOffset: { width: 0, height: 1 },
|
|
1041
1154
|
shadowOpacity: 0.1,
|
|
@@ -1069,22 +1182,33 @@ function TabsContent({ value, activeValue, children, style }) {
|
|
|
1069
1182
|
var styles16 = StyleSheet.create({
|
|
1070
1183
|
list: {
|
|
1071
1184
|
flexDirection: "row",
|
|
1072
|
-
borderRadius:
|
|
1185
|
+
borderRadius: 12,
|
|
1073
1186
|
padding: 4,
|
|
1074
1187
|
gap: 4
|
|
1075
1188
|
},
|
|
1076
1189
|
pill: {},
|
|
1077
1190
|
trigger: {
|
|
1078
1191
|
flex: 1,
|
|
1079
|
-
paddingVertical:
|
|
1080
|
-
paddingHorizontal:
|
|
1081
|
-
borderRadius:
|
|
1192
|
+
paddingVertical: 12,
|
|
1193
|
+
paddingHorizontal: 16,
|
|
1194
|
+
borderRadius: 8,
|
|
1082
1195
|
alignItems: "center",
|
|
1083
1196
|
justifyContent: "center",
|
|
1084
1197
|
zIndex: 1
|
|
1085
1198
|
},
|
|
1199
|
+
triggerInner: {
|
|
1200
|
+
flexDirection: "row",
|
|
1201
|
+
alignItems: "center",
|
|
1202
|
+
justifyContent: "center",
|
|
1203
|
+
gap: 8
|
|
1204
|
+
},
|
|
1205
|
+
triggerIcon: {
|
|
1206
|
+
marginRight: 6,
|
|
1207
|
+
alignItems: "center",
|
|
1208
|
+
justifyContent: "center"
|
|
1209
|
+
},
|
|
1086
1210
|
triggerLabel: {
|
|
1087
|
-
fontSize:
|
|
1211
|
+
fontSize: 15,
|
|
1088
1212
|
fontWeight: "400"
|
|
1089
1213
|
},
|
|
1090
1214
|
activeTriggerLabel: {
|
|
@@ -1102,7 +1226,7 @@ function AccordionItemComponent({
|
|
|
1102
1226
|
const contentHeight = useRef(0);
|
|
1103
1227
|
const scale = useRef(new Animated.Value(1)).current;
|
|
1104
1228
|
const toggle = (open) => {
|
|
1105
|
-
const easing = open ? Easing.out(Easing.ease) : Easing.in(Easing.ease);
|
|
1229
|
+
const easing = open ? Easing$1.out(Easing$1.ease) : Easing$1.in(Easing$1.ease);
|
|
1106
1230
|
animatedHeight.value = withTiming(open ? contentHeight.current : 0, { duration: 220, easing });
|
|
1107
1231
|
animatedRotation.value = withTiming(open ? 1 : 0, { duration: 220, easing });
|
|
1108
1232
|
};
|
|
@@ -1183,19 +1307,19 @@ var styles17 = StyleSheet.create({
|
|
|
1183
1307
|
flexDirection: "row",
|
|
1184
1308
|
justifyContent: "space-between",
|
|
1185
1309
|
alignItems: "center",
|
|
1186
|
-
paddingVertical:
|
|
1310
|
+
paddingVertical: 20
|
|
1187
1311
|
},
|
|
1188
1312
|
triggerText: {
|
|
1189
|
-
fontSize:
|
|
1313
|
+
fontSize: 17,
|
|
1190
1314
|
fontWeight: "500",
|
|
1191
1315
|
flex: 1
|
|
1192
1316
|
},
|
|
1193
1317
|
chevron: {
|
|
1194
|
-
fontSize:
|
|
1318
|
+
fontSize: 18,
|
|
1195
1319
|
marginLeft: 8
|
|
1196
1320
|
},
|
|
1197
1321
|
content: {
|
|
1198
|
-
paddingBottom:
|
|
1322
|
+
paddingBottom: 20,
|
|
1199
1323
|
position: "absolute",
|
|
1200
1324
|
width: "100%"
|
|
1201
1325
|
}
|
|
@@ -1504,10 +1628,10 @@ function Select({
|
|
|
1504
1628
|
}
|
|
1505
1629
|
var styles20 = StyleSheet.create({
|
|
1506
1630
|
container: {
|
|
1507
|
-
gap:
|
|
1631
|
+
gap: 6
|
|
1508
1632
|
},
|
|
1509
1633
|
label: {
|
|
1510
|
-
fontSize:
|
|
1634
|
+
fontSize: 15,
|
|
1511
1635
|
fontWeight: "500",
|
|
1512
1636
|
marginBottom: 2
|
|
1513
1637
|
},
|
|
@@ -1516,24 +1640,24 @@ var styles20 = StyleSheet.create({
|
|
|
1516
1640
|
alignItems: "center",
|
|
1517
1641
|
justifyContent: "space-between",
|
|
1518
1642
|
borderWidth: 1.5,
|
|
1519
|
-
borderRadius:
|
|
1520
|
-
paddingHorizontal:
|
|
1521
|
-
paddingVertical:
|
|
1643
|
+
borderRadius: 14,
|
|
1644
|
+
paddingHorizontal: 20,
|
|
1645
|
+
paddingVertical: 16
|
|
1522
1646
|
},
|
|
1523
1647
|
triggerText: {
|
|
1524
|
-
fontSize:
|
|
1648
|
+
fontSize: 17,
|
|
1525
1649
|
flex: 1
|
|
1526
1650
|
},
|
|
1527
1651
|
chevron: {
|
|
1528
|
-
fontSize:
|
|
1652
|
+
fontSize: 16,
|
|
1529
1653
|
marginLeft: 8
|
|
1530
1654
|
},
|
|
1531
1655
|
helperText: {
|
|
1532
|
-
fontSize:
|
|
1656
|
+
fontSize: 13
|
|
1533
1657
|
},
|
|
1534
1658
|
sheetBackground: {
|
|
1535
|
-
borderTopLeftRadius:
|
|
1536
|
-
borderTopRightRadius:
|
|
1659
|
+
borderTopLeftRadius: 24,
|
|
1660
|
+
borderTopRightRadius: 24
|
|
1537
1661
|
},
|
|
1538
1662
|
sheetHandle: {
|
|
1539
1663
|
width: 36,
|
|
@@ -1541,32 +1665,32 @@ var styles20 = StyleSheet.create({
|
|
|
1541
1665
|
borderRadius: 2
|
|
1542
1666
|
},
|
|
1543
1667
|
sheetContent: {
|
|
1544
|
-
paddingHorizontal:
|
|
1545
|
-
paddingBottom:
|
|
1668
|
+
paddingHorizontal: 20,
|
|
1669
|
+
paddingBottom: 36
|
|
1546
1670
|
},
|
|
1547
1671
|
sheetTitle: {
|
|
1548
|
-
fontSize:
|
|
1672
|
+
fontSize: 17,
|
|
1549
1673
|
fontWeight: "600",
|
|
1550
|
-
paddingVertical:
|
|
1674
|
+
paddingVertical: 16,
|
|
1551
1675
|
paddingHorizontal: 4
|
|
1552
1676
|
},
|
|
1553
1677
|
option: {
|
|
1554
1678
|
flexDirection: "row",
|
|
1555
1679
|
alignItems: "center",
|
|
1556
1680
|
justifyContent: "space-between",
|
|
1557
|
-
paddingHorizontal:
|
|
1558
|
-
paddingVertical:
|
|
1559
|
-
borderRadius:
|
|
1681
|
+
paddingHorizontal: 16,
|
|
1682
|
+
paddingVertical: 16,
|
|
1683
|
+
borderRadius: 12
|
|
1560
1684
|
},
|
|
1561
1685
|
optionText: {
|
|
1562
|
-
fontSize:
|
|
1686
|
+
fontSize: 17,
|
|
1563
1687
|
flex: 1
|
|
1564
1688
|
},
|
|
1565
1689
|
disabledOption: {
|
|
1566
1690
|
opacity: 0.45
|
|
1567
1691
|
},
|
|
1568
1692
|
checkmark: {
|
|
1569
|
-
fontSize:
|
|
1693
|
+
fontSize: 16,
|
|
1570
1694
|
fontWeight: "600",
|
|
1571
1695
|
marginLeft: 8
|
|
1572
1696
|
}
|
|
@@ -1588,7 +1712,7 @@ function ToastNotification({ item, onDismiss }) {
|
|
|
1588
1712
|
const translateX = useSharedValue(0);
|
|
1589
1713
|
const opacity = useSharedValue(0);
|
|
1590
1714
|
useEffect(() => {
|
|
1591
|
-
translateY.value = withTiming(0, { duration: 120, easing: Easing.out(Easing.exp) });
|
|
1715
|
+
translateY.value = withTiming(0, { duration: 120, easing: Easing$1.out(Easing$1.exp) });
|
|
1592
1716
|
opacity.value = withTiming(1, { duration: 100 });
|
|
1593
1717
|
const timer = setTimeout(() => {
|
|
1594
1718
|
translateY.value = withTiming(-80, { duration: 200 });
|
|
@@ -1626,7 +1750,8 @@ function ToastNotification({ item, onDismiss }) {
|
|
|
1626
1750
|
destructive: colors.destructiveForeground,
|
|
1627
1751
|
success: colors.successForeground
|
|
1628
1752
|
}[item.variant ?? "default"];
|
|
1629
|
-
|
|
1753
|
+
const leftIcon = item.icon ?? /* @__PURE__ */ React23.createElement(Text, { style: [styles21.defaultIcon, { color: textColor }] }, item.variant === "success" ? "\u2713" : item.variant === "destructive" ? "\u2716" : "\u2139");
|
|
1754
|
+
return /* @__PURE__ */ React23.createElement(GestureDetector, { gesture: panGesture }, /* @__PURE__ */ React23.createElement(ReanimatedAnimated.View, { style: [styles21.toast, { backgroundColor: bgColor }, animatedStyle] }, /* @__PURE__ */ React23.createElement(View, { style: styles21.leftIconContainer }, leftIcon), /* @__PURE__ */ React23.createElement(View, { style: styles21.toastContent }, item.title ? /* @__PURE__ */ React23.createElement(Text, { style: [styles21.toastTitle, { color: textColor }] }, item.title) : null, item.description ? /* @__PURE__ */ React23.createElement(Text, { style: [styles21.toastDescription, { color: textColor, opacity: 0.85 }] }, item.description) : null), /* @__PURE__ */ React23.createElement(TouchableOpacity, { onPress: onDismiss, style: styles21.dismissButton, touchSoundDisabled: true }, /* @__PURE__ */ React23.createElement(Text, { style: [styles21.dismissIcon, { color: textColor }] }, "\u2715"))));
|
|
1630
1755
|
}
|
|
1631
1756
|
function ToastProvider({ children }) {
|
|
1632
1757
|
const [toasts, setToasts] = useState([]);
|
|
@@ -1658,9 +1783,9 @@ var styles21 = StyleSheet.create({
|
|
|
1658
1783
|
toast: {
|
|
1659
1784
|
flexDirection: "row",
|
|
1660
1785
|
alignItems: "center",
|
|
1661
|
-
borderRadius:
|
|
1662
|
-
paddingHorizontal:
|
|
1663
|
-
paddingVertical:
|
|
1786
|
+
borderRadius: 16,
|
|
1787
|
+
paddingHorizontal: 20,
|
|
1788
|
+
paddingVertical: 14,
|
|
1664
1789
|
shadowColor: "#000",
|
|
1665
1790
|
shadowOffset: { width: 0, height: 4 },
|
|
1666
1791
|
shadowOpacity: 0.15,
|
|
@@ -1671,19 +1796,29 @@ var styles21 = StyleSheet.create({
|
|
|
1671
1796
|
flex: 1,
|
|
1672
1797
|
gap: 4
|
|
1673
1798
|
},
|
|
1799
|
+
leftIconContainer: {
|
|
1800
|
+
width: 36,
|
|
1801
|
+
alignItems: "center",
|
|
1802
|
+
justifyContent: "center",
|
|
1803
|
+
marginRight: 8
|
|
1804
|
+
},
|
|
1805
|
+
defaultIcon: {
|
|
1806
|
+
fontSize: 22,
|
|
1807
|
+
fontWeight: "700"
|
|
1808
|
+
},
|
|
1674
1809
|
toastTitle: {
|
|
1675
|
-
fontSize:
|
|
1810
|
+
fontSize: 15,
|
|
1676
1811
|
fontWeight: "600"
|
|
1677
1812
|
},
|
|
1678
1813
|
toastDescription: {
|
|
1679
|
-
fontSize:
|
|
1814
|
+
fontSize: 14
|
|
1680
1815
|
},
|
|
1681
1816
|
dismissButton: {
|
|
1682
1817
|
padding: 12,
|
|
1683
1818
|
marginLeft: 4
|
|
1684
1819
|
},
|
|
1685
1820
|
dismissIcon: {
|
|
1686
|
-
fontSize:
|
|
1821
|
+
fontSize: 14
|
|
1687
1822
|
}
|
|
1688
1823
|
});
|
|
1689
1824
|
function formatCurrency(raw, separator) {
|
|
@@ -1728,5 +1863,388 @@ function CurrencyInput({
|
|
|
1728
1863
|
}
|
|
1729
1864
|
);
|
|
1730
1865
|
}
|
|
1866
|
+
function formatValue(value, prefix, showDecimals) {
|
|
1867
|
+
const num = typeof value === "string" ? parseFloat(value.replace(/[^0-9.-]/g, "")) : value;
|
|
1868
|
+
if (isNaN(num)) return `${prefix}0`;
|
|
1869
|
+
const abs = Math.abs(num);
|
|
1870
|
+
const sign = num < 0 ? "-" : "";
|
|
1871
|
+
const intPart = Math.floor(abs).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
1872
|
+
if (showDecimals) {
|
|
1873
|
+
const decStr = (abs % 1).toFixed(2).slice(2);
|
|
1874
|
+
return `${sign}${prefix}${intPart},${decStr}`;
|
|
1875
|
+
}
|
|
1876
|
+
return `${sign}${prefix}${intPart}`;
|
|
1877
|
+
}
|
|
1878
|
+
function CurrencyDisplay({ value, prefix = "$", showDecimals = false, textColor, style }) {
|
|
1879
|
+
const { colors } = useTheme();
|
|
1880
|
+
const formatted = formatValue(value, prefix, showDecimals);
|
|
1881
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles22.container, style] }, /* @__PURE__ */ React23.createElement(Text, { style: [styles22.amount, { color: textColor ?? colors.foreground }], allowFontScaling: true }, formatted));
|
|
1882
|
+
}
|
|
1883
|
+
var styles22 = StyleSheet.create({
|
|
1884
|
+
container: {},
|
|
1885
|
+
amount: {
|
|
1886
|
+
fontSize: 56,
|
|
1887
|
+
fontWeight: "700"
|
|
1888
|
+
}
|
|
1889
|
+
});
|
|
1890
|
+
function formatCurrency2(raw, separator) {
|
|
1891
|
+
const digits = raw.replace(/\D/g, "");
|
|
1892
|
+
if (!digits) return "";
|
|
1893
|
+
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
1894
|
+
}
|
|
1895
|
+
function CurrencyInputLarge({
|
|
1896
|
+
value,
|
|
1897
|
+
onChangeText,
|
|
1898
|
+
onChangeValue,
|
|
1899
|
+
prefix = "$",
|
|
1900
|
+
thousandsSeparator = ".",
|
|
1901
|
+
label,
|
|
1902
|
+
error,
|
|
1903
|
+
hint,
|
|
1904
|
+
placeholder,
|
|
1905
|
+
editable,
|
|
1906
|
+
containerStyle
|
|
1907
|
+
}) {
|
|
1908
|
+
const handleChange = (text) => {
|
|
1909
|
+
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
1910
|
+
const formatted = formatCurrency2(withoutPrefix, thousandsSeparator);
|
|
1911
|
+
const display = formatted ? `${prefix}${formatted}` : "";
|
|
1912
|
+
onChangeText?.(display);
|
|
1913
|
+
const separatorRegex = new RegExp(`\\${thousandsSeparator}`, "g");
|
|
1914
|
+
const raw = parseFloat(formatted.replace(separatorRegex, "") || "0");
|
|
1915
|
+
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
1916
|
+
};
|
|
1917
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1918
|
+
Input,
|
|
1919
|
+
{
|
|
1920
|
+
value,
|
|
1921
|
+
onChangeText: handleChange,
|
|
1922
|
+
keyboardType: "numeric",
|
|
1923
|
+
label,
|
|
1924
|
+
error,
|
|
1925
|
+
hint,
|
|
1926
|
+
placeholder: placeholder ?? `${prefix}0`,
|
|
1927
|
+
editable,
|
|
1928
|
+
containerStyle,
|
|
1929
|
+
style: { fontSize: 36 }
|
|
1930
|
+
}
|
|
1931
|
+
);
|
|
1932
|
+
}
|
|
1933
|
+
var nativeDriver3 = Platform.OS !== "web";
|
|
1934
|
+
function ListItem({ icon, title, subtitle, trailing, onPress, disabled, style }) {
|
|
1935
|
+
const { colors } = useTheme();
|
|
1936
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
1937
|
+
const handlePressIn = () => {
|
|
1938
|
+
if (!onPress || disabled) return;
|
|
1939
|
+
Animated.spring(scale, {
|
|
1940
|
+
toValue: 0.97,
|
|
1941
|
+
useNativeDriver: nativeDriver3,
|
|
1942
|
+
speed: 40,
|
|
1943
|
+
bounciness: 0
|
|
1944
|
+
}).start();
|
|
1945
|
+
};
|
|
1946
|
+
const handlePressOut = () => {
|
|
1947
|
+
Animated.spring(scale, {
|
|
1948
|
+
toValue: 1,
|
|
1949
|
+
useNativeDriver: nativeDriver3,
|
|
1950
|
+
speed: 40,
|
|
1951
|
+
bounciness: 4
|
|
1952
|
+
}).start();
|
|
1953
|
+
};
|
|
1954
|
+
const handlePress = () => {
|
|
1955
|
+
Haptics11.selectionAsync();
|
|
1956
|
+
onPress?.();
|
|
1957
|
+
};
|
|
1958
|
+
return /* @__PURE__ */ React23.createElement(Animated.View, { style: [{ transform: [{ scale }] }, disabled && styles23.disabled] }, /* @__PURE__ */ React23.createElement(
|
|
1959
|
+
TouchableOpacity,
|
|
1960
|
+
{
|
|
1961
|
+
style: [styles23.container, style],
|
|
1962
|
+
onPress: onPress ? handlePress : void 0,
|
|
1963
|
+
onPressIn: handlePressIn,
|
|
1964
|
+
onPressOut: handlePressOut,
|
|
1965
|
+
disabled,
|
|
1966
|
+
activeOpacity: 1,
|
|
1967
|
+
touchSoundDisabled: true
|
|
1968
|
+
},
|
|
1969
|
+
icon ? /* @__PURE__ */ React23.createElement(View, { style: styles23.iconWrapper }, icon) : null,
|
|
1970
|
+
/* @__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),
|
|
1971
|
+
trailing !== void 0 ? typeof trailing === "string" ? /* @__PURE__ */ React23.createElement(Text, { style: [styles23.trailing, { color: colors.mutedForeground }], allowFontScaling: true }, trailing) : trailing : null
|
|
1972
|
+
));
|
|
1973
|
+
}
|
|
1974
|
+
var styles23 = StyleSheet.create({
|
|
1975
|
+
container: {
|
|
1976
|
+
flexDirection: "row",
|
|
1977
|
+
alignItems: "center",
|
|
1978
|
+
paddingHorizontal: 16,
|
|
1979
|
+
paddingVertical: 14,
|
|
1980
|
+
gap: 12
|
|
1981
|
+
},
|
|
1982
|
+
iconWrapper: {
|
|
1983
|
+
alignItems: "center",
|
|
1984
|
+
justifyContent: "center"
|
|
1985
|
+
},
|
|
1986
|
+
content: {
|
|
1987
|
+
flex: 1,
|
|
1988
|
+
gap: 3
|
|
1989
|
+
},
|
|
1990
|
+
title: {
|
|
1991
|
+
fontSize: 16,
|
|
1992
|
+
fontWeight: "500",
|
|
1993
|
+
lineHeight: 22
|
|
1994
|
+
},
|
|
1995
|
+
subtitle: {
|
|
1996
|
+
fontSize: 13,
|
|
1997
|
+
lineHeight: 18
|
|
1998
|
+
},
|
|
1999
|
+
trailing: {
|
|
2000
|
+
fontSize: 15
|
|
2001
|
+
},
|
|
2002
|
+
disabled: {
|
|
2003
|
+
opacity: 0.45
|
|
2004
|
+
}
|
|
2005
|
+
});
|
|
2006
|
+
var nativeDriver4 = Platform.OS !== "web";
|
|
2007
|
+
function Chip({ label, selected = false, onPress, style }) {
|
|
2008
|
+
const { colors } = useTheme();
|
|
2009
|
+
const scale = useRef(new Animated.Value(1)).current;
|
|
2010
|
+
const pressAnim = useRef(new Animated.Value(selected ? 1 : 0)).current;
|
|
2011
|
+
useEffect(() => {
|
|
2012
|
+
Animated.timing(pressAnim, {
|
|
2013
|
+
toValue: selected ? 1 : 0,
|
|
2014
|
+
duration: 150,
|
|
2015
|
+
easing: Easing.out(Easing.ease),
|
|
2016
|
+
useNativeDriver: false
|
|
2017
|
+
}).start();
|
|
2018
|
+
}, [selected, pressAnim]);
|
|
2019
|
+
const handlePressIn = () => {
|
|
2020
|
+
Animated.spring(scale, {
|
|
2021
|
+
toValue: 0.95,
|
|
2022
|
+
useNativeDriver: nativeDriver4,
|
|
2023
|
+
speed: 40,
|
|
2024
|
+
bounciness: 0
|
|
2025
|
+
}).start();
|
|
2026
|
+
};
|
|
2027
|
+
const handlePressOut = () => {
|
|
2028
|
+
Animated.spring(scale, {
|
|
2029
|
+
toValue: 1,
|
|
2030
|
+
useNativeDriver: nativeDriver4,
|
|
2031
|
+
speed: 40,
|
|
2032
|
+
bounciness: 4
|
|
2033
|
+
}).start();
|
|
2034
|
+
};
|
|
2035
|
+
const handlePress = () => {
|
|
2036
|
+
Haptics11.selectionAsync();
|
|
2037
|
+
onPress?.();
|
|
2038
|
+
};
|
|
2039
|
+
const backgroundColor = pressAnim.interpolate({
|
|
2040
|
+
inputRange: [0, 1],
|
|
2041
|
+
outputRange: [colors.secondary, colors.primary]
|
|
2042
|
+
});
|
|
2043
|
+
const textColor = pressAnim.interpolate({
|
|
2044
|
+
inputRange: [0, 1],
|
|
2045
|
+
outputRange: [colors.foreground, colors.primaryForeground]
|
|
2046
|
+
});
|
|
2047
|
+
const borderColor = pressAnim.interpolate({
|
|
2048
|
+
inputRange: [0, 1],
|
|
2049
|
+
outputRange: [colors.border, colors.primary]
|
|
2050
|
+
});
|
|
2051
|
+
return /* @__PURE__ */ React23.createElement(Animated.View, { style: [styles24.wrapper, { transform: [{ scale }] }, style] }, /* @__PURE__ */ React23.createElement(
|
|
2052
|
+
TouchableOpacity,
|
|
2053
|
+
{
|
|
2054
|
+
onPress: handlePress,
|
|
2055
|
+
onPressIn: handlePressIn,
|
|
2056
|
+
onPressOut: handlePressOut,
|
|
2057
|
+
activeOpacity: 1,
|
|
2058
|
+
touchSoundDisabled: true
|
|
2059
|
+
},
|
|
2060
|
+
/* @__PURE__ */ React23.createElement(Animated.View, { style: [styles24.chip, { backgroundColor, borderColor }] }, /* @__PURE__ */ React23.createElement(Animated.Text, { style: [styles24.label, { color: textColor }], allowFontScaling: true }, label))
|
|
2061
|
+
));
|
|
2062
|
+
}
|
|
2063
|
+
function ChipGroup({ options, value, onValueChange, style }) {
|
|
2064
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles24.group, style] }, options.map((opt) => /* @__PURE__ */ React23.createElement(
|
|
2065
|
+
Chip,
|
|
2066
|
+
{
|
|
2067
|
+
key: opt.value,
|
|
2068
|
+
label: opt.label,
|
|
2069
|
+
selected: opt.value === value,
|
|
2070
|
+
onPress: () => onValueChange?.(opt.value)
|
|
2071
|
+
}
|
|
2072
|
+
)));
|
|
2073
|
+
}
|
|
2074
|
+
var styles24 = StyleSheet.create({
|
|
2075
|
+
wrapper: {},
|
|
2076
|
+
chip: {
|
|
2077
|
+
borderRadius: 999,
|
|
2078
|
+
paddingHorizontal: 14,
|
|
2079
|
+
paddingVertical: 8,
|
|
2080
|
+
borderWidth: 1.5,
|
|
2081
|
+
alignItems: "center",
|
|
2082
|
+
justifyContent: "center"
|
|
2083
|
+
},
|
|
2084
|
+
label: {
|
|
2085
|
+
fontSize: 14,
|
|
2086
|
+
fontWeight: "500",
|
|
2087
|
+
lineHeight: 20
|
|
2088
|
+
},
|
|
2089
|
+
group: {
|
|
2090
|
+
flexDirection: "row",
|
|
2091
|
+
flexWrap: "wrap",
|
|
2092
|
+
gap: 8
|
|
2093
|
+
}
|
|
2094
|
+
});
|
|
2095
|
+
function ConfirmDialog({
|
|
2096
|
+
visible,
|
|
2097
|
+
title,
|
|
2098
|
+
description,
|
|
2099
|
+
confirmLabel = "Confirm",
|
|
2100
|
+
cancelLabel = "Cancel",
|
|
2101
|
+
confirmVariant = "primary",
|
|
2102
|
+
onConfirm,
|
|
2103
|
+
onCancel
|
|
2104
|
+
}) {
|
|
2105
|
+
const { colors } = useTheme();
|
|
2106
|
+
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(
|
|
2107
|
+
View,
|
|
2108
|
+
{
|
|
2109
|
+
style: [styles25.dialog, { backgroundColor: colors.card }],
|
|
2110
|
+
onStartShouldSetResponder: () => true
|
|
2111
|
+
},
|
|
2112
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles25.title, { color: colors.cardForeground }], allowFontScaling: true }, title),
|
|
2113
|
+
description ? /* @__PURE__ */ React23.createElement(Text, { style: [styles25.description, { color: colors.mutedForeground }], allowFontScaling: true }, description) : null,
|
|
2114
|
+
/* @__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 }))
|
|
2115
|
+
)));
|
|
2116
|
+
}
|
|
2117
|
+
var styles25 = StyleSheet.create({
|
|
2118
|
+
overlay: {
|
|
2119
|
+
flex: 1,
|
|
2120
|
+
backgroundColor: "rgba(0,0,0,0.5)",
|
|
2121
|
+
justifyContent: "center",
|
|
2122
|
+
alignItems: "center",
|
|
2123
|
+
padding: 24
|
|
2124
|
+
},
|
|
2125
|
+
dialog: {
|
|
2126
|
+
width: "100%",
|
|
2127
|
+
maxWidth: 400,
|
|
2128
|
+
borderRadius: 16,
|
|
2129
|
+
padding: 24,
|
|
2130
|
+
gap: 12,
|
|
2131
|
+
shadowColor: "#000",
|
|
2132
|
+
shadowOffset: { width: 0, height: 8 },
|
|
2133
|
+
shadowOpacity: 0.15,
|
|
2134
|
+
shadowRadius: 16,
|
|
2135
|
+
elevation: 8
|
|
2136
|
+
},
|
|
2137
|
+
title: {
|
|
2138
|
+
fontSize: 18,
|
|
2139
|
+
fontWeight: "600",
|
|
2140
|
+
lineHeight: 26
|
|
2141
|
+
},
|
|
2142
|
+
description: {
|
|
2143
|
+
fontSize: 15,
|
|
2144
|
+
lineHeight: 22
|
|
2145
|
+
},
|
|
2146
|
+
actions: {
|
|
2147
|
+
gap: 10,
|
|
2148
|
+
marginTop: 8
|
|
2149
|
+
}
|
|
2150
|
+
});
|
|
2151
|
+
function LabelValue({ label, value, style }) {
|
|
2152
|
+
const { colors } = useTheme();
|
|
2153
|
+
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);
|
|
2154
|
+
}
|
|
2155
|
+
var styles26 = StyleSheet.create({
|
|
2156
|
+
container: {
|
|
2157
|
+
flexDirection: "row",
|
|
2158
|
+
justifyContent: "space-between",
|
|
2159
|
+
alignItems: "center",
|
|
2160
|
+
gap: 12
|
|
2161
|
+
},
|
|
2162
|
+
label: {
|
|
2163
|
+
fontSize: 13,
|
|
2164
|
+
lineHeight: 18
|
|
2165
|
+
},
|
|
2166
|
+
value: {
|
|
2167
|
+
fontSize: 15,
|
|
2168
|
+
fontWeight: "500",
|
|
2169
|
+
lineHeight: 22,
|
|
2170
|
+
textAlign: "right"
|
|
2171
|
+
}
|
|
2172
|
+
});
|
|
2173
|
+
var MONTH_NAMES = [
|
|
2174
|
+
"January",
|
|
2175
|
+
"February",
|
|
2176
|
+
"March",
|
|
2177
|
+
"April",
|
|
2178
|
+
"May",
|
|
2179
|
+
"June",
|
|
2180
|
+
"July",
|
|
2181
|
+
"August",
|
|
2182
|
+
"September",
|
|
2183
|
+
"October",
|
|
2184
|
+
"November",
|
|
2185
|
+
"December"
|
|
2186
|
+
];
|
|
2187
|
+
function MonthPicker({ value, onChange, style }) {
|
|
2188
|
+
const { colors } = useTheme();
|
|
2189
|
+
const handlePrev = () => {
|
|
2190
|
+
Haptics11.selectionAsync();
|
|
2191
|
+
if (value.month === 1) {
|
|
2192
|
+
onChange({ month: 12, year: value.year - 1 });
|
|
2193
|
+
} else {
|
|
2194
|
+
onChange({ month: value.month - 1, year: value.year });
|
|
2195
|
+
}
|
|
2196
|
+
};
|
|
2197
|
+
const handleNext = () => {
|
|
2198
|
+
Haptics11.selectionAsync();
|
|
2199
|
+
if (value.month === 12) {
|
|
2200
|
+
onChange({ month: 1, year: value.year + 1 });
|
|
2201
|
+
} else {
|
|
2202
|
+
onChange({ month: value.month + 1, year: value.year });
|
|
2203
|
+
}
|
|
2204
|
+
};
|
|
2205
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles27.container, style] }, /* @__PURE__ */ React23.createElement(
|
|
2206
|
+
TouchableOpacity,
|
|
2207
|
+
{
|
|
2208
|
+
style: styles27.arrow,
|
|
2209
|
+
onPress: handlePrev,
|
|
2210
|
+
activeOpacity: 0.6,
|
|
2211
|
+
touchSoundDisabled: true
|
|
2212
|
+
},
|
|
2213
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }] }, "\u2039")
|
|
2214
|
+
), /* @__PURE__ */ React23.createElement(Text, { style: [styles27.label, { color: colors.foreground }], allowFontScaling: true }, MONTH_NAMES[value.month - 1], " ", value.year), /* @__PURE__ */ React23.createElement(
|
|
2215
|
+
TouchableOpacity,
|
|
2216
|
+
{
|
|
2217
|
+
style: styles27.arrow,
|
|
2218
|
+
onPress: handleNext,
|
|
2219
|
+
activeOpacity: 0.6,
|
|
2220
|
+
touchSoundDisabled: true
|
|
2221
|
+
},
|
|
2222
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }] }, "\u203A")
|
|
2223
|
+
));
|
|
2224
|
+
}
|
|
2225
|
+
var styles27 = StyleSheet.create({
|
|
2226
|
+
container: {
|
|
2227
|
+
flexDirection: "row",
|
|
2228
|
+
alignItems: "center",
|
|
2229
|
+
justifyContent: "space-between"
|
|
2230
|
+
},
|
|
2231
|
+
arrow: {
|
|
2232
|
+
width: 44,
|
|
2233
|
+
height: 44,
|
|
2234
|
+
alignItems: "center",
|
|
2235
|
+
justifyContent: "center"
|
|
2236
|
+
},
|
|
2237
|
+
arrowText: {
|
|
2238
|
+
fontSize: 24,
|
|
2239
|
+
lineHeight: 30
|
|
2240
|
+
},
|
|
2241
|
+
label: {
|
|
2242
|
+
fontSize: 17,
|
|
2243
|
+
fontWeight: "500",
|
|
2244
|
+
lineHeight: 24,
|
|
2245
|
+
textAlign: "center",
|
|
2246
|
+
minWidth: 160
|
|
2247
|
+
}
|
|
2248
|
+
});
|
|
1731
2249
|
|
|
1732
|
-
export { Accordion,
|
|
2250
|
+
export { Accordion, AlertBanner, Avatar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Chip, ChipGroup, ConfirmDialog, CurrencyDisplay, CurrencyInput, 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 };
|