@retray-dev/ui-kit 1.5.0 → 1.7.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 +155 -4
- package/README.md +3 -3
- package/dist/index.d.mts +62 -5
- package/dist/index.d.ts +62 -5
- package/dist/index.js +324 -123
- package/dist/index.mjs +326 -128
- package/package.json +6 -6
- package/src/components/Accordion/Accordion.tsx +4 -4
- package/src/components/Alert/Alert.tsx +13 -1
- package/src/components/Avatar/Avatar.tsx +8 -8
- package/src/components/Badge/Badge.tsx +4 -4
- package/src/components/Button/Button.tsx +10 -10
- package/src/components/Card/Card.tsx +9 -9
- package/src/components/Checkbox/Checkbox.tsx +8 -8
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +46 -0
- package/src/components/CurrencyDisplay/index.ts +1 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +65 -0
- package/src/components/CurrencyInput/index.ts +2 -0
- package/src/components/CurrencyInputLarge/CurrencyInputLarge.tsx +66 -0
- package/src/components/CurrencyInputLarge/index.ts +1 -0
- package/src/components/Input/Input.tsx +8 -8
- package/src/components/Select/Select.tsx +19 -19
- package/src/components/Switch/Switch.tsx +8 -5
- 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 +28 -10
- package/src/components/Toggle/Toggle.tsx +93 -24
- package/src/index.ts +3 -0
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
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 { StyleSheet, useColorScheme, Animated, TouchableOpacity, ActivityIndicator, Text, View, TextInput, Image, Easing, PanResponder } 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
|
|
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
|
+
import { scheduleOnRN } from 'react-native-worklets';
|
|
8
9
|
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
|
|
9
10
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
10
11
|
|
|
@@ -73,13 +74,13 @@ function useTheme() {
|
|
|
73
74
|
return useContext(ThemeContext);
|
|
74
75
|
}
|
|
75
76
|
var containerSizeStyles = {
|
|
76
|
-
sm: { paddingHorizontal:
|
|
77
|
-
md: { paddingHorizontal:
|
|
78
|
-
lg: { paddingHorizontal:
|
|
77
|
+
sm: { paddingHorizontal: 20, paddingVertical: 12 },
|
|
78
|
+
md: { paddingHorizontal: 24, paddingVertical: 16 },
|
|
79
|
+
lg: { paddingHorizontal: 32, paddingVertical: 20 }
|
|
79
80
|
};
|
|
80
81
|
var labelSizeStyles = {
|
|
81
|
-
sm: { fontSize:
|
|
82
|
-
md: { fontSize:
|
|
82
|
+
sm: { fontSize: 15 },
|
|
83
|
+
md: { fontSize: 17 },
|
|
83
84
|
lg: { fontSize: 18 }
|
|
84
85
|
};
|
|
85
86
|
function Button({
|
|
@@ -146,12 +147,12 @@ function Button({
|
|
|
146
147
|
onPressOut: handlePressOut,
|
|
147
148
|
...props
|
|
148
149
|
},
|
|
149
|
-
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))
|
|
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, 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))
|
|
150
151
|
));
|
|
151
152
|
}
|
|
152
153
|
var styles = StyleSheet.create({
|
|
153
154
|
base: {
|
|
154
|
-
borderRadius:
|
|
155
|
+
borderRadius: 999,
|
|
155
156
|
alignItems: "center",
|
|
156
157
|
justifyContent: "center",
|
|
157
158
|
flexDirection: "row"
|
|
@@ -170,12 +171,12 @@ var styles = StyleSheet.create({
|
|
|
170
171
|
}
|
|
171
172
|
});
|
|
172
173
|
var variantStyles = {
|
|
173
|
-
h1: { fontSize:
|
|
174
|
-
h2: { fontSize:
|
|
175
|
-
h3: { fontSize:
|
|
176
|
-
body: { fontSize:
|
|
177
|
-
caption: { fontSize:
|
|
178
|
-
label: { fontSize:
|
|
174
|
+
h1: { fontSize: 40, fontWeight: "700", lineHeight: 52 },
|
|
175
|
+
h2: { fontSize: 28, fontWeight: "700", lineHeight: 36 },
|
|
176
|
+
h3: { fontSize: 22, fontWeight: "600", lineHeight: 30 },
|
|
177
|
+
body: { fontSize: 17, fontWeight: "400", lineHeight: 26 },
|
|
178
|
+
caption: { fontSize: 13, fontWeight: "400", lineHeight: 20 },
|
|
179
|
+
label: { fontSize: 15, fontWeight: "500", lineHeight: 22 }
|
|
179
180
|
};
|
|
180
181
|
function Text2({ variant = "body", color, style, children, ...props }) {
|
|
181
182
|
const { colors } = useTheme();
|
|
@@ -221,22 +222,22 @@ function Input({ label, error, hint, containerStyle, style, onFocus, onBlur, ...
|
|
|
221
222
|
}
|
|
222
223
|
var styles2 = StyleSheet.create({
|
|
223
224
|
container: {
|
|
224
|
-
gap:
|
|
225
|
+
gap: 6
|
|
225
226
|
},
|
|
226
227
|
label: {
|
|
227
|
-
fontSize:
|
|
228
|
+
fontSize: 15,
|
|
228
229
|
fontWeight: "500",
|
|
229
|
-
marginBottom:
|
|
230
|
+
marginBottom: 6
|
|
230
231
|
},
|
|
231
232
|
input: {
|
|
232
233
|
borderWidth: 1.5,
|
|
233
|
-
borderRadius:
|
|
234
|
-
paddingHorizontal:
|
|
235
|
-
paddingVertical:
|
|
236
|
-
fontSize:
|
|
234
|
+
borderRadius: 14,
|
|
235
|
+
paddingHorizontal: 20,
|
|
236
|
+
paddingVertical: 16,
|
|
237
|
+
fontSize: 17
|
|
237
238
|
},
|
|
238
239
|
helperText: {
|
|
239
|
-
fontSize:
|
|
240
|
+
fontSize: 13
|
|
240
241
|
}
|
|
241
242
|
});
|
|
242
243
|
function Badge({ label, variant = "default", style }) {
|
|
@@ -257,13 +258,13 @@ function Badge({ label, variant = "default", style }) {
|
|
|
257
258
|
}
|
|
258
259
|
var styles3 = StyleSheet.create({
|
|
259
260
|
container: {
|
|
260
|
-
borderRadius:
|
|
261
|
-
paddingHorizontal:
|
|
262
|
-
paddingVertical:
|
|
261
|
+
borderRadius: 8,
|
|
262
|
+
paddingHorizontal: 10,
|
|
263
|
+
paddingVertical: 4,
|
|
263
264
|
alignSelf: "flex-start"
|
|
264
265
|
},
|
|
265
266
|
label: {
|
|
266
|
-
fontSize:
|
|
267
|
+
fontSize: 13,
|
|
267
268
|
fontWeight: "500"
|
|
268
269
|
}
|
|
269
270
|
});
|
|
@@ -296,7 +297,7 @@ function CardFooter({ children, style }) {
|
|
|
296
297
|
}
|
|
297
298
|
var styles4 = StyleSheet.create({
|
|
298
299
|
card: {
|
|
299
|
-
borderRadius:
|
|
300
|
+
borderRadius: 20,
|
|
300
301
|
borderWidth: 1,
|
|
301
302
|
shadowColor: "#000",
|
|
302
303
|
shadowOffset: { width: 0, height: 1 },
|
|
@@ -305,24 +306,24 @@ var styles4 = StyleSheet.create({
|
|
|
305
306
|
elevation: 1
|
|
306
307
|
},
|
|
307
308
|
header: {
|
|
308
|
-
padding:
|
|
309
|
+
padding: 28,
|
|
309
310
|
paddingBottom: 0,
|
|
310
|
-
gap:
|
|
311
|
+
gap: 8
|
|
311
312
|
},
|
|
312
313
|
title: {
|
|
313
|
-
fontSize:
|
|
314
|
+
fontSize: 20,
|
|
314
315
|
fontWeight: "600",
|
|
315
|
-
lineHeight:
|
|
316
|
+
lineHeight: 28
|
|
316
317
|
},
|
|
317
318
|
description: {
|
|
318
|
-
fontSize:
|
|
319
|
-
lineHeight:
|
|
319
|
+
fontSize: 15,
|
|
320
|
+
lineHeight: 22
|
|
320
321
|
},
|
|
321
322
|
content: {
|
|
322
|
-
padding:
|
|
323
|
+
padding: 28
|
|
323
324
|
},
|
|
324
325
|
footer: {
|
|
325
|
-
padding:
|
|
326
|
+
padding: 28,
|
|
326
327
|
paddingTop: 0,
|
|
327
328
|
flexDirection: "row",
|
|
328
329
|
alignItems: "center"
|
|
@@ -407,16 +408,16 @@ var styles6 = StyleSheet.create({
|
|
|
407
408
|
}
|
|
408
409
|
});
|
|
409
410
|
var sizeMap2 = {
|
|
410
|
-
sm:
|
|
411
|
-
md:
|
|
412
|
-
lg:
|
|
413
|
-
xl:
|
|
411
|
+
sm: 28,
|
|
412
|
+
md: 40,
|
|
413
|
+
lg: 56,
|
|
414
|
+
xl: 72
|
|
414
415
|
};
|
|
415
416
|
var fontSizeMap = {
|
|
416
|
-
sm:
|
|
417
|
-
md:
|
|
418
|
-
lg:
|
|
419
|
-
xl:
|
|
417
|
+
sm: 12,
|
|
418
|
+
md: 16,
|
|
419
|
+
lg: 22,
|
|
420
|
+
xl: 28
|
|
420
421
|
};
|
|
421
422
|
function Avatar({ src, fallback, size = "md", style }) {
|
|
422
423
|
const { colors } = useTheme();
|
|
@@ -459,7 +460,7 @@ function Alert({ title, description, variant = "default", icon, style }) {
|
|
|
459
460
|
const borderColor = variant === "destructive" ? colors.destructive : colors.border;
|
|
460
461
|
const titleColor = variant === "destructive" ? colors.destructive : colors.foreground;
|
|
461
462
|
const descColor = variant === "destructive" ? colors.destructive : colors.mutedForeground;
|
|
462
|
-
return /* @__PURE__ */ React23.createElement(View, { style: [styles8.container, { backgroundColor: colors.card, borderColor }, style] }, icon ? /* @__PURE__ */ React23.createElement(View, { style: styles8.icon }, icon) :
|
|
463
|
+
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 }] }, variant === "destructive" ? "\u26A0" : "\u2139")), /* @__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));
|
|
463
464
|
}
|
|
464
465
|
var styles8 = StyleSheet.create({
|
|
465
466
|
container: {
|
|
@@ -484,6 +485,10 @@ var styles8 = StyleSheet.create({
|
|
|
484
485
|
description: {
|
|
485
486
|
fontSize: 14,
|
|
486
487
|
lineHeight: 20
|
|
488
|
+
},
|
|
489
|
+
defaultIcon: {
|
|
490
|
+
fontSize: 18,
|
|
491
|
+
fontWeight: "700"
|
|
487
492
|
}
|
|
488
493
|
});
|
|
489
494
|
function Progress({ value = 0, max = 100, style }) {
|
|
@@ -591,7 +596,7 @@ function Textarea({
|
|
|
591
596
|
borderColor: error ? colors.destructive : focused ? colors.ring : colors.border,
|
|
592
597
|
color: colors.foreground,
|
|
593
598
|
backgroundColor: colors.background,
|
|
594
|
-
minHeight: rows *
|
|
599
|
+
minHeight: rows * 30
|
|
595
600
|
},
|
|
596
601
|
style
|
|
597
602
|
],
|
|
@@ -611,22 +616,22 @@ function Textarea({
|
|
|
611
616
|
}
|
|
612
617
|
var styles11 = StyleSheet.create({
|
|
613
618
|
container: {
|
|
614
|
-
gap:
|
|
619
|
+
gap: 6
|
|
615
620
|
},
|
|
616
621
|
label: {
|
|
617
|
-
fontSize:
|
|
622
|
+
fontSize: 15,
|
|
618
623
|
fontWeight: "500",
|
|
619
|
-
marginBottom:
|
|
624
|
+
marginBottom: 6
|
|
620
625
|
},
|
|
621
626
|
input: {
|
|
622
627
|
borderWidth: 1.5,
|
|
623
|
-
borderRadius:
|
|
624
|
-
paddingHorizontal:
|
|
625
|
-
paddingVertical:
|
|
626
|
-
fontSize:
|
|
628
|
+
borderRadius: 14,
|
|
629
|
+
paddingHorizontal: 20,
|
|
630
|
+
paddingVertical: 16,
|
|
631
|
+
fontSize: 17
|
|
627
632
|
},
|
|
628
633
|
helperText: {
|
|
629
|
-
fontSize:
|
|
634
|
+
fontSize: 13
|
|
630
635
|
}
|
|
631
636
|
});
|
|
632
637
|
function Checkbox({
|
|
@@ -686,31 +691,31 @@ var styles12 = StyleSheet.create({
|
|
|
686
691
|
row: {
|
|
687
692
|
flexDirection: "row",
|
|
688
693
|
alignItems: "center",
|
|
689
|
-
gap:
|
|
694
|
+
gap: 12
|
|
690
695
|
},
|
|
691
696
|
box: {
|
|
692
|
-
width:
|
|
693
|
-
height:
|
|
694
|
-
borderRadius:
|
|
697
|
+
width: 28,
|
|
698
|
+
height: 28,
|
|
699
|
+
borderRadius: 8,
|
|
695
700
|
borderWidth: 1.5,
|
|
696
701
|
alignItems: "center",
|
|
697
702
|
justifyContent: "center"
|
|
698
703
|
},
|
|
699
704
|
checkmark: {
|
|
700
|
-
width:
|
|
701
|
-
height:
|
|
705
|
+
width: 15,
|
|
706
|
+
height: 9,
|
|
702
707
|
borderLeftWidth: 2,
|
|
703
708
|
borderBottomWidth: 2,
|
|
704
709
|
transform: [{ rotate: "-45deg" }, { translateY: -1 }]
|
|
705
710
|
},
|
|
706
711
|
label: {
|
|
707
|
-
fontSize:
|
|
708
|
-
lineHeight:
|
|
712
|
+
fontSize: 15,
|
|
713
|
+
lineHeight: 22
|
|
709
714
|
}
|
|
710
715
|
});
|
|
711
|
-
var TRACK_WIDTH =
|
|
712
|
-
var TRACK_HEIGHT =
|
|
713
|
-
var THUMB_SIZE =
|
|
716
|
+
var TRACK_WIDTH = 60;
|
|
717
|
+
var TRACK_HEIGHT = 36;
|
|
718
|
+
var THUMB_SIZE = 28;
|
|
714
719
|
var THUMB_OFFSET = 4;
|
|
715
720
|
var THUMB_TRAVEL = TRACK_WIDTH - THUMB_SIZE - THUMB_OFFSET * 2;
|
|
716
721
|
function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
@@ -763,11 +768,14 @@ var styles13 = StyleSheet.create({
|
|
|
763
768
|
track: {
|
|
764
769
|
width: TRACK_WIDTH,
|
|
765
770
|
height: TRACK_HEIGHT,
|
|
766
|
-
borderRadius: TRACK_HEIGHT / 2
|
|
767
|
-
justifyContent
|
|
768
|
-
|
|
771
|
+
borderRadius: TRACK_HEIGHT / 2
|
|
772
|
+
// No justifyContent/alignItems — thumb uses absolute positioning
|
|
773
|
+
// so the track's flex layout doesn't interfere with translateX animation
|
|
769
774
|
},
|
|
770
775
|
thumb: {
|
|
776
|
+
position: "absolute",
|
|
777
|
+
top: THUMB_OFFSET,
|
|
778
|
+
left: THUMB_OFFSET,
|
|
771
779
|
width: THUMB_SIZE,
|
|
772
780
|
height: THUMB_SIZE,
|
|
773
781
|
borderRadius: THUMB_SIZE / 2,
|
|
@@ -790,12 +798,22 @@ function Toggle({
|
|
|
790
798
|
size = "md",
|
|
791
799
|
label,
|
|
792
800
|
icon,
|
|
801
|
+
activeIcon,
|
|
793
802
|
disabled,
|
|
794
803
|
style,
|
|
795
804
|
...props
|
|
796
805
|
}) {
|
|
797
806
|
const { colors } = useTheme();
|
|
798
807
|
const scale = useRef(new Animated.Value(1)).current;
|
|
808
|
+
const pressAnim = useRef(new Animated.Value(pressed ? 1 : 0)).current;
|
|
809
|
+
useEffect(() => {
|
|
810
|
+
Animated.timing(pressAnim, {
|
|
811
|
+
toValue: pressed ? 1 : 0,
|
|
812
|
+
duration: 150,
|
|
813
|
+
easing: Easing.out(Easing.ease),
|
|
814
|
+
useNativeDriver: false
|
|
815
|
+
}).start();
|
|
816
|
+
}, [pressed, pressAnim]);
|
|
799
817
|
const handlePressIn = () => {
|
|
800
818
|
if (disabled) return;
|
|
801
819
|
Animated.spring(scale, { toValue: 0.95, useNativeDriver: true, speed: 40, bounciness: 0 }).start();
|
|
@@ -803,34 +821,71 @@ function Toggle({
|
|
|
803
821
|
const handlePressOut = () => {
|
|
804
822
|
Animated.spring(scale, { toValue: 1, useNativeDriver: true, speed: 40, bounciness: 4 }).start();
|
|
805
823
|
};
|
|
806
|
-
const
|
|
807
|
-
|
|
824
|
+
const borderColor = pressAnim.interpolate({
|
|
825
|
+
inputRange: [0, 1],
|
|
826
|
+
outputRange: [variant === "outline" ? colors.border : "transparent", colors.primary]
|
|
827
|
+
});
|
|
828
|
+
const backgroundColor = pressAnim.interpolate({
|
|
829
|
+
inputRange: [0, 1],
|
|
830
|
+
outputRange: ["transparent", colors.accent]
|
|
831
|
+
});
|
|
832
|
+
const textColor = pressAnim.interpolate({
|
|
833
|
+
inputRange: [0, 1],
|
|
834
|
+
outputRange: [colors.foreground, colors.primary]
|
|
835
|
+
});
|
|
836
|
+
const LeftIcon = () => {
|
|
837
|
+
const renderProp = (prop) => {
|
|
838
|
+
if (!prop) return null;
|
|
839
|
+
if (typeof prop === "function") return prop(pressed);
|
|
840
|
+
return prop;
|
|
841
|
+
};
|
|
842
|
+
if (!pressed) return renderProp(icon);
|
|
843
|
+
const active = renderProp(activeIcon);
|
|
844
|
+
if (active) return /* @__PURE__ */ React23.createElement(React23.Fragment, null, active);
|
|
845
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [styles14.checkContainer, { borderColor: colors.primary }] }, /* @__PURE__ */ React23.createElement(Text, { style: [styles14.checkMark, { color: colors.primary }] }, "\u2713"));
|
|
846
|
+
};
|
|
808
847
|
return /* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(
|
|
809
|
-
|
|
848
|
+
Animated.View,
|
|
810
849
|
{
|
|
811
|
-
style: [
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
disabled,
|
|
819
|
-
activeOpacity: 1,
|
|
820
|
-
touchSoundDisabled: true,
|
|
821
|
-
...props
|
|
850
|
+
style: [
|
|
851
|
+
styles14.base,
|
|
852
|
+
sizeStyles[size],
|
|
853
|
+
{ borderColor, backgroundColor, borderWidth: 2 },
|
|
854
|
+
disabled && styles14.disabled,
|
|
855
|
+
style
|
|
856
|
+
]
|
|
822
857
|
},
|
|
823
|
-
|
|
824
|
-
|
|
858
|
+
/* @__PURE__ */ React23.createElement(
|
|
859
|
+
TouchableOpacity,
|
|
860
|
+
{
|
|
861
|
+
style: styles14.touchable,
|
|
862
|
+
onPress: () => {
|
|
863
|
+
Haptics11.selectionAsync();
|
|
864
|
+
onPressedChange?.(!pressed);
|
|
865
|
+
},
|
|
866
|
+
onPressIn: handlePressIn,
|
|
867
|
+
onPressOut: handlePressOut,
|
|
868
|
+
disabled,
|
|
869
|
+
activeOpacity: 1,
|
|
870
|
+
touchSoundDisabled: true,
|
|
871
|
+
...props
|
|
872
|
+
},
|
|
873
|
+
/* @__PURE__ */ React23.createElement(LeftIcon, null),
|
|
874
|
+
label ? /* @__PURE__ */ React23.createElement(Animated.Text, { style: [styles14.label, { color: textColor }] }, label) : null
|
|
875
|
+
)
|
|
825
876
|
));
|
|
826
877
|
}
|
|
827
878
|
var styles14 = StyleSheet.create({
|
|
828
879
|
base: {
|
|
829
880
|
borderRadius: 8,
|
|
881
|
+
overflow: "hidden"
|
|
882
|
+
},
|
|
883
|
+
touchable: {
|
|
830
884
|
flexDirection: "row",
|
|
831
885
|
alignItems: "center",
|
|
832
886
|
justifyContent: "center",
|
|
833
|
-
gap: 8
|
|
887
|
+
gap: 8,
|
|
888
|
+
flex: 1
|
|
834
889
|
},
|
|
835
890
|
disabled: {
|
|
836
891
|
opacity: 0.45
|
|
@@ -838,6 +893,18 @@ var styles14 = StyleSheet.create({
|
|
|
838
893
|
label: {
|
|
839
894
|
fontSize: 14,
|
|
840
895
|
fontWeight: "500"
|
|
896
|
+
},
|
|
897
|
+
checkContainer: {
|
|
898
|
+
width: 24,
|
|
899
|
+
height: 24,
|
|
900
|
+
borderRadius: 12,
|
|
901
|
+
borderWidth: 2,
|
|
902
|
+
alignItems: "center",
|
|
903
|
+
justifyContent: "center"
|
|
904
|
+
},
|
|
905
|
+
checkMark: {
|
|
906
|
+
fontSize: 14,
|
|
907
|
+
fontWeight: "700"
|
|
841
908
|
}
|
|
842
909
|
});
|
|
843
910
|
function RadioItem({
|
|
@@ -968,7 +1035,7 @@ function TabTrigger({
|
|
|
968
1035
|
activeOpacity: 1,
|
|
969
1036
|
touchSoundDisabled: true
|
|
970
1037
|
},
|
|
971
|
-
/* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(
|
|
1038
|
+
/* @__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(
|
|
972
1039
|
Text,
|
|
973
1040
|
{
|
|
974
1041
|
style: [
|
|
@@ -978,7 +1045,7 @@ function TabTrigger({
|
|
|
978
1045
|
]
|
|
979
1046
|
},
|
|
980
1047
|
tab.label
|
|
981
|
-
))
|
|
1048
|
+
)))
|
|
982
1049
|
);
|
|
983
1050
|
}
|
|
984
1051
|
function Tabs({ tabs, value, onValueChange, children, style }) {
|
|
@@ -1034,7 +1101,7 @@ function Tabs({ tabs, value, onValueChange, children, style }) {
|
|
|
1034
1101
|
bottom: 4,
|
|
1035
1102
|
left: pillX,
|
|
1036
1103
|
width: pillWidth,
|
|
1037
|
-
borderRadius:
|
|
1104
|
+
borderRadius: 8,
|
|
1038
1105
|
shadowColor: "#000",
|
|
1039
1106
|
shadowOffset: { width: 0, height: 1 },
|
|
1040
1107
|
shadowOpacity: 0.1,
|
|
@@ -1068,22 +1135,33 @@ function TabsContent({ value, activeValue, children, style }) {
|
|
|
1068
1135
|
var styles16 = StyleSheet.create({
|
|
1069
1136
|
list: {
|
|
1070
1137
|
flexDirection: "row",
|
|
1071
|
-
borderRadius:
|
|
1138
|
+
borderRadius: 12,
|
|
1072
1139
|
padding: 4,
|
|
1073
1140
|
gap: 4
|
|
1074
1141
|
},
|
|
1075
1142
|
pill: {},
|
|
1076
1143
|
trigger: {
|
|
1077
1144
|
flex: 1,
|
|
1078
|
-
paddingVertical:
|
|
1079
|
-
paddingHorizontal:
|
|
1080
|
-
borderRadius:
|
|
1145
|
+
paddingVertical: 12,
|
|
1146
|
+
paddingHorizontal: 16,
|
|
1147
|
+
borderRadius: 8,
|
|
1081
1148
|
alignItems: "center",
|
|
1082
1149
|
justifyContent: "center",
|
|
1083
1150
|
zIndex: 1
|
|
1084
1151
|
},
|
|
1152
|
+
triggerInner: {
|
|
1153
|
+
flexDirection: "row",
|
|
1154
|
+
alignItems: "center",
|
|
1155
|
+
justifyContent: "center",
|
|
1156
|
+
gap: 8
|
|
1157
|
+
},
|
|
1158
|
+
triggerIcon: {
|
|
1159
|
+
marginRight: 6,
|
|
1160
|
+
alignItems: "center",
|
|
1161
|
+
justifyContent: "center"
|
|
1162
|
+
},
|
|
1085
1163
|
triggerLabel: {
|
|
1086
|
-
fontSize:
|
|
1164
|
+
fontSize: 15,
|
|
1087
1165
|
fontWeight: "400"
|
|
1088
1166
|
},
|
|
1089
1167
|
activeTriggerLabel: {
|
|
@@ -1101,7 +1179,7 @@ function AccordionItemComponent({
|
|
|
1101
1179
|
const contentHeight = useRef(0);
|
|
1102
1180
|
const scale = useRef(new Animated.Value(1)).current;
|
|
1103
1181
|
const toggle = (open) => {
|
|
1104
|
-
const easing = open ? Easing.out(Easing.ease) : Easing.in(Easing.ease);
|
|
1182
|
+
const easing = open ? Easing$1.out(Easing$1.ease) : Easing$1.in(Easing$1.ease);
|
|
1105
1183
|
animatedHeight.value = withTiming(open ? contentHeight.current : 0, { duration: 220, easing });
|
|
1106
1184
|
animatedRotation.value = withTiming(open ? 1 : 0, { duration: 220, easing });
|
|
1107
1185
|
};
|
|
@@ -1182,19 +1260,19 @@ var styles17 = StyleSheet.create({
|
|
|
1182
1260
|
flexDirection: "row",
|
|
1183
1261
|
justifyContent: "space-between",
|
|
1184
1262
|
alignItems: "center",
|
|
1185
|
-
paddingVertical:
|
|
1263
|
+
paddingVertical: 20
|
|
1186
1264
|
},
|
|
1187
1265
|
triggerText: {
|
|
1188
|
-
fontSize:
|
|
1266
|
+
fontSize: 17,
|
|
1189
1267
|
fontWeight: "500",
|
|
1190
1268
|
flex: 1
|
|
1191
1269
|
},
|
|
1192
1270
|
chevron: {
|
|
1193
|
-
fontSize:
|
|
1271
|
+
fontSize: 18,
|
|
1194
1272
|
marginLeft: 8
|
|
1195
1273
|
},
|
|
1196
1274
|
content: {
|
|
1197
|
-
paddingBottom:
|
|
1275
|
+
paddingBottom: 20,
|
|
1198
1276
|
position: "absolute",
|
|
1199
1277
|
width: "100%"
|
|
1200
1278
|
}
|
|
@@ -1503,10 +1581,10 @@ function Select({
|
|
|
1503
1581
|
}
|
|
1504
1582
|
var styles20 = StyleSheet.create({
|
|
1505
1583
|
container: {
|
|
1506
|
-
gap:
|
|
1584
|
+
gap: 6
|
|
1507
1585
|
},
|
|
1508
1586
|
label: {
|
|
1509
|
-
fontSize:
|
|
1587
|
+
fontSize: 15,
|
|
1510
1588
|
fontWeight: "500",
|
|
1511
1589
|
marginBottom: 2
|
|
1512
1590
|
},
|
|
@@ -1515,24 +1593,24 @@ var styles20 = StyleSheet.create({
|
|
|
1515
1593
|
alignItems: "center",
|
|
1516
1594
|
justifyContent: "space-between",
|
|
1517
1595
|
borderWidth: 1.5,
|
|
1518
|
-
borderRadius:
|
|
1519
|
-
paddingHorizontal:
|
|
1520
|
-
paddingVertical:
|
|
1596
|
+
borderRadius: 14,
|
|
1597
|
+
paddingHorizontal: 20,
|
|
1598
|
+
paddingVertical: 16
|
|
1521
1599
|
},
|
|
1522
1600
|
triggerText: {
|
|
1523
|
-
fontSize:
|
|
1601
|
+
fontSize: 17,
|
|
1524
1602
|
flex: 1
|
|
1525
1603
|
},
|
|
1526
1604
|
chevron: {
|
|
1527
|
-
fontSize:
|
|
1605
|
+
fontSize: 16,
|
|
1528
1606
|
marginLeft: 8
|
|
1529
1607
|
},
|
|
1530
1608
|
helperText: {
|
|
1531
|
-
fontSize:
|
|
1609
|
+
fontSize: 13
|
|
1532
1610
|
},
|
|
1533
1611
|
sheetBackground: {
|
|
1534
|
-
borderTopLeftRadius:
|
|
1535
|
-
borderTopRightRadius:
|
|
1612
|
+
borderTopLeftRadius: 24,
|
|
1613
|
+
borderTopRightRadius: 24
|
|
1536
1614
|
},
|
|
1537
1615
|
sheetHandle: {
|
|
1538
1616
|
width: 36,
|
|
@@ -1540,32 +1618,32 @@ var styles20 = StyleSheet.create({
|
|
|
1540
1618
|
borderRadius: 2
|
|
1541
1619
|
},
|
|
1542
1620
|
sheetContent: {
|
|
1543
|
-
paddingHorizontal:
|
|
1544
|
-
paddingBottom:
|
|
1621
|
+
paddingHorizontal: 20,
|
|
1622
|
+
paddingBottom: 36
|
|
1545
1623
|
},
|
|
1546
1624
|
sheetTitle: {
|
|
1547
|
-
fontSize:
|
|
1625
|
+
fontSize: 17,
|
|
1548
1626
|
fontWeight: "600",
|
|
1549
|
-
paddingVertical:
|
|
1627
|
+
paddingVertical: 16,
|
|
1550
1628
|
paddingHorizontal: 4
|
|
1551
1629
|
},
|
|
1552
1630
|
option: {
|
|
1553
1631
|
flexDirection: "row",
|
|
1554
1632
|
alignItems: "center",
|
|
1555
1633
|
justifyContent: "space-between",
|
|
1556
|
-
paddingHorizontal:
|
|
1557
|
-
paddingVertical:
|
|
1558
|
-
borderRadius:
|
|
1634
|
+
paddingHorizontal: 16,
|
|
1635
|
+
paddingVertical: 16,
|
|
1636
|
+
borderRadius: 12
|
|
1559
1637
|
},
|
|
1560
1638
|
optionText: {
|
|
1561
|
-
fontSize:
|
|
1639
|
+
fontSize: 17,
|
|
1562
1640
|
flex: 1
|
|
1563
1641
|
},
|
|
1564
1642
|
disabledOption: {
|
|
1565
1643
|
opacity: 0.45
|
|
1566
1644
|
},
|
|
1567
1645
|
checkmark: {
|
|
1568
|
-
fontSize:
|
|
1646
|
+
fontSize: 16,
|
|
1569
1647
|
fontWeight: "600",
|
|
1570
1648
|
marginLeft: 8
|
|
1571
1649
|
}
|
|
@@ -1587,12 +1665,12 @@ function ToastNotification({ item, onDismiss }) {
|
|
|
1587
1665
|
const translateX = useSharedValue(0);
|
|
1588
1666
|
const opacity = useSharedValue(0);
|
|
1589
1667
|
useEffect(() => {
|
|
1590
|
-
translateY.value = withTiming(0, { duration: 120, easing: Easing.out(Easing.exp) });
|
|
1668
|
+
translateY.value = withTiming(0, { duration: 120, easing: Easing$1.out(Easing$1.exp) });
|
|
1591
1669
|
opacity.value = withTiming(1, { duration: 100 });
|
|
1592
1670
|
const timer = setTimeout(() => {
|
|
1593
1671
|
translateY.value = withTiming(-80, { duration: 200 });
|
|
1594
1672
|
opacity.value = withTiming(0, { duration: 200 }, (done) => {
|
|
1595
|
-
if (done)
|
|
1673
|
+
if (done) scheduleOnRN(onDismiss);
|
|
1596
1674
|
});
|
|
1597
1675
|
}, item.duration ?? 3e3);
|
|
1598
1676
|
return () => clearTimeout(timer);
|
|
@@ -1604,7 +1682,7 @@ function ToastNotification({ item, onDismiss }) {
|
|
|
1604
1682
|
if (shouldDismiss) {
|
|
1605
1683
|
const direction = translateX.value > 0 ? 1 : -1;
|
|
1606
1684
|
translateX.value = withTiming(direction * 500, { duration: 200 }, (done) => {
|
|
1607
|
-
if (done)
|
|
1685
|
+
if (done) scheduleOnRN(onDismiss);
|
|
1608
1686
|
});
|
|
1609
1687
|
opacity.value = withTiming(0, { duration: 150 });
|
|
1610
1688
|
} else {
|
|
@@ -1625,7 +1703,8 @@ function ToastNotification({ item, onDismiss }) {
|
|
|
1625
1703
|
destructive: colors.destructiveForeground,
|
|
1626
1704
|
success: colors.successForeground
|
|
1627
1705
|
}[item.variant ?? "default"];
|
|
1628
|
-
|
|
1706
|
+
const leftIcon = item.icon ?? /* @__PURE__ */ React23.createElement(Text, { style: [styles21.defaultIcon, { color: textColor }] }, item.variant === "success" ? "\u2713" : item.variant === "destructive" ? "\u2716" : "\u2139");
|
|
1707
|
+
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"))));
|
|
1629
1708
|
}
|
|
1630
1709
|
function ToastProvider({ children }) {
|
|
1631
1710
|
const [toasts, setToasts] = useState([]);
|
|
@@ -1657,9 +1736,9 @@ var styles21 = StyleSheet.create({
|
|
|
1657
1736
|
toast: {
|
|
1658
1737
|
flexDirection: "row",
|
|
1659
1738
|
alignItems: "center",
|
|
1660
|
-
borderRadius:
|
|
1661
|
-
paddingHorizontal:
|
|
1662
|
-
paddingVertical:
|
|
1739
|
+
borderRadius: 16,
|
|
1740
|
+
paddingHorizontal: 20,
|
|
1741
|
+
paddingVertical: 14,
|
|
1663
1742
|
shadowColor: "#000",
|
|
1664
1743
|
shadowOffset: { width: 0, height: 4 },
|
|
1665
1744
|
shadowOpacity: 0.15,
|
|
@@ -1670,20 +1749,139 @@ var styles21 = StyleSheet.create({
|
|
|
1670
1749
|
flex: 1,
|
|
1671
1750
|
gap: 4
|
|
1672
1751
|
},
|
|
1752
|
+
leftIconContainer: {
|
|
1753
|
+
width: 36,
|
|
1754
|
+
alignItems: "center",
|
|
1755
|
+
justifyContent: "center",
|
|
1756
|
+
marginRight: 8
|
|
1757
|
+
},
|
|
1758
|
+
defaultIcon: {
|
|
1759
|
+
fontSize: 22,
|
|
1760
|
+
fontWeight: "700"
|
|
1761
|
+
},
|
|
1673
1762
|
toastTitle: {
|
|
1674
|
-
fontSize:
|
|
1763
|
+
fontSize: 15,
|
|
1675
1764
|
fontWeight: "600"
|
|
1676
1765
|
},
|
|
1677
1766
|
toastDescription: {
|
|
1678
|
-
fontSize:
|
|
1767
|
+
fontSize: 14
|
|
1679
1768
|
},
|
|
1680
1769
|
dismissButton: {
|
|
1681
1770
|
padding: 12,
|
|
1682
1771
|
marginLeft: 4
|
|
1683
1772
|
},
|
|
1684
1773
|
dismissIcon: {
|
|
1685
|
-
fontSize:
|
|
1774
|
+
fontSize: 14
|
|
1775
|
+
}
|
|
1776
|
+
});
|
|
1777
|
+
function formatCurrency(raw, separator) {
|
|
1778
|
+
const digits = raw.replace(/\D/g, "");
|
|
1779
|
+
if (!digits) return "";
|
|
1780
|
+
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
1781
|
+
}
|
|
1782
|
+
function CurrencyInput({
|
|
1783
|
+
value,
|
|
1784
|
+
onChangeText,
|
|
1785
|
+
onChangeValue,
|
|
1786
|
+
prefix = "$",
|
|
1787
|
+
thousandsSeparator = ".",
|
|
1788
|
+
label,
|
|
1789
|
+
error,
|
|
1790
|
+
hint,
|
|
1791
|
+
placeholder,
|
|
1792
|
+
editable,
|
|
1793
|
+
containerStyle
|
|
1794
|
+
}) {
|
|
1795
|
+
const handleChange = (text) => {
|
|
1796
|
+
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
1797
|
+
const formatted = formatCurrency(withoutPrefix, thousandsSeparator);
|
|
1798
|
+
const display = formatted ? `${prefix}${formatted}` : "";
|
|
1799
|
+
onChangeText?.(display);
|
|
1800
|
+
const separatorRegex = new RegExp(`\\${thousandsSeparator}`, "g");
|
|
1801
|
+
const raw = parseFloat(formatted.replace(separatorRegex, "") || "0");
|
|
1802
|
+
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
1803
|
+
};
|
|
1804
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1805
|
+
Input,
|
|
1806
|
+
{
|
|
1807
|
+
value,
|
|
1808
|
+
onChangeText: handleChange,
|
|
1809
|
+
keyboardType: "numeric",
|
|
1810
|
+
label,
|
|
1811
|
+
error,
|
|
1812
|
+
hint,
|
|
1813
|
+
placeholder: placeholder ?? `${prefix}0`,
|
|
1814
|
+
editable,
|
|
1815
|
+
containerStyle
|
|
1816
|
+
}
|
|
1817
|
+
);
|
|
1818
|
+
}
|
|
1819
|
+
function formatValue(value, prefix, showDecimals) {
|
|
1820
|
+
const num = typeof value === "string" ? parseFloat(value.replace(/[^0-9.-]/g, "")) : value;
|
|
1821
|
+
if (isNaN(num)) return `${prefix}0`;
|
|
1822
|
+
const abs = Math.abs(num);
|
|
1823
|
+
const sign = num < 0 ? "-" : "";
|
|
1824
|
+
const intPart = Math.floor(abs).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
1825
|
+
if (showDecimals) {
|
|
1826
|
+
const decStr = (abs % 1).toFixed(2).slice(2);
|
|
1827
|
+
return `${sign}${prefix}${intPart},${decStr}`;
|
|
1828
|
+
}
|
|
1829
|
+
return `${sign}${prefix}${intPart}`;
|
|
1830
|
+
}
|
|
1831
|
+
function CurrencyDisplay({ value, prefix = "$", showDecimals = false, style }) {
|
|
1832
|
+
const { colors } = useTheme();
|
|
1833
|
+
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));
|
|
1835
|
+
}
|
|
1836
|
+
var styles22 = StyleSheet.create({
|
|
1837
|
+
container: {},
|
|
1838
|
+
amount: {
|
|
1839
|
+
fontSize: 56,
|
|
1840
|
+
fontWeight: "700"
|
|
1686
1841
|
}
|
|
1687
1842
|
});
|
|
1843
|
+
function formatCurrency2(raw, separator) {
|
|
1844
|
+
const digits = raw.replace(/\D/g, "");
|
|
1845
|
+
if (!digits) return "";
|
|
1846
|
+
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
1847
|
+
}
|
|
1848
|
+
function CurrencyInputLarge({
|
|
1849
|
+
value,
|
|
1850
|
+
onChangeText,
|
|
1851
|
+
onChangeValue,
|
|
1852
|
+
prefix = "$",
|
|
1853
|
+
thousandsSeparator = ".",
|
|
1854
|
+
label,
|
|
1855
|
+
error,
|
|
1856
|
+
hint,
|
|
1857
|
+
placeholder,
|
|
1858
|
+
editable,
|
|
1859
|
+
containerStyle
|
|
1860
|
+
}) {
|
|
1861
|
+
const handleChange = (text) => {
|
|
1862
|
+
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
1863
|
+
const formatted = formatCurrency2(withoutPrefix, thousandsSeparator);
|
|
1864
|
+
const display = formatted ? `${prefix}${formatted}` : "";
|
|
1865
|
+
onChangeText?.(display);
|
|
1866
|
+
const separatorRegex = new RegExp(`\\${thousandsSeparator}`, "g");
|
|
1867
|
+
const raw = parseFloat(formatted.replace(separatorRegex, "") || "0");
|
|
1868
|
+
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
1869
|
+
};
|
|
1870
|
+
return /* @__PURE__ */ React23.createElement(
|
|
1871
|
+
Input,
|
|
1872
|
+
{
|
|
1873
|
+
value,
|
|
1874
|
+
onChangeText: handleChange,
|
|
1875
|
+
keyboardType: "numeric",
|
|
1876
|
+
label,
|
|
1877
|
+
error,
|
|
1878
|
+
hint,
|
|
1879
|
+
placeholder: placeholder ?? `${prefix}0`,
|
|
1880
|
+
editable,
|
|
1881
|
+
containerStyle,
|
|
1882
|
+
style: { fontSize: 36 }
|
|
1883
|
+
}
|
|
1884
|
+
);
|
|
1885
|
+
}
|
|
1688
1886
|
|
|
1689
|
-
export { Accordion, Alert, Avatar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, EmptyState, Input, Progress, RadioGroup, Select, Separator, Sheet, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, Text2 as Text, Textarea, ThemeProvider, ToastProvider, Toggle, defaultDark, defaultLight, useTheme, useToast };
|
|
1887
|
+
export { Accordion, Alert, Avatar, Badge, Button, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CurrencyDisplay, CurrencyInput, CurrencyInputLarge, EmptyState, Input, Progress, RadioGroup, Select, Separator, Sheet, Skeleton, Slider, Spinner, Switch, Tabs, TabsContent, Text2 as Text, Textarea, ThemeProvider, ToastProvider, Toggle, defaultDark, defaultLight, useTheme, useToast };
|