@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,106 @@
|
|
|
1
|
+
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
2
|
+
import { SPRINGS, EASINGS, TIMINGS } from './chunk-5IKW3VNC.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { s } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React, { useEffect } from 'react';
|
|
6
|
+
import { StyleSheet, View, TouchableOpacity } from 'react-native';
|
|
7
|
+
import Animated, { useSharedValue, withSpring, useAnimatedStyle, interpolateColor, withTiming } from 'react-native-reanimated';
|
|
8
|
+
import { Feather } from '@expo/vector-icons';
|
|
9
|
+
|
|
10
|
+
var TRACK_WIDTH = s(52);
|
|
11
|
+
var TRACK_HEIGHT = s(30);
|
|
12
|
+
var THUMB_SIZE = s(24);
|
|
13
|
+
var THUMB_OFFSET = s(3);
|
|
14
|
+
var THUMB_TRAVEL = TRACK_WIDTH - THUMB_SIZE - THUMB_OFFSET * 2;
|
|
15
|
+
var ICON_SIZE = s(13);
|
|
16
|
+
function Switch({ checked = false, onCheckedChange, disabled, style, accessibilityLabel }) {
|
|
17
|
+
const { colors } = useTheme();
|
|
18
|
+
const progress = useSharedValue(checked ? 1 : 0);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
progress.value = withSpring(checked ? 1 : 0, SPRINGS.elastic);
|
|
21
|
+
}, [checked, progress]);
|
|
22
|
+
const thumbStyle = useAnimatedStyle(() => ({
|
|
23
|
+
transform: [{ translateX: progress.value * THUMB_TRAVEL }]
|
|
24
|
+
}));
|
|
25
|
+
const trackStyle = useAnimatedStyle(() => ({
|
|
26
|
+
backgroundColor: interpolateColor(
|
|
27
|
+
progress.value,
|
|
28
|
+
[0, 1],
|
|
29
|
+
[colors.surfaceStrong, colors.primary]
|
|
30
|
+
)
|
|
31
|
+
}));
|
|
32
|
+
const trackBorderStyle = useAnimatedStyle(() => ({
|
|
33
|
+
borderWidth: 1.5,
|
|
34
|
+
borderColor: interpolateColor(
|
|
35
|
+
progress.value,
|
|
36
|
+
[0, 1],
|
|
37
|
+
[colors.border, "transparent"]
|
|
38
|
+
)
|
|
39
|
+
}));
|
|
40
|
+
const checkIconStyle = useAnimatedStyle(() => ({
|
|
41
|
+
opacity: withTiming(checked ? 1 : 0, { duration: TIMINGS.state.duration, easing: EASINGS.standard })
|
|
42
|
+
}));
|
|
43
|
+
const crossIconStyle = useAnimatedStyle(() => ({
|
|
44
|
+
opacity: withTiming(checked ? 0 : 1, { duration: TIMINGS.state.duration, easing: EASINGS.standard })
|
|
45
|
+
}));
|
|
46
|
+
return /* @__PURE__ */ React.createElement(View, { style: [{ opacity: disabled ? 0.45 : 1, alignSelf: "flex-start" }, style] }, /* @__PURE__ */ React.createElement(
|
|
47
|
+
TouchableOpacity,
|
|
48
|
+
{
|
|
49
|
+
onPress: () => {
|
|
50
|
+
selectionAsync();
|
|
51
|
+
onCheckedChange?.(!checked);
|
|
52
|
+
},
|
|
53
|
+
disabled,
|
|
54
|
+
activeOpacity: 0.8,
|
|
55
|
+
touchSoundDisabled: true,
|
|
56
|
+
accessibilityRole: "switch",
|
|
57
|
+
accessibilityLabel,
|
|
58
|
+
accessibilityState: { checked, disabled: !!disabled },
|
|
59
|
+
style: styles.touchable
|
|
60
|
+
},
|
|
61
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.track, trackStyle] }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.trackBorder, trackBorderStyle], pointerEvents: "none" }), /* @__PURE__ */ React.createElement(
|
|
62
|
+
Animated.View,
|
|
63
|
+
{
|
|
64
|
+
style: [styles.thumb, { backgroundColor: colors.primaryForeground }, thumbStyle]
|
|
65
|
+
},
|
|
66
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.iconWrapper, checkIconStyle] }, /* @__PURE__ */ React.createElement(Feather, { name: "check", size: ICON_SIZE, color: colors.primary })),
|
|
67
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.iconWrapper, crossIconStyle] }, /* @__PURE__ */ React.createElement(Feather, { name: "x", size: ICON_SIZE, color: colors.foregroundMuted }))
|
|
68
|
+
))
|
|
69
|
+
));
|
|
70
|
+
}
|
|
71
|
+
var styles = StyleSheet.create({
|
|
72
|
+
touchable: {
|
|
73
|
+
alignSelf: "flex-start"
|
|
74
|
+
},
|
|
75
|
+
track: {
|
|
76
|
+
width: TRACK_WIDTH,
|
|
77
|
+
height: TRACK_HEIGHT,
|
|
78
|
+
borderRadius: TRACK_HEIGHT / 2
|
|
79
|
+
},
|
|
80
|
+
trackBorder: {
|
|
81
|
+
...StyleSheet.absoluteFillObject,
|
|
82
|
+
borderRadius: TRACK_HEIGHT / 2
|
|
83
|
+
},
|
|
84
|
+
thumb: {
|
|
85
|
+
position: "absolute",
|
|
86
|
+
top: THUMB_OFFSET,
|
|
87
|
+
left: THUMB_OFFSET,
|
|
88
|
+
width: THUMB_SIZE,
|
|
89
|
+
height: THUMB_SIZE,
|
|
90
|
+
borderRadius: THUMB_SIZE / 2,
|
|
91
|
+
shadowColor: "#000",
|
|
92
|
+
shadowOffset: { width: 0, height: 1 },
|
|
93
|
+
shadowOpacity: 0.15,
|
|
94
|
+
shadowRadius: 2,
|
|
95
|
+
elevation: 2,
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
justifyContent: "center"
|
|
98
|
+
},
|
|
99
|
+
iconWrapper: {
|
|
100
|
+
position: "absolute",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
justifyContent: "center"
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export { Switch };
|
|
@@ -0,0 +1,97 @@
|
|
|
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, EASINGS, TIMINGS } from './chunk-5IKW3VNC.mjs';
|
|
5
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
6
|
+
import { mvs, ms, vs, s } from './chunk-2CE3TQVY.mjs';
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { StyleSheet, TouchableOpacity, View, Text } from 'react-native';
|
|
9
|
+
import Animated, { useAnimatedStyle, interpolateColor, withTiming } from 'react-native-reanimated';
|
|
10
|
+
|
|
11
|
+
function Checkbox({
|
|
12
|
+
checked = false,
|
|
13
|
+
onCheckedChange,
|
|
14
|
+
label,
|
|
15
|
+
disabled,
|
|
16
|
+
style,
|
|
17
|
+
accessibilityLabel
|
|
18
|
+
}) {
|
|
19
|
+
const { colors } = useTheme();
|
|
20
|
+
const { animatedStyle: scaleStyle, onPressIn, onPressOut } = usePressScale({
|
|
21
|
+
pressScale: PRESS_SCALE.button,
|
|
22
|
+
disabled
|
|
23
|
+
});
|
|
24
|
+
const progress = useColorTransition(checked);
|
|
25
|
+
const boxStyle = useAnimatedStyle(() => ({
|
|
26
|
+
borderColor: interpolateColor(progress.value, [0, 1], [colors.border, colors.primary]),
|
|
27
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], ["transparent", colors.primary])
|
|
28
|
+
}));
|
|
29
|
+
const checkStyle = useAnimatedStyle(() => ({
|
|
30
|
+
opacity: withTiming(checked ? 1 : 0, { duration: TIMINGS.state.duration, easing: EASINGS.standard })
|
|
31
|
+
}));
|
|
32
|
+
return (
|
|
33
|
+
// AUDIT FIX: opacity was applied only to the box, leaving the label at full
|
|
34
|
+
// opacity when disabled — a contradictory visual signal. Now the entire row
|
|
35
|
+
// dims uniformly so label and control communicate the same disabled state.
|
|
36
|
+
/* @__PURE__ */ React.createElement(
|
|
37
|
+
TouchableOpacity,
|
|
38
|
+
{
|
|
39
|
+
style: [styles.row, disabled && styles.rowDisabled, style],
|
|
40
|
+
onPress: () => {
|
|
41
|
+
selectionAsync();
|
|
42
|
+
onCheckedChange?.(!checked);
|
|
43
|
+
},
|
|
44
|
+
onPressIn,
|
|
45
|
+
onPressOut,
|
|
46
|
+
disabled,
|
|
47
|
+
activeOpacity: 1,
|
|
48
|
+
touchSoundDisabled: true,
|
|
49
|
+
accessibilityRole: "checkbox",
|
|
50
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
51
|
+
accessibilityState: { checked, disabled: !!disabled }
|
|
52
|
+
},
|
|
53
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: scaleStyle }, /* @__PURE__ */ React.createElement(Animated.View, { style: [styles.box, boxStyle] }, /* @__PURE__ */ React.createElement(Animated.View, { style: checkStyle }, /* @__PURE__ */ React.createElement(View, { style: [styles.checkmark, { borderColor: colors.primaryForeground }] })))),
|
|
54
|
+
label ? /* @__PURE__ */ React.createElement(
|
|
55
|
+
Text,
|
|
56
|
+
{
|
|
57
|
+
style: [styles.label, { color: colors.foreground }],
|
|
58
|
+
allowFontScaling: true
|
|
59
|
+
},
|
|
60
|
+
label
|
|
61
|
+
) : null
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
var styles = StyleSheet.create({
|
|
66
|
+
row: {
|
|
67
|
+
flexDirection: "row",
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
gap: s(12)
|
|
70
|
+
},
|
|
71
|
+
// AUDIT FIX: was inline opacity on the box only
|
|
72
|
+
rowDisabled: {
|
|
73
|
+
opacity: 0.45
|
|
74
|
+
},
|
|
75
|
+
box: {
|
|
76
|
+
width: s(24),
|
|
77
|
+
height: s(24),
|
|
78
|
+
borderRadius: ms(4),
|
|
79
|
+
borderWidth: 1.5,
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center"
|
|
82
|
+
},
|
|
83
|
+
checkmark: {
|
|
84
|
+
width: s(12),
|
|
85
|
+
height: vs(7),
|
|
86
|
+
borderLeftWidth: 2,
|
|
87
|
+
borderBottomWidth: 2,
|
|
88
|
+
transform: [{ rotate: "-45deg" }, { translateY: -1 }]
|
|
89
|
+
},
|
|
90
|
+
label: {
|
|
91
|
+
fontFamily: "Sohne-Regular",
|
|
92
|
+
fontSize: ms(14),
|
|
93
|
+
lineHeight: mvs(20)
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
export { Checkbox };
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import { s, ms } from './chunk-2CE3TQVY.mjs';
|
|
3
|
+
import React, { useState } from 'react';
|
|
4
|
+
import { StyleSheet, View, Image, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
var sizeMap = {
|
|
7
|
+
sm: s(28),
|
|
8
|
+
md: s(40),
|
|
9
|
+
lg: s(56),
|
|
10
|
+
xl: s(72)
|
|
11
|
+
};
|
|
12
|
+
var fontSizeMap = {
|
|
13
|
+
sm: ms(12),
|
|
14
|
+
md: ms(16),
|
|
15
|
+
lg: ms(22),
|
|
16
|
+
xl: ms(28)
|
|
17
|
+
};
|
|
18
|
+
var statusSizeMap = {
|
|
19
|
+
sm: 8,
|
|
20
|
+
md: 10,
|
|
21
|
+
lg: 13,
|
|
22
|
+
xl: 16
|
|
23
|
+
};
|
|
24
|
+
function getInitials(fallback, fallbackText) {
|
|
25
|
+
if (fallback) return fallback.slice(0, 2).toUpperCase();
|
|
26
|
+
if (fallbackText) {
|
|
27
|
+
const words = fallbackText.trim().split(/\s+/);
|
|
28
|
+
if (words.length === 1) return words[0].slice(0, 2).toUpperCase();
|
|
29
|
+
return (words[0][0] + words[words.length - 1][0]).toUpperCase();
|
|
30
|
+
}
|
|
31
|
+
return "?";
|
|
32
|
+
}
|
|
33
|
+
function AvatarBase({ src, fallback, fallbackText, size = "md", status, style }) {
|
|
34
|
+
const { colors } = useTheme();
|
|
35
|
+
const [imageError, setImageError] = useState(false);
|
|
36
|
+
const dimension = typeof size === "number" ? size : sizeMap[size];
|
|
37
|
+
const fontSize = typeof size === "number" ? size * 0.38 : fontSizeMap[size];
|
|
38
|
+
const showFallback = !src || imageError;
|
|
39
|
+
const statusSize = typeof size === "number" ? size * 0.25 : statusSizeMap[size];
|
|
40
|
+
const statusColor = {
|
|
41
|
+
online: "#22c55e",
|
|
42
|
+
offline: "transparent",
|
|
43
|
+
busy: colors.destructive,
|
|
44
|
+
away: colors.warning
|
|
45
|
+
};
|
|
46
|
+
const containerStyle = {
|
|
47
|
+
width: dimension,
|
|
48
|
+
height: dimension,
|
|
49
|
+
borderRadius: dimension / 2,
|
|
50
|
+
backgroundColor: colors.surface,
|
|
51
|
+
overflow: "hidden"
|
|
52
|
+
};
|
|
53
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.wrapper, style] }, /* @__PURE__ */ React.createElement(View, { style: [styles.base, containerStyle] }, !showFallback ? /* @__PURE__ */ React.createElement(
|
|
54
|
+
Image,
|
|
55
|
+
{
|
|
56
|
+
source: { uri: src },
|
|
57
|
+
style: { width: dimension, height: dimension },
|
|
58
|
+
onError: () => setImageError(true)
|
|
59
|
+
}
|
|
60
|
+
) : /* @__PURE__ */ React.createElement(
|
|
61
|
+
Text,
|
|
62
|
+
{
|
|
63
|
+
style: [styles.fallback, { color: colors.foregroundMuted, fontSize }],
|
|
64
|
+
allowFontScaling: true
|
|
65
|
+
},
|
|
66
|
+
getInitials(fallback, fallbackText)
|
|
67
|
+
)), status && /* @__PURE__ */ React.createElement(
|
|
68
|
+
View,
|
|
69
|
+
{
|
|
70
|
+
style: [
|
|
71
|
+
styles.statusDot,
|
|
72
|
+
{
|
|
73
|
+
width: statusSize,
|
|
74
|
+
height: statusSize,
|
|
75
|
+
borderRadius: statusSize / 2,
|
|
76
|
+
backgroundColor: statusColor[status],
|
|
77
|
+
borderWidth: status === "offline" ? 2 : 1.5,
|
|
78
|
+
borderColor: status === "offline" ? colors.border : colors.background
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
));
|
|
83
|
+
}
|
|
84
|
+
var Avatar = React.memo(AvatarBase);
|
|
85
|
+
var styles = StyleSheet.create({
|
|
86
|
+
wrapper: {
|
|
87
|
+
alignSelf: "flex-start",
|
|
88
|
+
position: "relative"
|
|
89
|
+
},
|
|
90
|
+
base: {
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
justifyContent: "center"
|
|
93
|
+
},
|
|
94
|
+
fallback: {
|
|
95
|
+
fontFamily: "Sohne-Medium"
|
|
96
|
+
},
|
|
97
|
+
statusDot: {
|
|
98
|
+
position: "absolute",
|
|
99
|
+
bottom: 0,
|
|
100
|
+
right: 0
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
export { Avatar };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { TYPOGRAPHY } from './chunk-QY3X2UYR.mjs';
|
|
2
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
3
|
+
import { mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { Text as Text$1 } from 'react-native';
|
|
6
|
+
|
|
7
|
+
var variantStyles = {
|
|
8
|
+
"display-hero": { ...TYPOGRAPHY["display-hero"], fontSize: ms(TYPOGRAPHY["display-hero"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-hero"].lineHeight) },
|
|
9
|
+
"display-xl": { ...TYPOGRAPHY["display-xl"], fontSize: ms(TYPOGRAPHY["display-xl"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-xl"].lineHeight) },
|
|
10
|
+
"display-lg": { ...TYPOGRAPHY["display-lg"], fontSize: ms(TYPOGRAPHY["display-lg"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-lg"].lineHeight) },
|
|
11
|
+
"display-md": { ...TYPOGRAPHY["display-md"], fontSize: ms(TYPOGRAPHY["display-md"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-md"].lineHeight) },
|
|
12
|
+
"display-sm": { ...TYPOGRAPHY["display-sm"], fontSize: ms(TYPOGRAPHY["display-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["display-sm"].lineHeight) },
|
|
13
|
+
"title-md": { ...TYPOGRAPHY["title-md"], fontSize: ms(TYPOGRAPHY["title-md"].fontSize), lineHeight: mvs(TYPOGRAPHY["title-md"].lineHeight) },
|
|
14
|
+
"title-sm": { ...TYPOGRAPHY["title-sm"], fontSize: ms(TYPOGRAPHY["title-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["title-sm"].lineHeight) },
|
|
15
|
+
"body-md": { ...TYPOGRAPHY["body-md"], fontSize: ms(TYPOGRAPHY["body-md"].fontSize), lineHeight: mvs(TYPOGRAPHY["body-md"].lineHeight) },
|
|
16
|
+
"body-sm": { ...TYPOGRAPHY["body-sm"], fontSize: ms(TYPOGRAPHY["body-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["body-sm"].lineHeight) },
|
|
17
|
+
caption: { ...TYPOGRAPHY["caption"], fontSize: ms(TYPOGRAPHY["caption"].fontSize), lineHeight: mvs(TYPOGRAPHY["caption"].lineHeight) },
|
|
18
|
+
"caption-sm": { ...TYPOGRAPHY["caption-sm"], fontSize: ms(TYPOGRAPHY["caption-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["caption-sm"].lineHeight) },
|
|
19
|
+
"badge-text": { ...TYPOGRAPHY["badge-text"], fontSize: ms(TYPOGRAPHY["badge-text"].fontSize), lineHeight: mvs(TYPOGRAPHY["badge-text"].lineHeight) },
|
|
20
|
+
"micro-label": { ...TYPOGRAPHY["micro-label"], fontSize: ms(TYPOGRAPHY["micro-label"].fontSize), lineHeight: mvs(TYPOGRAPHY["micro-label"].lineHeight) },
|
|
21
|
+
"uppercase-tag": { ...TYPOGRAPHY["uppercase-tag"], fontSize: ms(TYPOGRAPHY["uppercase-tag"].fontSize), lineHeight: mvs(TYPOGRAPHY["uppercase-tag"].lineHeight) },
|
|
22
|
+
"button-lg": { ...TYPOGRAPHY["button-lg"], fontSize: ms(TYPOGRAPHY["button-lg"].fontSize), lineHeight: mvs(TYPOGRAPHY["button-lg"].lineHeight) },
|
|
23
|
+
"button-sm": { ...TYPOGRAPHY["button-sm"], fontSize: ms(TYPOGRAPHY["button-sm"].fontSize), lineHeight: mvs(TYPOGRAPHY["button-sm"].lineHeight) }
|
|
24
|
+
};
|
|
25
|
+
var defaultColorVariant = {
|
|
26
|
+
"display-hero": "foreground",
|
|
27
|
+
"display-xl": "foreground",
|
|
28
|
+
"display-lg": "foreground",
|
|
29
|
+
"display-md": "foreground",
|
|
30
|
+
"display-sm": "foreground",
|
|
31
|
+
"title-md": "foreground",
|
|
32
|
+
"title-sm": "foreground",
|
|
33
|
+
"body-md": "foregroundSubtle",
|
|
34
|
+
// running text — slightly softer
|
|
35
|
+
"body-sm": "foregroundSubtle",
|
|
36
|
+
caption: "foregroundMuted",
|
|
37
|
+
"caption-sm": "foregroundMuted",
|
|
38
|
+
"badge-text": "foreground",
|
|
39
|
+
"micro-label": "foreground",
|
|
40
|
+
"uppercase-tag": "foregroundMuted",
|
|
41
|
+
"button-lg": "foreground",
|
|
42
|
+
"button-sm": "foreground"
|
|
43
|
+
};
|
|
44
|
+
function TextBase({ variant = "body-md", color, style, children, ...props }) {
|
|
45
|
+
const { colors } = useTheme();
|
|
46
|
+
const colorKey = defaultColorVariant[variant] ?? "foreground";
|
|
47
|
+
const resolvedColor = color ?? colors[colorKey];
|
|
48
|
+
return /* @__PURE__ */ React.createElement(
|
|
49
|
+
Text$1,
|
|
50
|
+
{
|
|
51
|
+
style: [variantStyles[variant], { color: resolvedColor }, style],
|
|
52
|
+
allowFontScaling: true,
|
|
53
|
+
...props
|
|
54
|
+
},
|
|
55
|
+
children
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
var Text = React.memo(TextBase);
|
|
59
|
+
|
|
60
|
+
export { Text };
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
2
|
+
import { usePressScale } from './chunk-QCNARS3X.mjs';
|
|
3
|
+
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
4
|
+
import { SPRINGS, PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
5
|
+
import { RADIUS } from './chunk-QY3X2UYR.mjs';
|
|
6
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
7
|
+
import { vs, ms, s } from './chunk-2CE3TQVY.mjs';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { StyleSheet, TouchableOpacity, View, Text } from 'react-native';
|
|
10
|
+
import Animated from 'react-native-reanimated';
|
|
11
|
+
import { Entypo } from '@expo/vector-icons';
|
|
12
|
+
|
|
13
|
+
function MenuItemBase({
|
|
14
|
+
label,
|
|
15
|
+
subtitle,
|
|
16
|
+
iconName,
|
|
17
|
+
icon,
|
|
18
|
+
iconColor,
|
|
19
|
+
rightRender,
|
|
20
|
+
showChevron = true,
|
|
21
|
+
onPress,
|
|
22
|
+
disabled = false,
|
|
23
|
+
variant = "plain",
|
|
24
|
+
showSeparator = false,
|
|
25
|
+
style,
|
|
26
|
+
labelStyle,
|
|
27
|
+
accessibilityLabel
|
|
28
|
+
}) {
|
|
29
|
+
const { colors } = useTheme();
|
|
30
|
+
const { animatedStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
31
|
+
pressScale: PRESS_SCALE.row,
|
|
32
|
+
pressInSpring: SPRINGS.surfacePressIn,
|
|
33
|
+
pressOutSpring: SPRINGS.surfacePressOut,
|
|
34
|
+
disabled
|
|
35
|
+
});
|
|
36
|
+
const handlePress = () => {
|
|
37
|
+
selectionAsync();
|
|
38
|
+
onPress();
|
|
39
|
+
};
|
|
40
|
+
const resolvedIcon = iconName ? renderIcon(iconName, 22, iconColor ?? colors.foreground) : icon;
|
|
41
|
+
const cardStyle = variant === "card" ? {
|
|
42
|
+
backgroundColor: colors.card,
|
|
43
|
+
borderRadius: RADIUS.md,
|
|
44
|
+
borderWidth: 1,
|
|
45
|
+
borderColor: colors.border,
|
|
46
|
+
shadowColor: "#000",
|
|
47
|
+
shadowOffset: { width: 0, height: 2 },
|
|
48
|
+
shadowOpacity: 0.06,
|
|
49
|
+
shadowRadius: 6,
|
|
50
|
+
elevation: 2
|
|
51
|
+
} : {};
|
|
52
|
+
const a11yLabel = accessibilityLabel ?? (subtitle ? `${label}. ${subtitle}` : label);
|
|
53
|
+
return /* @__PURE__ */ React.createElement(Animated.View, { style: [animatedStyle, disabled && styles.disabled], ...hoverHandlers }, /* @__PURE__ */ React.createElement(
|
|
54
|
+
TouchableOpacity,
|
|
55
|
+
{
|
|
56
|
+
style: [styles.container, cardStyle, style],
|
|
57
|
+
onPress: handlePress,
|
|
58
|
+
onPressIn,
|
|
59
|
+
onPressOut,
|
|
60
|
+
disabled,
|
|
61
|
+
activeOpacity: 1,
|
|
62
|
+
touchSoundDisabled: true,
|
|
63
|
+
accessibilityRole: "button",
|
|
64
|
+
accessibilityLabel: a11yLabel,
|
|
65
|
+
accessibilityState: { disabled }
|
|
66
|
+
},
|
|
67
|
+
resolvedIcon ? /* @__PURE__ */ React.createElement(View, { style: styles.iconContainer }, resolvedIcon) : null,
|
|
68
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.labelContainer }, /* @__PURE__ */ React.createElement(
|
|
69
|
+
Text,
|
|
70
|
+
{
|
|
71
|
+
style: [styles.label, { color: colors.foreground }, labelStyle],
|
|
72
|
+
numberOfLines: 1,
|
|
73
|
+
allowFontScaling: true
|
|
74
|
+
},
|
|
75
|
+
label
|
|
76
|
+
), subtitle ? /* @__PURE__ */ React.createElement(
|
|
77
|
+
Text,
|
|
78
|
+
{
|
|
79
|
+
style: [styles.subtitle, { color: colors.foregroundMuted }],
|
|
80
|
+
numberOfLines: 1,
|
|
81
|
+
allowFontScaling: true
|
|
82
|
+
},
|
|
83
|
+
subtitle
|
|
84
|
+
) : null),
|
|
85
|
+
rightRender !== void 0 ? /* @__PURE__ */ React.createElement(
|
|
86
|
+
View,
|
|
87
|
+
{
|
|
88
|
+
style: styles.rightContainer,
|
|
89
|
+
onStartShouldSetResponder: () => true,
|
|
90
|
+
onResponderRelease: () => {
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
rightRender
|
|
94
|
+
) : showChevron ? /* @__PURE__ */ React.createElement(Entypo, { name: "chevron-right", size: 18, color: colors.foregroundMuted }) : null
|
|
95
|
+
), showSeparator ? /* @__PURE__ */ React.createElement(
|
|
96
|
+
View,
|
|
97
|
+
{
|
|
98
|
+
style: [
|
|
99
|
+
styles.separator,
|
|
100
|
+
{ backgroundColor: colors.separator }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
) : null);
|
|
104
|
+
}
|
|
105
|
+
var MenuItem = React.memo(MenuItemBase);
|
|
106
|
+
var styles = StyleSheet.create({
|
|
107
|
+
container: {
|
|
108
|
+
flexDirection: "row",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
paddingHorizontal: s(16),
|
|
111
|
+
paddingVertical: vs(16),
|
|
112
|
+
minHeight: vs(54),
|
|
113
|
+
gap: s(12)
|
|
114
|
+
},
|
|
115
|
+
iconContainer: {
|
|
116
|
+
width: s(22),
|
|
117
|
+
alignItems: "center",
|
|
118
|
+
justifyContent: "center",
|
|
119
|
+
flexShrink: 0
|
|
120
|
+
},
|
|
121
|
+
labelContainer: {
|
|
122
|
+
flex: 1,
|
|
123
|
+
justifyContent: "center"
|
|
124
|
+
},
|
|
125
|
+
label: {
|
|
126
|
+
fontFamily: "Sohne-Medium",
|
|
127
|
+
fontSize: ms(15)
|
|
128
|
+
},
|
|
129
|
+
subtitle: {
|
|
130
|
+
fontFamily: "Sohne-Regular",
|
|
131
|
+
fontSize: ms(12),
|
|
132
|
+
marginTop: vs(1)
|
|
133
|
+
},
|
|
134
|
+
rightContainer: {
|
|
135
|
+
alignItems: "flex-end",
|
|
136
|
+
justifyContent: "center",
|
|
137
|
+
flexShrink: 0
|
|
138
|
+
},
|
|
139
|
+
separator: {
|
|
140
|
+
height: StyleSheet.hairlineWidth,
|
|
141
|
+
marginRight: 0
|
|
142
|
+
},
|
|
143
|
+
disabled: {
|
|
144
|
+
opacity: 0.45
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export { MenuItem };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { Button } from './chunk-CRYBX2CM.mjs';
|
|
2
|
+
import { impactMedium, notificationSuccess, selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { vs, mvs, ms, s } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React, { useRef, useEffect } from 'react';
|
|
6
|
+
import { StyleSheet, Text, View } from 'react-native';
|
|
7
|
+
import { BottomSheetModal, BottomSheetView, BottomSheetBackdrop } from '@gorhom/bottom-sheet';
|
|
8
|
+
import { Feather } from '@expo/vector-icons';
|
|
9
|
+
|
|
10
|
+
function ConfirmDialog({
|
|
11
|
+
visible,
|
|
12
|
+
title,
|
|
13
|
+
description,
|
|
14
|
+
confirmLabel = "Confirm",
|
|
15
|
+
cancelLabel = "Cancel",
|
|
16
|
+
confirmVariant = "primary",
|
|
17
|
+
onConfirm,
|
|
18
|
+
onCancel
|
|
19
|
+
}) {
|
|
20
|
+
const { colors } = useTheme();
|
|
21
|
+
const ref = useRef(null);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (visible) {
|
|
24
|
+
impactMedium();
|
|
25
|
+
ref.current?.present();
|
|
26
|
+
} else {
|
|
27
|
+
ref.current?.dismiss();
|
|
28
|
+
}
|
|
29
|
+
}, [visible]);
|
|
30
|
+
const renderBackdrop = (props) => /* @__PURE__ */ React.createElement(
|
|
31
|
+
BottomSheetBackdrop,
|
|
32
|
+
{
|
|
33
|
+
...props,
|
|
34
|
+
disappearsOnIndex: -1,
|
|
35
|
+
appearsOnIndex: 0,
|
|
36
|
+
pressBehavior: "close"
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
return /* @__PURE__ */ React.createElement(
|
|
40
|
+
BottomSheetModal,
|
|
41
|
+
{
|
|
42
|
+
ref,
|
|
43
|
+
enableDynamicSizing: true,
|
|
44
|
+
onDismiss: onCancel,
|
|
45
|
+
backdropComponent: renderBackdrop,
|
|
46
|
+
backgroundStyle: [styles.background, { backgroundColor: colors.card }],
|
|
47
|
+
handleIndicatorStyle: [styles.handle, { backgroundColor: colors.border }],
|
|
48
|
+
enablePanDownToClose: true
|
|
49
|
+
},
|
|
50
|
+
/* @__PURE__ */ React.createElement(BottomSheetView, { style: styles.content }, /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title), description ? /* @__PURE__ */ React.createElement(Text, { style: [styles.description, { color: colors.foregroundMuted }], allowFontScaling: true }, description) : null, /* @__PURE__ */ React.createElement(View, { style: styles.actions }, /* @__PURE__ */ React.createElement(
|
|
51
|
+
Button,
|
|
52
|
+
{
|
|
53
|
+
label: confirmLabel,
|
|
54
|
+
variant: confirmVariant,
|
|
55
|
+
fullWidth: true,
|
|
56
|
+
onPress: () => {
|
|
57
|
+
notificationSuccess();
|
|
58
|
+
onConfirm();
|
|
59
|
+
},
|
|
60
|
+
icon: /* @__PURE__ */ React.createElement(
|
|
61
|
+
Feather,
|
|
62
|
+
{
|
|
63
|
+
name: confirmVariant === "destructive" ? "trash-2" : "check",
|
|
64
|
+
size: 15,
|
|
65
|
+
color: confirmVariant === "destructive" ? colors.destructiveForeground : colors.primaryForeground
|
|
66
|
+
}
|
|
67
|
+
)
|
|
68
|
+
}
|
|
69
|
+
), /* @__PURE__ */ React.createElement(
|
|
70
|
+
Button,
|
|
71
|
+
{
|
|
72
|
+
label: cancelLabel,
|
|
73
|
+
variant: "secondary",
|
|
74
|
+
fullWidth: true,
|
|
75
|
+
onPress: () => {
|
|
76
|
+
selectionAsync();
|
|
77
|
+
onCancel();
|
|
78
|
+
},
|
|
79
|
+
icon: /* @__PURE__ */ React.createElement(Feather, { name: "x", size: 15, color: colors.foreground })
|
|
80
|
+
}
|
|
81
|
+
)))
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
var styles = StyleSheet.create({
|
|
85
|
+
background: {
|
|
86
|
+
borderTopLeftRadius: ms(16),
|
|
87
|
+
borderTopRightRadius: ms(16)
|
|
88
|
+
},
|
|
89
|
+
handle: {
|
|
90
|
+
width: s(36),
|
|
91
|
+
height: vs(4),
|
|
92
|
+
borderRadius: ms(2)
|
|
93
|
+
},
|
|
94
|
+
content: {
|
|
95
|
+
paddingHorizontal: s(24),
|
|
96
|
+
paddingBottom: vs(32),
|
|
97
|
+
gap: vs(12)
|
|
98
|
+
},
|
|
99
|
+
title: {
|
|
100
|
+
fontFamily: "Sohne-SemiBold",
|
|
101
|
+
fontSize: ms(18),
|
|
102
|
+
lineHeight: mvs(26)
|
|
103
|
+
},
|
|
104
|
+
description: {
|
|
105
|
+
fontFamily: "Sohne-Regular",
|
|
106
|
+
fontSize: ms(15),
|
|
107
|
+
lineHeight: mvs(22)
|
|
108
|
+
},
|
|
109
|
+
actions: {
|
|
110
|
+
gap: vs(10),
|
|
111
|
+
marginTop: vs(8)
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export { ConfirmDialog };
|