@retray-dev/ui-kit 1.8.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 +80 -23
- package/dist/index.d.mts +46 -42
- package/dist/index.d.ts +46 -42
- package/dist/index.js +442 -333
- package/dist/index.mjs +441 -333
- package/package.json +6 -2
- package/src/components/Alert/Alert.tsx +3 -3
- package/src/components/AlertBanner/AlertBanner.tsx +83 -0
- package/src/components/{Alert → AlertBanner}/index.ts +2 -2
- package/src/components/Avatar/Avatar.tsx +1 -0
- package/src/components/Badge/Badge.tsx +44 -8
- package/src/components/Button/Button.tsx +1 -1
- package/src/components/Card/Card.tsx +86 -9
- package/src/components/Chip/Chip.tsx +36 -5
- package/src/components/CurrencyInput/CurrencyInput.tsx +9 -1
- package/src/components/EmptyState/EmptyState.tsx +2 -1
- package/src/components/Input/Input.tsx +102 -21
- package/src/components/MonthPicker/MonthPicker.tsx +2 -2
- package/src/components/Select/Select.tsx +189 -125
- package/src/components/Slider/Slider.tsx +64 -100
- package/src/components/Switch/Switch.tsx +22 -20
- package/src/components/Textarea/Textarea.tsx +12 -2
- package/src/components/Toggle/Toggle.tsx +13 -6
- package/src/index.ts +3 -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/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 { Platform, 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,13 +67,17 @@ 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
|
}
|
|
76
82
|
var nativeDriver = Platform.OS !== "web";
|
|
77
83
|
var containerSizeStyles = {
|
|
@@ -113,7 +119,7 @@ function Button({
|
|
|
113
119
|
Animated.spring(scale, { toValue: 1, useNativeDriver: nativeDriver, speed: 40, bounciness: 4 }).start();
|
|
114
120
|
};
|
|
115
121
|
const handlePress = (e) => {
|
|
116
|
-
|
|
122
|
+
Haptics12.impactAsync(Haptics12.ImpactFeedbackStyle.Light);
|
|
117
123
|
onPress?.(e);
|
|
118
124
|
};
|
|
119
125
|
const containerVariantStyle = {
|
|
@@ -164,7 +170,7 @@ var styles = StyleSheet.create({
|
|
|
164
170
|
width: "100%"
|
|
165
171
|
},
|
|
166
172
|
disabled: {
|
|
167
|
-
opacity: 0.
|
|
173
|
+
opacity: 0.5
|
|
168
174
|
},
|
|
169
175
|
label: {
|
|
170
176
|
fontWeight: "600"
|
|
@@ -194,33 +200,52 @@ function Text2({ variant = "body", color, style, children, ...props }) {
|
|
|
194
200
|
children
|
|
195
201
|
);
|
|
196
202
|
}
|
|
197
|
-
|
|
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 }) {
|
|
198
205
|
const { colors } = useTheme();
|
|
199
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;
|
|
200
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(
|
|
201
|
-
|
|
212
|
+
View,
|
|
202
213
|
{
|
|
203
214
|
style: [
|
|
204
|
-
styles2.
|
|
215
|
+
styles2.inputWrapper,
|
|
205
216
|
{
|
|
206
|
-
borderColor: error ? colors.destructive : focused ? colors.ring : colors.border,
|
|
207
|
-
color: colors.foreground,
|
|
217
|
+
borderColor: error ? colors.destructive : focused ? colors.ring ?? colors.primary : colors.border,
|
|
208
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);
|
|
209
237
|
},
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
allowFontScaling: true,
|
|
222
|
-
...props
|
|
223
|
-
}
|
|
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
|
|
224
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);
|
|
225
250
|
}
|
|
226
251
|
var styles2 = StyleSheet.create({
|
|
@@ -232,18 +257,56 @@ var styles2 = StyleSheet.create({
|
|
|
232
257
|
fontWeight: "500",
|
|
233
258
|
marginBottom: 6
|
|
234
259
|
},
|
|
235
|
-
|
|
260
|
+
inputWrapper: {
|
|
261
|
+
flexDirection: "row",
|
|
262
|
+
alignItems: "center",
|
|
236
263
|
borderWidth: 1.5,
|
|
237
264
|
borderRadius: 14,
|
|
238
265
|
paddingHorizontal: 20,
|
|
239
|
-
paddingVertical: 16
|
|
240
|
-
|
|
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
|
|
241
289
|
},
|
|
242
290
|
helperText: {
|
|
243
291
|
fontSize: 13
|
|
244
292
|
}
|
|
245
293
|
});
|
|
246
|
-
|
|
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 }) {
|
|
247
310
|
const { colors } = useTheme();
|
|
248
311
|
const containerStyle = {
|
|
249
312
|
default: { backgroundColor: colors.primary },
|
|
@@ -257,40 +320,100 @@ function Badge({ label, variant = "default", style }) {
|
|
|
257
320
|
destructive: colors.destructiveForeground,
|
|
258
321
|
outline: colors.foreground
|
|
259
322
|
}[variant];
|
|
260
|
-
|
|
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);
|
|
261
325
|
}
|
|
262
326
|
var styles3 = StyleSheet.create({
|
|
263
327
|
container: {
|
|
264
328
|
borderRadius: 8,
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
329
|
+
alignSelf: "flex-start",
|
|
330
|
+
flexDirection: "row",
|
|
331
|
+
alignItems: "center"
|
|
332
|
+
},
|
|
333
|
+
iconContainer: {
|
|
334
|
+
justifyContent: "center",
|
|
335
|
+
alignItems: "center"
|
|
268
336
|
},
|
|
269
337
|
label: {
|
|
270
|
-
fontSize: 13,
|
|
271
338
|
fontWeight: "500"
|
|
272
339
|
}
|
|
273
340
|
});
|
|
274
|
-
|
|
341
|
+
var nativeDriver2 = Platform.OS !== "web";
|
|
342
|
+
function Card({ children, variant = "elevated", onPress, style }) {
|
|
275
343
|
const { colors } = useTheme();
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
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
|
|
280
377
|
},
|
|
281
|
-
|
|
282
|
-
|
|
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;
|
|
283
406
|
}
|
|
284
407
|
function CardHeader({ children, style }) {
|
|
285
408
|
return /* @__PURE__ */ React23.createElement(View, { style: [styles4.header, style] }, children);
|
|
286
409
|
}
|
|
287
410
|
function CardTitle({ children, style }) {
|
|
288
411
|
const { colors } = useTheme();
|
|
289
|
-
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);
|
|
290
413
|
}
|
|
291
414
|
function CardDescription({ children, style }) {
|
|
292
415
|
const { colors } = useTheme();
|
|
293
|
-
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);
|
|
294
417
|
}
|
|
295
418
|
function CardContent({ children, style }) {
|
|
296
419
|
return /* @__PURE__ */ React23.createElement(View, { style: [styles4.content, style] }, children);
|
|
@@ -444,7 +567,8 @@ function Avatar({ src, fallback, size = "md", style }) {
|
|
|
444
567
|
) : /* @__PURE__ */ React23.createElement(
|
|
445
568
|
Text,
|
|
446
569
|
{
|
|
447
|
-
style: [styles7.fallback, { color: colors.mutedForeground, fontSize: fontSizeMap[size] }]
|
|
570
|
+
style: [styles7.fallback, { color: colors.mutedForeground, fontSize: fontSizeMap[size] }],
|
|
571
|
+
allowFontScaling: true
|
|
448
572
|
},
|
|
449
573
|
fallback?.slice(0, 2).toUpperCase() ?? "?"
|
|
450
574
|
));
|
|
@@ -464,7 +588,7 @@ function AlertBanner({ title, description, variant = "default", icon, style }) {
|
|
|
464
588
|
const titleColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.foreground;
|
|
465
589
|
const descColor = variant === "destructive" ? colors.destructive : variant === "success" ? colors.success : colors.mutedForeground;
|
|
466
590
|
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));
|
|
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));
|
|
468
592
|
}
|
|
469
593
|
var styles8 = StyleSheet.create({
|
|
470
594
|
container: {
|
|
@@ -562,10 +686,11 @@ function EmptyState({ icon, title, description, action, size = "default", style
|
|
|
562
686
|
/* @__PURE__ */ React23.createElement(View, { style: styles10.textWrapper }, /* @__PURE__ */ React23.createElement(
|
|
563
687
|
Text,
|
|
564
688
|
{
|
|
565
|
-
style: [styles10.title, isCompact && styles10.titleCompact, { color: colors.foreground }]
|
|
689
|
+
style: [styles10.title, isCompact && styles10.titleCompact, { color: colors.foreground }],
|
|
690
|
+
allowFontScaling: true
|
|
566
691
|
},
|
|
567
692
|
title
|
|
568
|
-
), description && !isCompact ? /* @__PURE__ */ React23.createElement(Text, { style: [styles10.description, { color: colors.mutedForeground }] }, description) : null),
|
|
693
|
+
), description && !isCompact ? /* @__PURE__ */ React23.createElement(Text, { style: [styles10.description, { color: colors.mutedForeground }], allowFontScaling: true }, description) : null),
|
|
569
694
|
action && !isCompact ? /* @__PURE__ */ React23.createElement(View, { style: styles10.action }, action) : null
|
|
570
695
|
);
|
|
571
696
|
}
|
|
@@ -617,6 +742,7 @@ var styles10 = StyleSheet.create({
|
|
|
617
742
|
marginTop: 8
|
|
618
743
|
}
|
|
619
744
|
});
|
|
745
|
+
var webInputResetStyle2 = Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
620
746
|
function Textarea({
|
|
621
747
|
label,
|
|
622
748
|
error,
|
|
@@ -639,11 +765,12 @@ function Textarea({
|
|
|
639
765
|
style: [
|
|
640
766
|
styles11.input,
|
|
641
767
|
{
|
|
642
|
-
borderColor: error ? colors.destructive : focused ? colors.ring : colors.border,
|
|
768
|
+
borderColor: error ? colors.destructive : focused ? colors.ring ?? colors.primary : colors.border,
|
|
643
769
|
color: colors.foreground,
|
|
644
770
|
backgroundColor: colors.background,
|
|
645
771
|
minHeight: rows * 30
|
|
646
772
|
},
|
|
773
|
+
webInputResetStyle2,
|
|
647
774
|
style
|
|
648
775
|
],
|
|
649
776
|
onFocus: (e) => {
|
|
@@ -701,7 +828,7 @@ function Checkbox({
|
|
|
701
828
|
{
|
|
702
829
|
style: [styles12.row, style],
|
|
703
830
|
onPress: () => {
|
|
704
|
-
|
|
831
|
+
Haptics12.selectionAsync();
|
|
705
832
|
onCheckedChange?.(!checked);
|
|
706
833
|
},
|
|
707
834
|
onPressIn: handlePressIn,
|
|
@@ -759,7 +886,7 @@ var styles12 = StyleSheet.create({
|
|
|
759
886
|
lineHeight: 22
|
|
760
887
|
}
|
|
761
888
|
});
|
|
762
|
-
var
|
|
889
|
+
var nativeDriver3 = Platform.OS !== "web";
|
|
763
890
|
var TRACK_WIDTH = 60;
|
|
764
891
|
var TRACK_HEIGHT = 36;
|
|
765
892
|
var THUMB_SIZE = 28;
|
|
@@ -773,7 +900,7 @@ function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
|
773
900
|
Animated.parallel([
|
|
774
901
|
Animated.spring(translateX, {
|
|
775
902
|
toValue: checked ? THUMB_TRAVEL : 0,
|
|
776
|
-
useNativeDriver:
|
|
903
|
+
useNativeDriver: nativeDriver3,
|
|
777
904
|
bounciness: 4
|
|
778
905
|
}),
|
|
779
906
|
Animated.timing(trackOpacity, {
|
|
@@ -787,17 +914,17 @@ function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
|
787
914
|
inputRange: [0, 1],
|
|
788
915
|
outputRange: [colors.muted, colors.primary]
|
|
789
916
|
});
|
|
790
|
-
return /* @__PURE__ */ React23.createElement(
|
|
917
|
+
return /* @__PURE__ */ React23.createElement(View, { style: [{ opacity: disabled ? 0.45 : 1 }, style] }, /* @__PURE__ */ React23.createElement(
|
|
791
918
|
TouchableOpacity,
|
|
792
919
|
{
|
|
793
920
|
onPress: () => {
|
|
794
|
-
|
|
921
|
+
Haptics12.selectionAsync();
|
|
795
922
|
onCheckedChange?.(!checked);
|
|
796
923
|
},
|
|
797
924
|
disabled,
|
|
798
925
|
activeOpacity: 0.8,
|
|
799
926
|
touchSoundDisabled: true,
|
|
800
|
-
style:
|
|
927
|
+
style: styles13.wrapper
|
|
801
928
|
},
|
|
802
929
|
/* @__PURE__ */ React23.createElement(Animated.View, { style: [styles13.track, { backgroundColor: trackColor }] }, /* @__PURE__ */ React23.createElement(
|
|
803
930
|
Animated.View,
|
|
@@ -808,7 +935,7 @@ function Switch({ checked = false, onCheckedChange, disabled, style }) {
|
|
|
808
935
|
]
|
|
809
936
|
}
|
|
810
937
|
))
|
|
811
|
-
);
|
|
938
|
+
));
|
|
812
939
|
}
|
|
813
940
|
var styles13 = StyleSheet.create({
|
|
814
941
|
wrapper: {},
|
|
@@ -886,10 +1013,14 @@ function Toggle({
|
|
|
886
1013
|
if (typeof prop === "function") return prop(pressed);
|
|
887
1014
|
return prop;
|
|
888
1015
|
};
|
|
889
|
-
if (
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
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 }] });
|
|
893
1024
|
};
|
|
894
1025
|
return /* @__PURE__ */ React23.createElement(Animated.View, { style: { transform: [{ scale }] } }, /* @__PURE__ */ React23.createElement(
|
|
895
1026
|
Animated.View,
|
|
@@ -907,7 +1038,7 @@ function Toggle({
|
|
|
907
1038
|
{
|
|
908
1039
|
style: styles14.touchable,
|
|
909
1040
|
onPress: () => {
|
|
910
|
-
|
|
1041
|
+
Haptics12.selectionAsync();
|
|
911
1042
|
onPressedChange?.(!pressed);
|
|
912
1043
|
},
|
|
913
1044
|
onPressIn: handlePressIn,
|
|
@@ -974,7 +1105,7 @@ function RadioItem({
|
|
|
974
1105
|
style: styles15.row,
|
|
975
1106
|
onPress: () => {
|
|
976
1107
|
if (!option.disabled) {
|
|
977
|
-
|
|
1108
|
+
Haptics12.selectionAsync();
|
|
978
1109
|
onSelect();
|
|
979
1110
|
}
|
|
980
1111
|
},
|
|
@@ -1132,7 +1263,7 @@ function Tabs({ tabs, value, onValueChange, children, style }) {
|
|
|
1132
1263
|
}
|
|
1133
1264
|
}, [active]);
|
|
1134
1265
|
const handlePress = (v) => {
|
|
1135
|
-
|
|
1266
|
+
Haptics12.selectionAsync();
|
|
1136
1267
|
if (!value) setInternal(v);
|
|
1137
1268
|
onValueChange?.(v);
|
|
1138
1269
|
};
|
|
@@ -1257,7 +1388,7 @@ function AccordionItemComponent({
|
|
|
1257
1388
|
{
|
|
1258
1389
|
style: styles17.trigger,
|
|
1259
1390
|
onPress: () => {
|
|
1260
|
-
|
|
1391
|
+
Haptics12.selectionAsync();
|
|
1261
1392
|
onToggle();
|
|
1262
1393
|
},
|
|
1263
1394
|
onPressIn: handlePressIn,
|
|
@@ -1331,116 +1462,63 @@ function Slider({
|
|
|
1331
1462
|
step = 0,
|
|
1332
1463
|
onValueChange,
|
|
1333
1464
|
onSlidingComplete,
|
|
1465
|
+
label,
|
|
1466
|
+
showValue = false,
|
|
1467
|
+
formatValue: formatValue2 = (v) => v.toFixed(2),
|
|
1468
|
+
accessibilityLabel,
|
|
1334
1469
|
disabled,
|
|
1335
1470
|
style
|
|
1336
1471
|
}) {
|
|
1337
1472
|
const { colors } = useTheme();
|
|
1338
|
-
const trackWidth = useRef(0);
|
|
1339
1473
|
const lastSteppedValue = useRef(value);
|
|
1340
|
-
const
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
};
|
|
1347
|
-
const xToValue = (x) => {
|
|
1348
|
-
const ratio = Math.min(Math.max(x / trackWidth.current, 0), 1);
|
|
1349
|
-
const raw = ratio * (maximumValue - minimumValue) + minimumValue;
|
|
1350
|
-
return clamp(snapToStep(raw));
|
|
1351
|
-
};
|
|
1352
|
-
const panResponder = useRef(
|
|
1353
|
-
PanResponder.create({
|
|
1354
|
-
onStartShouldSetPanResponder: () => !disabled,
|
|
1355
|
-
onMoveShouldSetPanResponder: () => !disabled,
|
|
1356
|
-
onPanResponderGrant: (e) => {
|
|
1357
|
-
const x = e.nativeEvent.locationX;
|
|
1358
|
-
const newValue = xToValue(x);
|
|
1359
|
-
setInternalValue(newValue);
|
|
1360
|
-
onValueChange?.(newValue);
|
|
1361
|
-
},
|
|
1362
|
-
onPanResponderMove: (e) => {
|
|
1363
|
-
const x = e.nativeEvent.locationX;
|
|
1364
|
-
const newValue = xToValue(x);
|
|
1365
|
-
if (newValue !== lastSteppedValue.current) {
|
|
1366
|
-
lastSteppedValue.current = newValue;
|
|
1367
|
-
Haptics11.selectionAsync();
|
|
1368
|
-
}
|
|
1369
|
-
setInternalValue(newValue);
|
|
1370
|
-
onValueChange?.(newValue);
|
|
1371
|
-
},
|
|
1372
|
-
onPanResponderRelease: (e) => {
|
|
1373
|
-
const x = e.nativeEvent.locationX;
|
|
1374
|
-
const newValue = xToValue(x);
|
|
1375
|
-
setInternalValue(newValue);
|
|
1376
|
-
onSlidingComplete?.(newValue);
|
|
1377
|
-
}
|
|
1378
|
-
})
|
|
1379
|
-
).current;
|
|
1380
|
-
const onLayout = (e) => {
|
|
1381
|
-
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);
|
|
1382
1480
|
};
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
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,
|
|
1386
1483
|
{
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
styles18.thumb,
|
|
1402
|
-
{
|
|
1403
|
-
left: `${percent}%`,
|
|
1404
|
-
backgroundColor: colors.primary,
|
|
1405
|
-
borderColor: colors.background,
|
|
1406
|
-
transform: [{ translateX: -14 }]
|
|
1407
|
-
}
|
|
1408
|
-
],
|
|
1409
|
-
pointerEvents: "none"
|
|
1410
|
-
}
|
|
1411
|
-
)
|
|
1412
|
-
);
|
|
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
|
+
)));
|
|
1413
1498
|
}
|
|
1414
1499
|
var styles18 = StyleSheet.create({
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
justifyContent: "center",
|
|
1418
|
-
position: "relative"
|
|
1500
|
+
wrapper: {
|
|
1501
|
+
gap: 8
|
|
1419
1502
|
},
|
|
1420
|
-
|
|
1421
|
-
|
|
1503
|
+
header: {
|
|
1504
|
+
flexDirection: "row",
|
|
1505
|
+
justifyContent: "space-between",
|
|
1506
|
+
alignItems: "center"
|
|
1422
1507
|
},
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
overflow: "hidden",
|
|
1427
|
-
width: "100%"
|
|
1508
|
+
label: {
|
|
1509
|
+
fontSize: 15,
|
|
1510
|
+
fontWeight: "500"
|
|
1428
1511
|
},
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1512
|
+
valueText: {
|
|
1513
|
+
fontSize: 14,
|
|
1514
|
+
fontWeight: "500"
|
|
1432
1515
|
},
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
shadowColor: "#000",
|
|
1440
|
-
shadowOffset: { width: 0, height: 1 },
|
|
1441
|
-
shadowOpacity: 0.2,
|
|
1442
|
-
shadowRadius: 2,
|
|
1443
|
-
elevation: 2
|
|
1516
|
+
slider: {
|
|
1517
|
+
width: "100%",
|
|
1518
|
+
height: 40
|
|
1519
|
+
},
|
|
1520
|
+
disabled: {
|
|
1521
|
+
opacity: 0.45
|
|
1444
1522
|
}
|
|
1445
1523
|
});
|
|
1446
1524
|
function Sheet({
|
|
@@ -1456,7 +1534,7 @@ function Sheet({
|
|
|
1456
1534
|
const ref = useRef(null);
|
|
1457
1535
|
useEffect(() => {
|
|
1458
1536
|
if (open) {
|
|
1459
|
-
|
|
1537
|
+
Haptics12.impactAsync(Haptics12.ImpactFeedbackStyle.Light);
|
|
1460
1538
|
ref.current?.present();
|
|
1461
1539
|
} else {
|
|
1462
1540
|
ref.current?.dismiss();
|
|
@@ -1512,6 +1590,9 @@ var styles19 = StyleSheet.create({
|
|
|
1512
1590
|
lineHeight: 20
|
|
1513
1591
|
}
|
|
1514
1592
|
});
|
|
1593
|
+
var isIOS = Platform.OS === "ios";
|
|
1594
|
+
var isAndroid = Platform.OS === "android";
|
|
1595
|
+
var isWeb = Platform.OS === "web";
|
|
1515
1596
|
function Select({
|
|
1516
1597
|
options,
|
|
1517
1598
|
value,
|
|
@@ -1523,8 +1604,10 @@ function Select({
|
|
|
1523
1604
|
style
|
|
1524
1605
|
}) {
|
|
1525
1606
|
const { colors } = useTheme();
|
|
1526
|
-
const bottomSheetRef = useRef(null);
|
|
1527
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);
|
|
1528
1611
|
const selected = options.find((o) => o.value === value);
|
|
1529
1612
|
const handlePressIn = () => {
|
|
1530
1613
|
if (disabled) return;
|
|
@@ -1534,24 +1617,26 @@ function Select({
|
|
|
1534
1617
|
Animated.spring(scale, { toValue: 1, useNativeDriver: true, speed: 40, bounciness: 4 }).start();
|
|
1535
1618
|
};
|
|
1536
1619
|
const handleOpen = () => {
|
|
1537
|
-
if (
|
|
1538
|
-
|
|
1539
|
-
|
|
1620
|
+
if (disabled) return;
|
|
1621
|
+
Haptics12.selectionAsync();
|
|
1622
|
+
if (isIOS) {
|
|
1623
|
+
setPendingValue(value);
|
|
1624
|
+
setPickerVisible(true);
|
|
1625
|
+
} else if (isAndroid) {
|
|
1626
|
+
pickerRef.current?.focus();
|
|
1540
1627
|
}
|
|
1541
1628
|
};
|
|
1542
|
-
const
|
|
1543
|
-
(
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
);
|
|
1554
|
-
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(
|
|
1555
1640
|
TouchableOpacity,
|
|
1556
1641
|
{
|
|
1557
1642
|
style: [
|
|
@@ -1574,57 +1659,97 @@ function Select({
|
|
|
1574
1659
|
styles20.triggerText,
|
|
1575
1660
|
{ color: selected ? colors.foreground : colors.mutedForeground }
|
|
1576
1661
|
],
|
|
1577
|
-
numberOfLines: 1
|
|
1662
|
+
numberOfLines: 1,
|
|
1663
|
+
allowFontScaling: true
|
|
1578
1664
|
},
|
|
1579
1665
|
selected?.label ?? placeholder
|
|
1580
1666
|
),
|
|
1581
1667
|
/* @__PURE__ */ React23.createElement(Text, { style: [styles20.chevron, { color: colors.mutedForeground }] }, "\u25BE")
|
|
1582
|
-
))
|
|
1583
|
-
|
|
1668
|
+
)) : null, isIOS ? /* @__PURE__ */ React23.createElement(
|
|
1669
|
+
Modal,
|
|
1584
1670
|
{
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
backgroundStyle: [styles20.sheetBackground, { backgroundColor: colors.card }],
|
|
1590
|
-
handleIndicatorStyle: [styles20.sheetHandle, { backgroundColor: colors.border }]
|
|
1671
|
+
visible: pickerVisible,
|
|
1672
|
+
transparent: true,
|
|
1673
|
+
animationType: "slide",
|
|
1674
|
+
onRequestClose: handleDismiss
|
|
1591
1675
|
},
|
|
1592
|
-
/* @__PURE__ */ React23.createElement(
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
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,
|
|
1596
1687
|
{
|
|
1597
|
-
key:
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
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);
|
|
1628
1753
|
}
|
|
1629
1754
|
var styles20 = StyleSheet.create({
|
|
1630
1755
|
container: {
|
|
@@ -1655,44 +1780,45 @@ var styles20 = StyleSheet.create({
|
|
|
1655
1780
|
helperText: {
|
|
1656
1781
|
fontSize: 13
|
|
1657
1782
|
},
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1783
|
+
iosBackdrop: {
|
|
1784
|
+
flex: 1,
|
|
1785
|
+
backgroundColor: "rgba(0,0,0,0.4)"
|
|
1661
1786
|
},
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1787
|
+
iosSheet: {
|
|
1788
|
+
borderTopLeftRadius: 24,
|
|
1789
|
+
borderTopRightRadius: 24,
|
|
1790
|
+
paddingBottom: 32
|
|
1666
1791
|
},
|
|
1667
|
-
|
|
1792
|
+
iosToolbar: {
|
|
1793
|
+
flexDirection: "row",
|
|
1794
|
+
alignItems: "center",
|
|
1795
|
+
justifyContent: "space-between",
|
|
1668
1796
|
paddingHorizontal: 20,
|
|
1669
|
-
|
|
1797
|
+
paddingVertical: 12,
|
|
1798
|
+
borderBottomWidth: 1
|
|
1670
1799
|
},
|
|
1671
|
-
|
|
1800
|
+
iosToolbarTitle: {
|
|
1672
1801
|
fontSize: 17,
|
|
1673
|
-
fontWeight: "600"
|
|
1674
|
-
paddingVertical: 16,
|
|
1675
|
-
paddingHorizontal: 4
|
|
1802
|
+
fontWeight: "600"
|
|
1676
1803
|
},
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
alignItems: "center",
|
|
1680
|
-
justifyContent: "space-between",
|
|
1681
|
-
paddingHorizontal: 16,
|
|
1682
|
-
paddingVertical: 16,
|
|
1683
|
-
borderRadius: 12
|
|
1804
|
+
iosDoneBtn: {
|
|
1805
|
+
padding: 4
|
|
1684
1806
|
},
|
|
1685
|
-
|
|
1807
|
+
iosDoneBtnText: {
|
|
1686
1808
|
fontSize: 17,
|
|
1687
|
-
|
|
1809
|
+
fontWeight: "600"
|
|
1688
1810
|
},
|
|
1689
|
-
|
|
1690
|
-
|
|
1811
|
+
androidHiddenPicker: {
|
|
1812
|
+
height: 0,
|
|
1813
|
+
opacity: 0,
|
|
1814
|
+
position: "absolute"
|
|
1691
1815
|
},
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1816
|
+
webPicker: {
|
|
1817
|
+
borderWidth: 1.5,
|
|
1818
|
+
borderRadius: 14,
|
|
1819
|
+
paddingHorizontal: 20,
|
|
1820
|
+
paddingVertical: 16,
|
|
1821
|
+
fontSize: 17
|
|
1696
1822
|
}
|
|
1697
1823
|
});
|
|
1698
1824
|
var ToastContext = createContext({
|
|
@@ -1759,11 +1885,11 @@ function ToastProvider({ children }) {
|
|
|
1759
1885
|
const toast = useCallback((item) => {
|
|
1760
1886
|
const id = Math.random().toString(36).slice(2);
|
|
1761
1887
|
if (item.variant === "success") {
|
|
1762
|
-
|
|
1888
|
+
Haptics12.notificationAsync(Haptics12.NotificationFeedbackType.Success);
|
|
1763
1889
|
} else if (item.variant === "destructive") {
|
|
1764
|
-
|
|
1890
|
+
Haptics12.notificationAsync(Haptics12.NotificationFeedbackType.Error);
|
|
1765
1891
|
} else {
|
|
1766
|
-
|
|
1892
|
+
Haptics12.impactAsync(Haptics12.ImpactFeedbackStyle.Light);
|
|
1767
1893
|
}
|
|
1768
1894
|
setToasts((prev) => [{ ...item, id }, ...prev].slice(0, 3));
|
|
1769
1895
|
}, []);
|
|
@@ -1832,12 +1958,14 @@ function CurrencyInput({
|
|
|
1832
1958
|
onChangeValue,
|
|
1833
1959
|
prefix = "$",
|
|
1834
1960
|
thousandsSeparator = ".",
|
|
1961
|
+
size = "default",
|
|
1835
1962
|
label,
|
|
1836
1963
|
error,
|
|
1837
1964
|
hint,
|
|
1838
1965
|
placeholder,
|
|
1839
1966
|
editable,
|
|
1840
|
-
containerStyle
|
|
1967
|
+
containerStyle,
|
|
1968
|
+
style
|
|
1841
1969
|
}) {
|
|
1842
1970
|
const handleChange = (text) => {
|
|
1843
1971
|
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
@@ -1848,6 +1976,7 @@ function CurrencyInput({
|
|
|
1848
1976
|
const raw = parseFloat(formatted.replace(separatorRegex, "") || "0");
|
|
1849
1977
|
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
1850
1978
|
};
|
|
1979
|
+
const inputStyle = size === "large" ? { fontSize: 36 } : {};
|
|
1851
1980
|
return /* @__PURE__ */ React23.createElement(
|
|
1852
1981
|
Input,
|
|
1853
1982
|
{
|
|
@@ -1859,7 +1988,8 @@ function CurrencyInput({
|
|
|
1859
1988
|
hint,
|
|
1860
1989
|
placeholder: placeholder ?? `${prefix}0`,
|
|
1861
1990
|
editable,
|
|
1862
|
-
containerStyle
|
|
1991
|
+
containerStyle,
|
|
1992
|
+
style: [inputStyle, style]
|
|
1863
1993
|
}
|
|
1864
1994
|
);
|
|
1865
1995
|
}
|
|
@@ -1887,50 +2017,7 @@ var styles22 = StyleSheet.create({
|
|
|
1887
2017
|
fontWeight: "700"
|
|
1888
2018
|
}
|
|
1889
2019
|
});
|
|
1890
|
-
|
|
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";
|
|
2020
|
+
var nativeDriver4 = Platform.OS !== "web";
|
|
1934
2021
|
function ListItem({ icon, title, subtitle, trailing, onPress, disabled, style }) {
|
|
1935
2022
|
const { colors } = useTheme();
|
|
1936
2023
|
const scale = useRef(new Animated.Value(1)).current;
|
|
@@ -1938,7 +2025,7 @@ function ListItem({ icon, title, subtitle, trailing, onPress, disabled, style })
|
|
|
1938
2025
|
if (!onPress || disabled) return;
|
|
1939
2026
|
Animated.spring(scale, {
|
|
1940
2027
|
toValue: 0.97,
|
|
1941
|
-
useNativeDriver:
|
|
2028
|
+
useNativeDriver: nativeDriver4,
|
|
1942
2029
|
speed: 40,
|
|
1943
2030
|
bounciness: 0
|
|
1944
2031
|
}).start();
|
|
@@ -1946,13 +2033,13 @@ function ListItem({ icon, title, subtitle, trailing, onPress, disabled, style })
|
|
|
1946
2033
|
const handlePressOut = () => {
|
|
1947
2034
|
Animated.spring(scale, {
|
|
1948
2035
|
toValue: 1,
|
|
1949
|
-
useNativeDriver:
|
|
2036
|
+
useNativeDriver: nativeDriver4,
|
|
1950
2037
|
speed: 40,
|
|
1951
2038
|
bounciness: 4
|
|
1952
2039
|
}).start();
|
|
1953
2040
|
};
|
|
1954
2041
|
const handlePress = () => {
|
|
1955
|
-
|
|
2042
|
+
Haptics12.selectionAsync();
|
|
1956
2043
|
onPress?.();
|
|
1957
2044
|
};
|
|
1958
2045
|
return /* @__PURE__ */ React23.createElement(Animated.View, { style: [{ transform: [{ scale }] }, disabled && styles23.disabled] }, /* @__PURE__ */ React23.createElement(
|
|
@@ -2003,7 +2090,7 @@ var styles23 = StyleSheet.create({
|
|
|
2003
2090
|
opacity: 0.45
|
|
2004
2091
|
}
|
|
2005
2092
|
});
|
|
2006
|
-
var
|
|
2093
|
+
var nativeDriver5 = Platform.OS !== "web";
|
|
2007
2094
|
function Chip({ label, selected = false, onPress, style }) {
|
|
2008
2095
|
const { colors } = useTheme();
|
|
2009
2096
|
const scale = useRef(new Animated.Value(1)).current;
|
|
@@ -2019,7 +2106,7 @@ function Chip({ label, selected = false, onPress, style }) {
|
|
|
2019
2106
|
const handlePressIn = () => {
|
|
2020
2107
|
Animated.spring(scale, {
|
|
2021
2108
|
toValue: 0.95,
|
|
2022
|
-
useNativeDriver:
|
|
2109
|
+
useNativeDriver: nativeDriver5,
|
|
2023
2110
|
speed: 40,
|
|
2024
2111
|
bounciness: 0
|
|
2025
2112
|
}).start();
|
|
@@ -2027,13 +2114,13 @@ function Chip({ label, selected = false, onPress, style }) {
|
|
|
2027
2114
|
const handlePressOut = () => {
|
|
2028
2115
|
Animated.spring(scale, {
|
|
2029
2116
|
toValue: 1,
|
|
2030
|
-
useNativeDriver:
|
|
2117
|
+
useNativeDriver: nativeDriver5,
|
|
2031
2118
|
speed: 40,
|
|
2032
2119
|
bounciness: 4
|
|
2033
2120
|
}).start();
|
|
2034
2121
|
};
|
|
2035
2122
|
const handlePress = () => {
|
|
2036
|
-
|
|
2123
|
+
Haptics12.selectionAsync();
|
|
2037
2124
|
onPress?.();
|
|
2038
2125
|
};
|
|
2039
2126
|
const backgroundColor = pressAnim.interpolate({
|
|
@@ -2060,14 +2147,35 @@ function Chip({ label, selected = false, onPress, style }) {
|
|
|
2060
2147
|
/* @__PURE__ */ React23.createElement(Animated.View, { style: [styles24.chip, { backgroundColor, borderColor }] }, /* @__PURE__ */ React23.createElement(Animated.Text, { style: [styles24.label, { color: textColor }], allowFontScaling: true }, label))
|
|
2061
2148
|
));
|
|
2062
2149
|
}
|
|
2063
|
-
function ChipGroup({ options, value, onValueChange, style }) {
|
|
2150
|
+
function ChipGroup({ options, value, onValueChange, multiSelect = false, style }) {
|
|
2151
|
+
const handlePress = (optionValue) => {
|
|
2152
|
+
if (!multiSelect) {
|
|
2153
|
+
onValueChange?.(optionValue);
|
|
2154
|
+
return;
|
|
2155
|
+
}
|
|
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
|
+
};
|
|
2064
2172
|
return /* @__PURE__ */ React23.createElement(View, { style: [styles24.group, style] }, options.map((opt) => /* @__PURE__ */ React23.createElement(
|
|
2065
2173
|
Chip,
|
|
2066
2174
|
{
|
|
2067
2175
|
key: opt.value,
|
|
2068
2176
|
label: opt.label,
|
|
2069
|
-
selected: opt.value
|
|
2070
|
-
onPress: () =>
|
|
2177
|
+
selected: isSelected(opt.value),
|
|
2178
|
+
onPress: () => handlePress(opt.value)
|
|
2071
2179
|
}
|
|
2072
2180
|
)));
|
|
2073
2181
|
}
|
|
@@ -2187,7 +2295,7 @@ var MONTH_NAMES = [
|
|
|
2187
2295
|
function MonthPicker({ value, onChange, style }) {
|
|
2188
2296
|
const { colors } = useTheme();
|
|
2189
2297
|
const handlePrev = () => {
|
|
2190
|
-
|
|
2298
|
+
Haptics12.selectionAsync();
|
|
2191
2299
|
if (value.month === 1) {
|
|
2192
2300
|
onChange({ month: 12, year: value.year - 1 });
|
|
2193
2301
|
} else {
|
|
@@ -2195,7 +2303,7 @@ function MonthPicker({ value, onChange, style }) {
|
|
|
2195
2303
|
}
|
|
2196
2304
|
};
|
|
2197
2305
|
const handleNext = () => {
|
|
2198
|
-
|
|
2306
|
+
Haptics12.selectionAsync();
|
|
2199
2307
|
if (value.month === 12) {
|
|
2200
2308
|
onChange({ month: 1, year: value.year + 1 });
|
|
2201
2309
|
} else {
|
|
@@ -2210,7 +2318,7 @@ function MonthPicker({ value, onChange, style }) {
|
|
|
2210
2318
|
activeOpacity: 0.6,
|
|
2211
2319
|
touchSoundDisabled: true
|
|
2212
2320
|
},
|
|
2213
|
-
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }] }, "\u2039")
|
|
2321
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }], allowFontScaling: true }, "\u2039")
|
|
2214
2322
|
), /* @__PURE__ */ React23.createElement(Text, { style: [styles27.label, { color: colors.foreground }], allowFontScaling: true }, MONTH_NAMES[value.month - 1], " ", value.year), /* @__PURE__ */ React23.createElement(
|
|
2215
2323
|
TouchableOpacity,
|
|
2216
2324
|
{
|
|
@@ -2219,7 +2327,7 @@ function MonthPicker({ value, onChange, style }) {
|
|
|
2219
2327
|
activeOpacity: 0.6,
|
|
2220
2328
|
touchSoundDisabled: true
|
|
2221
2329
|
},
|
|
2222
|
-
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }] }, "\u203A")
|
|
2330
|
+
/* @__PURE__ */ React23.createElement(Text, { style: [styles27.arrowText, { color: colors.foreground }], allowFontScaling: true }, "\u203A")
|
|
2223
2331
|
));
|
|
2224
2332
|
}
|
|
2225
2333
|
var styles27 = StyleSheet.create({
|
|
@@ -2247,4 +2355,4 @@ var styles27 = StyleSheet.create({
|
|
|
2247
2355
|
}
|
|
2248
2356
|
});
|
|
2249
2357
|
|
|
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 };
|
|
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 };
|