@retray-dev/ui-kit 6.1.0 → 7.0.1
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 +447 -13
- package/EXAMPLES.md +248 -0
- package/README.md +11 -10
- package/dist/Accordion.d.mts +28 -0
- package/dist/Accordion.d.ts +28 -0
- package/dist/Accordion.js +340 -0
- package/dist/Accordion.mjs +6 -0
- package/dist/AlertBanner.d.mts +16 -0
- package/dist/AlertBanner.d.ts +16 -0
- package/dist/AlertBanner.js +247 -0
- package/dist/AlertBanner.mjs +5 -0
- package/dist/Avatar.d.mts +20 -0
- package/dist/Avatar.d.ts +20 -0
- package/dist/Avatar.js +234 -0
- package/dist/Avatar.mjs +3 -0
- package/dist/Badge.d.mts +26 -0
- package/dist/Badge.d.ts +26 -0
- package/dist/Badge.js +247 -0
- package/dist/Badge.mjs +4 -0
- package/dist/Button.d.mts +25 -0
- package/dist/Button.d.ts +25 -0
- package/dist/Button.js +414 -0
- package/dist/Button.mjs +8 -0
- package/dist/ButtonGroup.d.mts +26 -0
- package/dist/ButtonGroup.d.ts +26 -0
- package/dist/ButtonGroup.js +52 -0
- package/dist/ButtonGroup.mjs +2 -0
- package/dist/Card.d.mts +39 -0
- package/dist/Card.d.ts +39 -0
- package/dist/Card.js +329 -0
- package/dist/Card.mjs +7 -0
- package/dist/CategoryStrip.d.mts +26 -0
- package/dist/CategoryStrip.d.ts +26 -0
- package/dist/CategoryStrip.js +396 -0
- package/dist/CategoryStrip.mjs +9 -0
- package/dist/Checkbox.d.mts +14 -0
- package/dist/Checkbox.d.ts +14 -0
- package/dist/Checkbox.js +304 -0
- package/dist/Checkbox.mjs +7 -0
- package/dist/Chip.d.mts +31 -0
- package/dist/Chip.d.ts +31 -0
- package/dist/Chip.js +370 -0
- package/dist/Chip.mjs +8 -0
- package/dist/ConfirmDialog.d.mts +15 -0
- package/dist/ConfirmDialog.d.ts +15 -0
- package/dist/ConfirmDialog.js +530 -0
- package/dist/ConfirmDialog.mjs +9 -0
- package/dist/CurrencyDisplay.d.mts +24 -0
- package/dist/CurrencyDisplay.d.ts +24 -0
- package/dist/CurrencyDisplay.js +189 -0
- package/dist/CurrencyDisplay.mjs +3 -0
- package/dist/CurrencyInput.d.mts +26 -0
- package/dist/CurrencyInput.d.ts +26 -0
- package/dist/CurrencyInput.js +404 -0
- package/dist/CurrencyInput.mjs +7 -0
- package/dist/DetailRow.d.mts +32 -0
- package/dist/DetailRow.d.ts +32 -0
- package/dist/DetailRow.js +275 -0
- package/dist/DetailRow.mjs +4 -0
- package/dist/EmptyState.d.mts +27 -0
- package/dist/EmptyState.d.ts +27 -0
- package/dist/EmptyState.js +503 -0
- package/dist/EmptyState.mjs +9 -0
- package/dist/Form.d.mts +52 -0
- package/dist/Form.d.ts +52 -0
- package/dist/Form.js +204 -0
- package/dist/Form.mjs +3 -0
- package/dist/IconButton.d.mts +22 -0
- package/dist/IconButton.d.ts +22 -0
- package/dist/IconButton.js +383 -0
- package/dist/IconButton.mjs +7 -0
- package/dist/Input.d.mts +23 -0
- package/dist/Input.d.ts +23 -0
- package/dist/Input.js +351 -0
- package/dist/Input.mjs +6 -0
- package/dist/LabelValue.d.mts +16 -0
- package/dist/LabelValue.d.ts +16 -0
- package/dist/LabelValue.js +225 -0
- package/dist/LabelValue.mjs +4 -0
- package/dist/ListGroup.d.mts +34 -0
- package/dist/ListGroup.d.ts +34 -0
- package/dist/ListGroup.js +217 -0
- package/dist/ListGroup.mjs +4 -0
- package/dist/ListItem.d.mts +64 -0
- package/dist/ListItem.d.ts +64 -0
- package/dist/ListItem.js +430 -0
- package/dist/ListItem.mjs +8 -0
- package/dist/MediaCard.d.mts +39 -0
- package/dist/MediaCard.d.ts +39 -0
- package/dist/MediaCard.js +427 -0
- package/dist/MediaCard.mjs +8 -0
- package/dist/MenuGroup.d.mts +34 -0
- package/dist/MenuGroup.d.ts +34 -0
- package/dist/MenuGroup.js +217 -0
- package/dist/MenuGroup.mjs +4 -0
- package/dist/MenuItem.d.mts +48 -0
- package/dist/MenuItem.d.ts +48 -0
- package/dist/MenuItem.js +403 -0
- package/dist/MenuItem.mjs +8 -0
- package/dist/MonthPicker.d.mts +20 -0
- package/dist/MonthPicker.d.ts +20 -0
- package/dist/MonthPicker.js +234 -0
- package/dist/MonthPicker.mjs +4 -0
- package/dist/Pressable.d.mts +34 -0
- package/dist/Pressable.d.ts +34 -0
- package/dist/Pressable.js +132 -0
- package/dist/Pressable.mjs +4 -0
- package/dist/Progress.d.mts +14 -0
- package/dist/Progress.d.ts +14 -0
- package/dist/Progress.js +191 -0
- package/dist/Progress.mjs +4 -0
- package/dist/RadioGroup.d.mts +19 -0
- package/dist/RadioGroup.d.ts +19 -0
- package/dist/RadioGroup.js +341 -0
- package/dist/RadioGroup.mjs +7 -0
- package/dist/Select.d.mts +22 -0
- package/dist/Select.d.ts +22 -0
- package/dist/Select.js +441 -0
- package/dist/Select.mjs +6 -0
- package/dist/Separator.d.mts +10 -0
- package/dist/Separator.d.ts +10 -0
- package/dist/Separator.js +156 -0
- package/dist/Separator.mjs +2 -0
- package/dist/Sheet.d.mts +81 -0
- package/dist/Sheet.d.ts +81 -0
- package/dist/Sheet.js +340 -0
- package/dist/Sheet.mjs +4 -0
- package/dist/Skeleton.d.mts +17 -0
- package/dist/Skeleton.d.ts +17 -0
- package/dist/Skeleton.js +205 -0
- package/dist/Skeleton.mjs +4 -0
- package/dist/Slider.d.mts +20 -0
- package/dist/Slider.d.ts +20 -0
- package/dist/Slider.js +232 -0
- package/dist/Slider.mjs +4 -0
- package/dist/Spinner.d.mts +12 -0
- package/dist/Spinner.d.ts +12 -0
- package/dist/Spinner.js +172 -0
- package/dist/Spinner.mjs +3 -0
- package/dist/Switch.d.mts +13 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.js +261 -0
- package/dist/Switch.mjs +5 -0
- package/dist/Tabs.d.mts +27 -0
- package/dist/Tabs.d.ts +27 -0
- package/dist/Tabs.js +389 -0
- package/dist/Tabs.mjs +6 -0
- package/dist/Text.d.mts +12 -0
- package/dist/Text.d.ts +12 -0
- package/dist/Text.js +311 -0
- package/dist/Text.mjs +4 -0
- package/dist/Textarea.d.mts +16 -0
- package/dist/Textarea.d.ts +16 -0
- package/dist/Textarea.js +333 -0
- package/dist/Textarea.mjs +6 -0
- package/dist/Toast.d.mts +47 -0
- package/dist/Toast.d.ts +47 -0
- package/dist/Toast.js +185 -0
- package/dist/Toast.mjs +3 -0
- package/dist/Toggle.d.mts +33 -0
- package/dist/Toggle.d.ts +33 -0
- package/dist/Toggle.js +397 -0
- package/dist/Toggle.mjs +8 -0
- package/dist/VirtualList.d.mts +19 -0
- package/dist/VirtualList.d.ts +19 -0
- package/dist/VirtualList.js +38 -0
- package/dist/VirtualList.mjs +1 -0
- package/dist/chunk-2CE3TQVY.mjs +11 -0
- package/dist/chunk-2UYENBLV.mjs +49 -0
- package/dist/chunk-3BBOZ3OQ.mjs +41 -0
- package/dist/chunk-5IKW3VNC.mjs +43 -0
- package/dist/chunk-63357L2X.mjs +51 -0
- package/dist/chunk-6LQYY7HC.mjs +127 -0
- package/dist/chunk-6Q64UFIA.mjs +71 -0
- package/dist/chunk-76PFOSM2.mjs +41 -0
- package/dist/chunk-7H2OR44A.mjs +14 -0
- package/dist/chunk-A4MDAP7G.mjs +42 -0
- package/dist/chunk-AU2VDY4P.mjs +190 -0
- package/dist/chunk-BRKYVJVV.mjs +60 -0
- package/dist/chunk-CRYBX2CM.mjs +146 -0
- package/dist/chunk-DITNP6PL.mjs +106 -0
- package/dist/chunk-FTLJOUOQ.mjs +97 -0
- package/dist/chunk-GCWOGZYL.mjs +104 -0
- package/dist/chunk-GNGLDL6Z.mjs +60 -0
- package/dist/chunk-GPOUINK5.mjs +148 -0
- package/dist/chunk-HSPSMN6U.mjs +115 -0
- package/dist/chunk-IRRY3CRZ.mjs +82 -0
- package/dist/chunk-JB67UOB5.mjs +92 -0
- package/dist/chunk-JBLL7U3U.mjs +64 -0
- package/dist/chunk-KWCPOM6W.mjs +136 -0
- package/dist/chunk-KZJRQOIU.mjs +64 -0
- package/dist/chunk-L7E7TVEZ.mjs +145 -0
- package/dist/chunk-LG4DO3DK.mjs +174 -0
- package/dist/chunk-LWG526VX.mjs +139 -0
- package/dist/chunk-MN7OG7IY.mjs +96 -0
- package/dist/chunk-MX6HRKMI.mjs +29 -0
- package/dist/chunk-NC5ZTR2Y.mjs +32 -0
- package/dist/chunk-NQGVLMWG.mjs +90 -0
- package/dist/chunk-QCNARS3X.mjs +46 -0
- package/dist/chunk-QXGYKWI7.mjs +134 -0
- package/dist/chunk-QY3X2UYR.mjs +191 -0
- package/dist/chunk-RKLHUDZS.mjs +92 -0
- package/dist/chunk-RMMK64W5.mjs +54 -0
- package/dist/chunk-RR2VQLKE.mjs +190 -0
- package/dist/chunk-RTC3CFXF.mjs +29 -0
- package/dist/chunk-SBZYEV4S.mjs +61 -0
- package/dist/chunk-SOA2Z4RB.mjs +82 -0
- package/dist/chunk-SOYNZDVY.mjs +151 -0
- package/dist/chunk-T7XZ7H7Y.mjs +57 -0
- package/dist/chunk-TAJ2PQ2O.mjs +163 -0
- package/dist/chunk-U4N7WF4Z.mjs +108 -0
- package/dist/chunk-URDE3EUU.mjs +132 -0
- package/dist/chunk-URLL5JBR.mjs +245 -0
- package/dist/chunk-XDMN67KV.mjs +59 -0
- package/dist/chunk-Y6MXOREN.mjs +120 -0
- package/dist/chunk-YZJAFS4P.mjs +131 -0
- package/dist/index.d.mts +94 -852
- package/dist/index.d.ts +94 -852
- package/dist/index.js +1387 -942
- package/dist/index.mjs +50 -3844
- package/package.json +23 -14
- package/src/assets/fonts/Sohne-Bold.otf +0 -0
- package/src/assets/fonts/Sohne-BoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBold.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLight.otf +0 -0
- package/src/assets/fonts/Sohne-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Italic.otf +0 -0
- package/src/assets/fonts/Sohne-Light.otf +0 -0
- package/src/assets/fonts/Sohne-LightItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Medium.otf +0 -0
- package/src/assets/fonts/Sohne-MediumItalic.otf +0 -0
- package/src/assets/fonts/Sohne-Regular.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBold.otf +0 -0
- package/src/assets/fonts/Sohne-SemiBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Bold.otf +0 -0
- package/src/assets/fonts/SohneMono-BoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBold.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraBoldItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLight.otf +0 -0
- package/src/assets/fonts/SohneMono-ExtraLightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Italic.otf +0 -0
- package/src/assets/fonts/SohneMono-Light.otf +0 -0
- package/src/assets/fonts/SohneMono-LightItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Medium.otf +0 -0
- package/src/assets/fonts/SohneMono-MediumItalic.otf +0 -0
- package/src/assets/fonts/SohneMono-Regular.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBold.otf +0 -0
- package/src/assets/fonts/SohneMono-SemiBoldItalic.otf +0 -0
- package/src/components/Accordion/Accordion.tsx +13 -15
- package/src/components/AlertBanner/AlertBanner.tsx +33 -12
- package/src/components/Avatar/Avatar.tsx +4 -2
- package/src/components/Badge/Badge.tsx +4 -2
- package/src/components/Button/Button.tsx +30 -29
- package/src/components/ButtonGroup/ButtonGroup.tsx +13 -10
- package/src/components/Card/Card.tsx +36 -65
- package/src/components/CategoryStrip/CategoryStrip.tsx +68 -58
- package/src/components/Checkbox/Checkbox.tsx +41 -55
- package/src/components/Chip/Chip.tsx +49 -84
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +2 -2
- package/src/components/CurrencyDisplay/CurrencyDisplay.tsx +4 -2
- package/src/components/CurrencyInput/CurrencyInput.tsx +2 -2
- package/src/components/DetailRow/DetailRow.tsx +9 -7
- package/src/components/EmptyState/EmptyState.tsx +2 -2
- package/src/components/Form/Form.tsx +149 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/IconButton/IconButton.tsx +24 -20
- package/src/components/Input/Input.tsx +63 -50
- package/src/components/LabelValue/LabelValue.tsx +6 -4
- package/src/components/ListGroup/ListGroup.tsx +145 -0
- package/src/components/ListGroup/index.ts +1 -0
- package/src/components/ListItem/ListItem.tsx +30 -43
- package/src/components/MediaCard/MediaCard.tsx +31 -29
- package/src/components/MenuGroup/MenuGroup.tsx +145 -0
- package/src/components/MenuGroup/index.ts +1 -0
- package/src/components/MenuItem/MenuItem.tsx +29 -40
- package/src/components/MonthPicker/MonthPicker.tsx +14 -4
- package/src/components/Pressable/Pressable.tsx +27 -46
- package/src/components/Progress/Progress.tsx +21 -12
- package/src/components/RadioGroup/RadioGroup.tsx +55 -32
- package/src/components/Select/Select.tsx +23 -21
- package/src/components/Separator/Separator.tsx +1 -3
- package/src/components/Sheet/Sheet.tsx +85 -18
- package/src/components/Skeleton/Skeleton.tsx +25 -14
- package/src/components/Slider/Slider.tsx +13 -3
- package/src/components/Spinner/Spinner.tsx +1 -1
- package/src/components/Switch/Switch.tsx +70 -52
- package/src/components/Tabs/Tabs.tsx +59 -47
- package/src/components/Text/Text.tsx +3 -1
- package/src/components/Textarea/Textarea.tsx +44 -23
- package/src/components/Toast/Toast.tsx +6 -6
- package/src/components/Toggle/Toggle.tsx +86 -68
- package/src/components/VirtualList/VirtualList.tsx +60 -0
- package/src/components/VirtualList/index.ts +1 -0
- package/src/fonts.ts +38 -20
- package/src/index.ts +5 -1
- package/src/theme/colors.ts +53 -39
- package/src/theme/types.ts +3 -0
- package/src/tokens.ts +49 -39
- package/src/utils/animations.ts +58 -0
- package/src/utils/icons.ts +47 -20
- package/src/utils/useColorTransition.ts +40 -0
- package/src/utils/usePressScale.ts +75 -0
- package/src/assets/fonts/Poppins-Black.ttf +0 -0
- package/src/assets/fonts/Poppins-BlackItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Bold.ttf +0 -0
- package/src/assets/fonts/Poppins-BoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLight.ttf +0 -0
- package/src/assets/fonts/Poppins-ExtraLightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Italic.ttf +0 -0
- package/src/assets/fonts/Poppins-Light.ttf +0 -0
- package/src/assets/fonts/Poppins-LightItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Medium.ttf +0 -0
- package/src/assets/fonts/Poppins-MediumItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Regular.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBold.ttf +0 -0
- package/src/assets/fonts/Poppins-SemiBoldItalic.ttf +0 -0
- package/src/assets/fonts/Poppins-Thin.ttf +0 -0
- package/src/assets/fonts/Poppins-ThinItalic.ttf +0 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { useColorTransition } from './chunk-7H2OR44A.mjs';
|
|
2
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
+
import { usePressScale } from './chunk-QCNARS3X.mjs';
|
|
4
|
+
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
5
|
+
import { PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
6
|
+
import { RADIUS } from './chunk-QY3X2UYR.mjs';
|
|
7
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
8
|
+
import { ms, s, vs } from './chunk-2CE3TQVY.mjs';
|
|
9
|
+
import React, { useCallback } from 'react';
|
|
10
|
+
import { TouchableOpacity, View, Text, StyleSheet, ScrollView } from 'react-native';
|
|
11
|
+
import Animated, { useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
|
|
12
|
+
|
|
13
|
+
var CategoryChip = React.memo(function CategoryChip2({
|
|
14
|
+
item,
|
|
15
|
+
selected,
|
|
16
|
+
onSelect
|
|
17
|
+
}) {
|
|
18
|
+
const { colors } = useTheme();
|
|
19
|
+
const { animatedStyle: scaleStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
20
|
+
pressScale: PRESS_SCALE.chip
|
|
21
|
+
});
|
|
22
|
+
const progress = useColorTransition(selected);
|
|
23
|
+
const surfaceStyle = useAnimatedStyle(() => ({
|
|
24
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], [colors.surface, colors.primary]),
|
|
25
|
+
borderColor: interpolateColor(progress.value, [0, 1], [colors.border, colors.primary])
|
|
26
|
+
}));
|
|
27
|
+
const textColorStyle = useAnimatedStyle(() => ({
|
|
28
|
+
color: interpolateColor(progress.value, [0, 1], [colors.foregroundSubtle, colors.primaryForeground])
|
|
29
|
+
}));
|
|
30
|
+
const iconColor = selected ? colors.primaryForeground : colors.foregroundSubtle;
|
|
31
|
+
const resolvedIcon = typeof item.icon === "string" ? renderIcon(item.icon, 16, iconColor) : item.icon ?? null;
|
|
32
|
+
return /* @__PURE__ */ React.createElement(Animated.View, { style: scaleStyle, ...hoverHandlers }, /* @__PURE__ */ React.createElement(
|
|
33
|
+
TouchableOpacity,
|
|
34
|
+
{
|
|
35
|
+
onPress: () => onSelect(item.value),
|
|
36
|
+
onPressIn,
|
|
37
|
+
onPressOut,
|
|
38
|
+
activeOpacity: 1,
|
|
39
|
+
touchSoundDisabled: true,
|
|
40
|
+
accessibilityRole: "button",
|
|
41
|
+
accessibilityLabel: item.label,
|
|
42
|
+
accessibilityState: { selected }
|
|
43
|
+
},
|
|
44
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.chip, surfaceStyle] }, resolvedIcon && /* @__PURE__ */ React.createElement(View, { style: styles.chipIcon }, resolvedIcon), /* @__PURE__ */ React.createElement(Animated.Text, { style: [styles.chipLabel, textColorStyle], allowFontScaling: true }, item.label), item.badge !== void 0 && item.badge > 0 && /* @__PURE__ */ React.createElement(View, { style: [styles.chipBadge, { backgroundColor: colors.primary }] }, /* @__PURE__ */ React.createElement(Text, { style: [styles.chipBadgeText, { color: colors.primaryForeground }] }, Math.min(item.badge, 99))))
|
|
45
|
+
));
|
|
46
|
+
});
|
|
47
|
+
function CategoryStrip({
|
|
48
|
+
categories,
|
|
49
|
+
value,
|
|
50
|
+
onValueChange,
|
|
51
|
+
multiSelect = false,
|
|
52
|
+
style,
|
|
53
|
+
itemStyle,
|
|
54
|
+
accessibilityLabel
|
|
55
|
+
}) {
|
|
56
|
+
const selected = Array.isArray(value) ? value : value ? [value] : [];
|
|
57
|
+
const handlePress = useCallback(
|
|
58
|
+
(v) => {
|
|
59
|
+
selectionAsync();
|
|
60
|
+
if (multiSelect) {
|
|
61
|
+
const current = Array.isArray(value) ? value : value ? [value] : [];
|
|
62
|
+
const next = current.includes(v) ? current.filter((x) => x !== v) : [...current, v];
|
|
63
|
+
onValueChange?.(next);
|
|
64
|
+
} else {
|
|
65
|
+
onValueChange?.(v === value ? "" : v);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
[multiSelect, value, onValueChange]
|
|
69
|
+
);
|
|
70
|
+
return /* @__PURE__ */ React.createElement(
|
|
71
|
+
ScrollView,
|
|
72
|
+
{
|
|
73
|
+
horizontal: true,
|
|
74
|
+
showsHorizontalScrollIndicator: false,
|
|
75
|
+
contentContainerStyle: [styles.container, style],
|
|
76
|
+
style: styles.scroll,
|
|
77
|
+
accessibilityRole: multiSelect ? void 0 : "radiogroup",
|
|
78
|
+
accessibilityLabel
|
|
79
|
+
},
|
|
80
|
+
categories.map((cat) => /* @__PURE__ */ React.createElement(View, { key: cat.value, style: itemStyle }, /* @__PURE__ */ React.createElement(
|
|
81
|
+
CategoryChip,
|
|
82
|
+
{
|
|
83
|
+
item: cat,
|
|
84
|
+
selected: selected.includes(cat.value),
|
|
85
|
+
onSelect: handlePress
|
|
86
|
+
}
|
|
87
|
+
)))
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
var styles = StyleSheet.create({
|
|
91
|
+
scroll: {
|
|
92
|
+
flexGrow: 0
|
|
93
|
+
},
|
|
94
|
+
container: {
|
|
95
|
+
flexDirection: "row",
|
|
96
|
+
gap: s(8),
|
|
97
|
+
paddingHorizontal: s(4),
|
|
98
|
+
paddingVertical: vs(4)
|
|
99
|
+
},
|
|
100
|
+
chip: {
|
|
101
|
+
flexDirection: "row",
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
borderRadius: RADIUS.full,
|
|
104
|
+
borderWidth: 1,
|
|
105
|
+
paddingHorizontal: s(14),
|
|
106
|
+
paddingVertical: vs(8),
|
|
107
|
+
gap: s(6)
|
|
108
|
+
},
|
|
109
|
+
chipIcon: {
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
justifyContent: "center"
|
|
112
|
+
},
|
|
113
|
+
chipLabel: {
|
|
114
|
+
fontFamily: "Sohne-Medium",
|
|
115
|
+
fontSize: ms(13)
|
|
116
|
+
},
|
|
117
|
+
chipBadge: {
|
|
118
|
+
minWidth: 16,
|
|
119
|
+
height: 16,
|
|
120
|
+
borderRadius: 9999,
|
|
121
|
+
paddingHorizontal: 3,
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
justifyContent: "center"
|
|
124
|
+
},
|
|
125
|
+
chipBadgeText: {
|
|
126
|
+
fontFamily: "Sohne-Bold",
|
|
127
|
+
fontSize: ms(9),
|
|
128
|
+
lineHeight: 14
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
export { CategoryStrip };
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { usePressScale } from './chunk-QCNARS3X.mjs';
|
|
2
|
+
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
3
|
+
import { PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
4
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
|
+
import { ms, vs, s } from './chunk-2CE3TQVY.mjs';
|
|
6
|
+
import React, { useState, useRef } from 'react';
|
|
7
|
+
import { Platform, StyleSheet, View, Text, TouchableOpacity, Modal } from 'react-native';
|
|
8
|
+
import Animated from 'react-native-reanimated';
|
|
9
|
+
import { Picker } from '@react-native-picker/picker';
|
|
10
|
+
import { Entypo } from '@expo/vector-icons';
|
|
11
|
+
|
|
12
|
+
var isIOS = Platform.OS === "ios";
|
|
13
|
+
var isAndroid = Platform.OS === "android";
|
|
14
|
+
var isWeb = Platform.OS === "web";
|
|
15
|
+
function Select({
|
|
16
|
+
options,
|
|
17
|
+
value,
|
|
18
|
+
onValueChange,
|
|
19
|
+
placeholder = "Select an option",
|
|
20
|
+
label,
|
|
21
|
+
error,
|
|
22
|
+
disabled,
|
|
23
|
+
style,
|
|
24
|
+
accessibilityLabel
|
|
25
|
+
}) {
|
|
26
|
+
const { colors } = useTheme();
|
|
27
|
+
const { animatedStyle, onPressIn, onPressOut } = usePressScale({
|
|
28
|
+
pressScale: PRESS_SCALE.button,
|
|
29
|
+
disabled
|
|
30
|
+
});
|
|
31
|
+
const [pickerVisible, setPickerVisible] = useState(false);
|
|
32
|
+
const [pendingValue, setPendingValue] = useState(value);
|
|
33
|
+
const pickerRef = useRef(null);
|
|
34
|
+
const selected = options.find((o) => o.value === value);
|
|
35
|
+
const handleOpen = () => {
|
|
36
|
+
if (disabled) return;
|
|
37
|
+
selectionAsync();
|
|
38
|
+
if (isIOS) {
|
|
39
|
+
setPendingValue(value);
|
|
40
|
+
setPickerVisible(true);
|
|
41
|
+
} else if (isAndroid) {
|
|
42
|
+
pickerRef.current?.focus?.();
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleDismiss = () => {
|
|
46
|
+
setPickerVisible(false);
|
|
47
|
+
};
|
|
48
|
+
const handleConfirm = () => {
|
|
49
|
+
if (pendingValue !== void 0 && pendingValue !== "") {
|
|
50
|
+
selectionAsync();
|
|
51
|
+
onValueChange?.(pendingValue);
|
|
52
|
+
}
|
|
53
|
+
setPickerVisible(false);
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, style] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, !isWeb ? /* @__PURE__ */ React.createElement(Animated.View, { style: [animatedStyle, { opacity: disabled ? 0.45 : 1 }] }, /* @__PURE__ */ React.createElement(
|
|
56
|
+
TouchableOpacity,
|
|
57
|
+
{
|
|
58
|
+
style: [
|
|
59
|
+
styles.trigger,
|
|
60
|
+
{
|
|
61
|
+
borderColor: error ? colors.destructive : colors.border,
|
|
62
|
+
backgroundColor: colors.background
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
onPress: handleOpen,
|
|
66
|
+
onPressIn,
|
|
67
|
+
onPressOut,
|
|
68
|
+
activeOpacity: 1,
|
|
69
|
+
touchSoundDisabled: true,
|
|
70
|
+
accessibilityRole: "combobox",
|
|
71
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
72
|
+
accessibilityValue: { text: selected?.label ?? placeholder },
|
|
73
|
+
accessibilityState: { disabled: !!disabled, expanded: pickerVisible }
|
|
74
|
+
},
|
|
75
|
+
/* @__PURE__ */ React.createElement(
|
|
76
|
+
Text,
|
|
77
|
+
{
|
|
78
|
+
style: [
|
|
79
|
+
styles.triggerText,
|
|
80
|
+
{ color: selected ? colors.foreground : colors.foregroundMuted }
|
|
81
|
+
],
|
|
82
|
+
numberOfLines: 1,
|
|
83
|
+
allowFontScaling: true
|
|
84
|
+
},
|
|
85
|
+
selected?.label ?? placeholder
|
|
86
|
+
),
|
|
87
|
+
/* @__PURE__ */ React.createElement(Entypo, { name: "chevron-down", size: 20, color: colors.foregroundMuted })
|
|
88
|
+
)) : null, isIOS ? /* @__PURE__ */ React.createElement(
|
|
89
|
+
Modal,
|
|
90
|
+
{
|
|
91
|
+
visible: pickerVisible,
|
|
92
|
+
transparent: true,
|
|
93
|
+
animationType: "slide",
|
|
94
|
+
onRequestClose: handleDismiss
|
|
95
|
+
},
|
|
96
|
+
/* @__PURE__ */ React.createElement(TouchableOpacity, { style: styles.iosBackdrop, activeOpacity: 1, onPress: handleDismiss }),
|
|
97
|
+
/* @__PURE__ */ React.createElement(View, { style: [styles.iosSheet, { backgroundColor: colors.card }] }, /* @__PURE__ */ React.createElement(View, { style: [styles.iosToolbar, { borderBottomColor: colors.border }] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.iosToolbarTitle, { color: colors.foreground }], allowFontScaling: true }, label) : /* @__PURE__ */ React.createElement(View, null), /* @__PURE__ */ React.createElement(TouchableOpacity, { onPress: handleConfirm, style: styles.iosDoneBtn, hitSlop: { top: 8, bottom: 8, left: 8, right: 8 } }, /* @__PURE__ */ React.createElement(Text, { style: [styles.iosDoneBtnText, { color: colors.primary }], allowFontScaling: true }, "Done"))), /* @__PURE__ */ React.createElement(
|
|
98
|
+
Picker,
|
|
99
|
+
{
|
|
100
|
+
selectedValue: pendingValue ?? "",
|
|
101
|
+
onValueChange: (val) => setPendingValue(val),
|
|
102
|
+
itemStyle: { color: colors.foreground }
|
|
103
|
+
},
|
|
104
|
+
!value ? /* @__PURE__ */ React.createElement(Picker.Item, { label: placeholder, value: "", color: colors.foregroundMuted, enabled: false }) : null,
|
|
105
|
+
options.map((o) => /* @__PURE__ */ React.createElement(
|
|
106
|
+
Picker.Item,
|
|
107
|
+
{
|
|
108
|
+
key: o.value,
|
|
109
|
+
label: o.label,
|
|
110
|
+
value: o.value,
|
|
111
|
+
enabled: !o.disabled,
|
|
112
|
+
color: o.disabled ? colors.foregroundMuted : colors.foreground
|
|
113
|
+
}
|
|
114
|
+
))
|
|
115
|
+
))
|
|
116
|
+
) : null, isAndroid ? /* @__PURE__ */ React.createElement(
|
|
117
|
+
Picker,
|
|
118
|
+
{
|
|
119
|
+
ref: pickerRef,
|
|
120
|
+
selectedValue: value ?? "",
|
|
121
|
+
onValueChange: (val) => {
|
|
122
|
+
if (val !== "") {
|
|
123
|
+
selectionAsync();
|
|
124
|
+
onValueChange?.(val);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
mode: "dialog",
|
|
128
|
+
enabled: !disabled,
|
|
129
|
+
prompt: label,
|
|
130
|
+
style: styles.androidHiddenPicker
|
|
131
|
+
},
|
|
132
|
+
!value ? /* @__PURE__ */ React.createElement(Picker.Item, { label: placeholder, value: "", enabled: false }) : null,
|
|
133
|
+
options.map((o) => /* @__PURE__ */ React.createElement(
|
|
134
|
+
Picker.Item,
|
|
135
|
+
{
|
|
136
|
+
key: o.value,
|
|
137
|
+
label: o.label,
|
|
138
|
+
value: o.value,
|
|
139
|
+
enabled: !o.disabled
|
|
140
|
+
}
|
|
141
|
+
))
|
|
142
|
+
) : null, isWeb ? /* @__PURE__ */ React.createElement(
|
|
143
|
+
Picker,
|
|
144
|
+
{
|
|
145
|
+
selectedValue: value ?? "",
|
|
146
|
+
onValueChange: (val) => {
|
|
147
|
+
if (val !== "") {
|
|
148
|
+
onValueChange?.(val);
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
enabled: !disabled,
|
|
152
|
+
style: [
|
|
153
|
+
styles.webPicker,
|
|
154
|
+
{
|
|
155
|
+
borderColor: error ? colors.destructive : colors.border,
|
|
156
|
+
color: selected ? colors.foreground : colors.foregroundMuted,
|
|
157
|
+
backgroundColor: colors.background,
|
|
158
|
+
opacity: disabled ? 0.45 : 1
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
/* @__PURE__ */ React.createElement(Picker.Item, { label: placeholder, value: "", enabled: false }),
|
|
163
|
+
options.map((o) => /* @__PURE__ */ React.createElement(
|
|
164
|
+
Picker.Item,
|
|
165
|
+
{
|
|
166
|
+
key: o.value,
|
|
167
|
+
label: o.label,
|
|
168
|
+
value: o.value,
|
|
169
|
+
enabled: !o.disabled
|
|
170
|
+
}
|
|
171
|
+
))
|
|
172
|
+
) : null, error ? /* @__PURE__ */ React.createElement(Text, { style: [styles.helperText, { color: colors.destructive }], allowFontScaling: true }, error) : null);
|
|
173
|
+
}
|
|
174
|
+
var styles = StyleSheet.create({
|
|
175
|
+
container: {
|
|
176
|
+
gap: vs(8)
|
|
177
|
+
},
|
|
178
|
+
label: {
|
|
179
|
+
fontFamily: "Sohne-Medium",
|
|
180
|
+
fontSize: ms(13)
|
|
181
|
+
},
|
|
182
|
+
trigger: {
|
|
183
|
+
flexDirection: "row",
|
|
184
|
+
alignItems: "center",
|
|
185
|
+
justifyContent: "space-between",
|
|
186
|
+
borderWidth: 1,
|
|
187
|
+
borderRadius: ms(8),
|
|
188
|
+
paddingHorizontal: s(14),
|
|
189
|
+
paddingVertical: vs(11)
|
|
190
|
+
},
|
|
191
|
+
triggerText: {
|
|
192
|
+
fontFamily: "Sohne-Regular",
|
|
193
|
+
fontSize: ms(15),
|
|
194
|
+
flex: 1
|
|
195
|
+
},
|
|
196
|
+
chevron: {
|
|
197
|
+
marginLeft: s(8)
|
|
198
|
+
},
|
|
199
|
+
helperText: {
|
|
200
|
+
fontFamily: "Sohne-Regular",
|
|
201
|
+
fontSize: ms(13)
|
|
202
|
+
},
|
|
203
|
+
iosBackdrop: {
|
|
204
|
+
flex: 1,
|
|
205
|
+
backgroundColor: "rgba(0,0,0,0.4)"
|
|
206
|
+
},
|
|
207
|
+
iosSheet: {
|
|
208
|
+
borderTopLeftRadius: ms(16),
|
|
209
|
+
borderTopRightRadius: ms(16),
|
|
210
|
+
paddingBottom: vs(32)
|
|
211
|
+
},
|
|
212
|
+
iosToolbar: {
|
|
213
|
+
flexDirection: "row",
|
|
214
|
+
alignItems: "center",
|
|
215
|
+
justifyContent: "space-between",
|
|
216
|
+
paddingHorizontal: s(16),
|
|
217
|
+
paddingVertical: vs(12),
|
|
218
|
+
borderBottomWidth: 1
|
|
219
|
+
},
|
|
220
|
+
iosToolbarTitle: {
|
|
221
|
+
fontFamily: "Sohne-SemiBold",
|
|
222
|
+
fontSize: ms(17)
|
|
223
|
+
},
|
|
224
|
+
iosDoneBtn: {
|
|
225
|
+
padding: s(4)
|
|
226
|
+
},
|
|
227
|
+
iosDoneBtnText: {
|
|
228
|
+
fontFamily: "Sohne-SemiBold",
|
|
229
|
+
fontSize: ms(17)
|
|
230
|
+
},
|
|
231
|
+
androidHiddenPicker: {
|
|
232
|
+
height: 0,
|
|
233
|
+
opacity: 0,
|
|
234
|
+
position: "absolute"
|
|
235
|
+
},
|
|
236
|
+
webPicker: {
|
|
237
|
+
borderWidth: 1,
|
|
238
|
+
borderRadius: ms(8),
|
|
239
|
+
paddingHorizontal: s(14),
|
|
240
|
+
paddingVertical: vs(11),
|
|
241
|
+
fontSize: ms(15)
|
|
242
|
+
}
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
export { Select };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Input } from './chunk-L7E7TVEZ.mjs';
|
|
2
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { ms, vs } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
function formatCurrency(raw, separator) {
|
|
8
|
+
const digits = raw.replace(/\D/g, "");
|
|
9
|
+
if (!digits) return "";
|
|
10
|
+
return digits.replace(/\B(?=(\d{3})+(?!\d))/g, separator);
|
|
11
|
+
}
|
|
12
|
+
function CurrencyInput({
|
|
13
|
+
value,
|
|
14
|
+
onChangeText,
|
|
15
|
+
onChangeValue,
|
|
16
|
+
prefix = "$",
|
|
17
|
+
thousandsSeparator = ".",
|
|
18
|
+
size = "default",
|
|
19
|
+
label,
|
|
20
|
+
error,
|
|
21
|
+
hint,
|
|
22
|
+
placeholder,
|
|
23
|
+
editable,
|
|
24
|
+
containerStyle,
|
|
25
|
+
style
|
|
26
|
+
}) {
|
|
27
|
+
const { colors } = useTheme();
|
|
28
|
+
const handleChange = (text) => {
|
|
29
|
+
const withoutPrefix = prefix && text.startsWith(prefix) ? text.slice(prefix.length) : text;
|
|
30
|
+
const formatted = formatCurrency(withoutPrefix, thousandsSeparator);
|
|
31
|
+
const display = formatted;
|
|
32
|
+
onChangeText?.(display);
|
|
33
|
+
const separatorRegex = new RegExp(`\\${thousandsSeparator}`, "g");
|
|
34
|
+
const raw = parseFloat(formatted.replace(separatorRegex, "") || "0");
|
|
35
|
+
onChangeValue?.(isNaN(raw) ? 0 : raw);
|
|
36
|
+
};
|
|
37
|
+
const inputStyle = size === "large" ? { fontFamily: "Sohne-Regular", fontSize: ms(36) } : { fontFamily: "Sohne-Regular" };
|
|
38
|
+
const dollarIcon = renderIcon("dollar-sign", size === "large" ? 24 : 16, colors.foregroundMuted);
|
|
39
|
+
const displayValue = value && prefix && value.startsWith(prefix) ? value.slice(prefix.length) : value;
|
|
40
|
+
return /* @__PURE__ */ React.createElement(
|
|
41
|
+
Input,
|
|
42
|
+
{
|
|
43
|
+
value: displayValue,
|
|
44
|
+
onChangeText: handleChange,
|
|
45
|
+
keyboardType: "numeric",
|
|
46
|
+
label,
|
|
47
|
+
error,
|
|
48
|
+
hint,
|
|
49
|
+
placeholder: placeholder ?? "0",
|
|
50
|
+
editable,
|
|
51
|
+
prefix: dollarIcon,
|
|
52
|
+
containerStyle,
|
|
53
|
+
inputWrapperStyle: size === "large" ? { paddingVertical: vs(16), minHeight: 72 } : void 0,
|
|
54
|
+
style: [inputStyle, style]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { CurrencyInput };
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { usePressScale } from './chunk-QCNARS3X.mjs';
|
|
2
|
+
import { impactLight } from './chunk-RTC3CFXF.mjs';
|
|
3
|
+
import { SPRINGS, PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
4
|
+
import { RADIUS } from './chunk-QY3X2UYR.mjs';
|
|
5
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
6
|
+
import { vs, s, mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { StyleSheet, View, TouchableOpacity, Text } from 'react-native';
|
|
9
|
+
import Animated from 'react-native-reanimated';
|
|
10
|
+
|
|
11
|
+
function Card({ children, variant = "elevated", onPress, style, accessibilityLabel }) {
|
|
12
|
+
const { colors } = useTheme();
|
|
13
|
+
const { animatedStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
14
|
+
pressScale: PRESS_SCALE.card,
|
|
15
|
+
pressInSpring: SPRINGS.surfacePressIn,
|
|
16
|
+
pressOutSpring: SPRINGS.surfacePressOut,
|
|
17
|
+
disabled: !onPress
|
|
18
|
+
});
|
|
19
|
+
const handlePress = () => {
|
|
20
|
+
if (!onPress) return;
|
|
21
|
+
impactLight();
|
|
22
|
+
onPress();
|
|
23
|
+
};
|
|
24
|
+
const variantStyle = {
|
|
25
|
+
elevated: {
|
|
26
|
+
backgroundColor: colors.card,
|
|
27
|
+
// AUDIT FIX: removed borderColor — shadow is the depth signal; a border on
|
|
28
|
+
// top of a shadow creates redundant double-framing that reads as "heavy"
|
|
29
|
+
// rather than "elevated". borderWidth: 0 overrides the base style's borderWidth: 1.
|
|
30
|
+
borderWidth: 0,
|
|
31
|
+
shadowColor: "#000",
|
|
32
|
+
shadowOffset: { width: 0, height: 4 },
|
|
33
|
+
shadowOpacity: 0.09,
|
|
34
|
+
shadowRadius: 14,
|
|
35
|
+
elevation: 4
|
|
36
|
+
},
|
|
37
|
+
outlined: {
|
|
38
|
+
backgroundColor: colors.card,
|
|
39
|
+
borderColor: colors.border,
|
|
40
|
+
shadowOpacity: 0,
|
|
41
|
+
elevation: 0
|
|
42
|
+
},
|
|
43
|
+
filled: {
|
|
44
|
+
backgroundColor: colors.surfaceStrong,
|
|
45
|
+
borderColor: colors.border,
|
|
46
|
+
shadowOpacity: 0,
|
|
47
|
+
elevation: 0
|
|
48
|
+
}
|
|
49
|
+
}[variant];
|
|
50
|
+
const cardContent = /* @__PURE__ */ React.createElement(View, { style: [styles.card, variantStyle, style] }, children);
|
|
51
|
+
if (onPress) {
|
|
52
|
+
return /* @__PURE__ */ React.createElement(Animated.View, { style: animatedStyle, ...hoverHandlers }, /* @__PURE__ */ React.createElement(
|
|
53
|
+
TouchableOpacity,
|
|
54
|
+
{
|
|
55
|
+
onPress: handlePress,
|
|
56
|
+
onPressIn,
|
|
57
|
+
onPressOut,
|
|
58
|
+
activeOpacity: 1,
|
|
59
|
+
touchSoundDisabled: true,
|
|
60
|
+
accessibilityRole: "button",
|
|
61
|
+
accessibilityLabel
|
|
62
|
+
},
|
|
63
|
+
cardContent
|
|
64
|
+
));
|
|
65
|
+
}
|
|
66
|
+
return cardContent;
|
|
67
|
+
}
|
|
68
|
+
function CardHeader({ children, style }) {
|
|
69
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.header, style] }, children);
|
|
70
|
+
}
|
|
71
|
+
function CardTitle({ children, style }) {
|
|
72
|
+
const { colors } = useTheme();
|
|
73
|
+
return /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }, style], allowFontScaling: true }, children);
|
|
74
|
+
}
|
|
75
|
+
function CardDescription({ children, style }) {
|
|
76
|
+
const { colors } = useTheme();
|
|
77
|
+
return /* @__PURE__ */ React.createElement(Text, { style: [styles.description, { color: colors.foregroundSubtle }, style], allowFontScaling: true }, children);
|
|
78
|
+
}
|
|
79
|
+
function CardContent({ children, style }) {
|
|
80
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.content, style] }, children);
|
|
81
|
+
}
|
|
82
|
+
function CardFooter({ children, style }) {
|
|
83
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.footer, style] }, children);
|
|
84
|
+
}
|
|
85
|
+
var styles = StyleSheet.create({
|
|
86
|
+
card: {
|
|
87
|
+
borderRadius: RADIUS.md,
|
|
88
|
+
borderWidth: 1
|
|
89
|
+
},
|
|
90
|
+
header: {
|
|
91
|
+
padding: s(16),
|
|
92
|
+
paddingBottom: 0,
|
|
93
|
+
gap: vs(4)
|
|
94
|
+
},
|
|
95
|
+
title: {
|
|
96
|
+
fontFamily: "Sohne-SemiBold",
|
|
97
|
+
fontSize: ms(16),
|
|
98
|
+
lineHeight: mvs(22)
|
|
99
|
+
},
|
|
100
|
+
// AUDIT FIX: was foregroundMuted (2.2:1 fail) — description text now uses
|
|
101
|
+
// foregroundSubtle (5.9:1 ✓) which is readable while still visually secondary.
|
|
102
|
+
description: {
|
|
103
|
+
fontFamily: "Sohne-Regular",
|
|
104
|
+
fontSize: ms(13),
|
|
105
|
+
lineHeight: mvs(18)
|
|
106
|
+
},
|
|
107
|
+
content: {
|
|
108
|
+
padding: s(16),
|
|
109
|
+
paddingTop: s(12)
|
|
110
|
+
},
|
|
111
|
+
footer: {
|
|
112
|
+
paddingHorizontal: s(16),
|
|
113
|
+
paddingBottom: vs(14),
|
|
114
|
+
paddingTop: 0,
|
|
115
|
+
flexDirection: "row",
|
|
116
|
+
alignItems: "center"
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { useColorTransition } from './chunk-7H2OR44A.mjs';
|
|
2
|
+
import { usePressScale } from './chunk-QCNARS3X.mjs';
|
|
3
|
+
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
4
|
+
import { PRESS_SCALE, SPRINGS } from './chunk-5IKW3VNC.mjs';
|
|
5
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
6
|
+
import { mvs, ms, s, vs } from './chunk-2CE3TQVY.mjs';
|
|
7
|
+
import React, { useEffect } from 'react';
|
|
8
|
+
import { StyleSheet, View, TouchableOpacity, Text } from 'react-native';
|
|
9
|
+
import Animated, { useSharedValue, withSpring, useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
|
|
10
|
+
|
|
11
|
+
function RadioItem({
|
|
12
|
+
option,
|
|
13
|
+
selected,
|
|
14
|
+
onSelect
|
|
15
|
+
}) {
|
|
16
|
+
const { colors } = useTheme();
|
|
17
|
+
const { animatedStyle: scaleStyle, onPressIn, onPressOut } = usePressScale({
|
|
18
|
+
pressScale: PRESS_SCALE.button,
|
|
19
|
+
disabled: option.disabled
|
|
20
|
+
});
|
|
21
|
+
const colorProgress = useColorTransition(selected);
|
|
22
|
+
const dotScale = useSharedValue(selected ? 1 : 0);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
dotScale.value = withSpring(selected ? 1 : 0, SPRINGS.elastic);
|
|
25
|
+
}, [selected, dotScale]);
|
|
26
|
+
const radioStyle = useAnimatedStyle(() => ({
|
|
27
|
+
borderColor: interpolateColor(colorProgress.value, [0, 1], [colors.border, colors.primary])
|
|
28
|
+
}));
|
|
29
|
+
const dotStyle = useAnimatedStyle(() => ({
|
|
30
|
+
transform: [{ scale: dotScale.value }],
|
|
31
|
+
opacity: dotScale.value
|
|
32
|
+
}));
|
|
33
|
+
return (
|
|
34
|
+
// AUDIT FIX: opacity was applied only to the radio circle, leaving the label
|
|
35
|
+
// at full opacity when disabled. The whole row now dims uniformly so users
|
|
36
|
+
// get a single, consistent disabled signal across the entire item.
|
|
37
|
+
/* @__PURE__ */ React.createElement(
|
|
38
|
+
TouchableOpacity,
|
|
39
|
+
{
|
|
40
|
+
style: [styles.row, option.disabled && styles.rowDisabled],
|
|
41
|
+
onPress: () => {
|
|
42
|
+
if (!option.disabled) {
|
|
43
|
+
selectionAsync();
|
|
44
|
+
onSelect();
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
onPressIn,
|
|
48
|
+
onPressOut,
|
|
49
|
+
activeOpacity: 1,
|
|
50
|
+
touchSoundDisabled: true,
|
|
51
|
+
disabled: option.disabled,
|
|
52
|
+
accessibilityRole: "radio",
|
|
53
|
+
accessibilityLabel: option.label,
|
|
54
|
+
accessibilityState: { checked: selected, disabled: !!option.disabled }
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: scaleStyle }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.radio, radioStyle] }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.dot, { backgroundColor: colors.primary }, dotStyle] }))),
|
|
57
|
+
/* @__PURE__ */ React.createElement(
|
|
58
|
+
Text,
|
|
59
|
+
{
|
|
60
|
+
style: [styles.label, { color: colors.foreground }],
|
|
61
|
+
allowFontScaling: true
|
|
62
|
+
},
|
|
63
|
+
option.label
|
|
64
|
+
)
|
|
65
|
+
)
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
function RadioGroup({
|
|
69
|
+
options,
|
|
70
|
+
value,
|
|
71
|
+
onValueChange,
|
|
72
|
+
orientation = "vertical",
|
|
73
|
+
style,
|
|
74
|
+
accessibilityLabel
|
|
75
|
+
}) {
|
|
76
|
+
return /* @__PURE__ */ React.createElement(
|
|
77
|
+
View,
|
|
78
|
+
{
|
|
79
|
+
style: [styles.container, orientation === "horizontal" && styles.horizontal, style],
|
|
80
|
+
accessibilityRole: "radiogroup",
|
|
81
|
+
accessibilityLabel
|
|
82
|
+
},
|
|
83
|
+
options.map((option) => /* @__PURE__ */ React.createElement(
|
|
84
|
+
RadioItem,
|
|
85
|
+
{
|
|
86
|
+
key: option.value,
|
|
87
|
+
option,
|
|
88
|
+
selected: option.value === value,
|
|
89
|
+
onSelect: () => onValueChange?.(option.value)
|
|
90
|
+
}
|
|
91
|
+
))
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
var styles = StyleSheet.create({
|
|
95
|
+
container: {
|
|
96
|
+
gap: vs(12)
|
|
97
|
+
},
|
|
98
|
+
horizontal: {
|
|
99
|
+
flexDirection: "row",
|
|
100
|
+
flexWrap: "wrap"
|
|
101
|
+
},
|
|
102
|
+
row: {
|
|
103
|
+
flexDirection: "row",
|
|
104
|
+
alignItems: "center",
|
|
105
|
+
gap: s(12)
|
|
106
|
+
},
|
|
107
|
+
// AUDIT FIX: was opacity on the inner circle only
|
|
108
|
+
rowDisabled: {
|
|
109
|
+
opacity: 0.45
|
|
110
|
+
},
|
|
111
|
+
radio: {
|
|
112
|
+
width: s(24),
|
|
113
|
+
height: s(24),
|
|
114
|
+
borderRadius: s(12),
|
|
115
|
+
borderWidth: 1.5,
|
|
116
|
+
alignItems: "center",
|
|
117
|
+
justifyContent: "center"
|
|
118
|
+
},
|
|
119
|
+
dot: {
|
|
120
|
+
width: s(10),
|
|
121
|
+
height: s(10),
|
|
122
|
+
borderRadius: s(5)
|
|
123
|
+
},
|
|
124
|
+
label: {
|
|
125
|
+
fontFamily: "Sohne-Regular",
|
|
126
|
+
fontSize: ms(14),
|
|
127
|
+
lineHeight: mvs(20)
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
export { RadioGroup };
|