@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,174 @@
|
|
|
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 { ms, s, mvs, vs } 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 ListItemBase({
|
|
14
|
+
leftRender,
|
|
15
|
+
rightRender,
|
|
16
|
+
trailing,
|
|
17
|
+
icon,
|
|
18
|
+
leftIcon,
|
|
19
|
+
rightIcon,
|
|
20
|
+
leftIconColor,
|
|
21
|
+
rightIconColor,
|
|
22
|
+
title,
|
|
23
|
+
subtitle,
|
|
24
|
+
caption,
|
|
25
|
+
variant = "plain",
|
|
26
|
+
showChevron = false,
|
|
27
|
+
showSeparator = false,
|
|
28
|
+
onPress,
|
|
29
|
+
disabled,
|
|
30
|
+
style,
|
|
31
|
+
titleStyle,
|
|
32
|
+
subtitleStyle,
|
|
33
|
+
captionStyle,
|
|
34
|
+
accessibilityLabel
|
|
35
|
+
}) {
|
|
36
|
+
const { colors } = useTheme();
|
|
37
|
+
const { animatedStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
38
|
+
pressScale: PRESS_SCALE.row,
|
|
39
|
+
pressInSpring: SPRINGS.surfacePressIn,
|
|
40
|
+
pressOutSpring: SPRINGS.surfacePressOut,
|
|
41
|
+
disabled: !onPress || disabled
|
|
42
|
+
});
|
|
43
|
+
const handlePress = () => {
|
|
44
|
+
selectionAsync();
|
|
45
|
+
onPress?.();
|
|
46
|
+
};
|
|
47
|
+
const effectiveLeft = leftIcon ? renderIcon(leftIcon, 24, leftIconColor ?? colors.foreground) : leftRender ?? icon;
|
|
48
|
+
const effectiveRight = rightIcon ? renderIcon(rightIcon, 24, rightIconColor ?? colors.foregroundMuted) : rightRender ?? trailing;
|
|
49
|
+
const cardStyle = variant === "card" ? {
|
|
50
|
+
backgroundColor: colors.card,
|
|
51
|
+
borderRadius: RADIUS.md,
|
|
52
|
+
borderWidth: 1,
|
|
53
|
+
borderColor: colors.border,
|
|
54
|
+
shadowColor: "#000",
|
|
55
|
+
shadowOffset: { width: 0, height: 2 },
|
|
56
|
+
shadowOpacity: 0.06,
|
|
57
|
+
shadowRadius: 6,
|
|
58
|
+
elevation: 2
|
|
59
|
+
} : {};
|
|
60
|
+
const a11yLabel = accessibilityLabel ?? [title, subtitle, caption].filter(Boolean).join(". ");
|
|
61
|
+
return /* @__PURE__ */ React.createElement(Animated.View, { style: [animatedStyle, disabled && styles.disabled], ...hoverHandlers }, /* @__PURE__ */ React.createElement(
|
|
62
|
+
TouchableOpacity,
|
|
63
|
+
{
|
|
64
|
+
style: [styles.container, cardStyle, style],
|
|
65
|
+
onPress: onPress ? handlePress : void 0,
|
|
66
|
+
onPressIn,
|
|
67
|
+
onPressOut,
|
|
68
|
+
disabled,
|
|
69
|
+
activeOpacity: 1,
|
|
70
|
+
touchSoundDisabled: true,
|
|
71
|
+
accessibilityRole: onPress ? "button" : void 0,
|
|
72
|
+
accessibilityLabel: onPress ? a11yLabel : void 0,
|
|
73
|
+
accessibilityState: onPress ? { disabled: !!disabled } : void 0
|
|
74
|
+
},
|
|
75
|
+
effectiveLeft ? /* @__PURE__ */ React.createElement(View, { style: styles.leftContainer }, effectiveLeft) : null,
|
|
76
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.content }, /* @__PURE__ */ React.createElement(
|
|
77
|
+
Text,
|
|
78
|
+
{
|
|
79
|
+
style: [styles.title, { color: colors.foreground }, titleStyle],
|
|
80
|
+
numberOfLines: 2,
|
|
81
|
+
allowFontScaling: true
|
|
82
|
+
},
|
|
83
|
+
title
|
|
84
|
+
), subtitle ? /* @__PURE__ */ React.createElement(
|
|
85
|
+
Text,
|
|
86
|
+
{
|
|
87
|
+
style: [styles.subtitle, { color: colors.foregroundMuted }, subtitleStyle],
|
|
88
|
+
numberOfLines: 2,
|
|
89
|
+
allowFontScaling: true
|
|
90
|
+
},
|
|
91
|
+
subtitle
|
|
92
|
+
) : null, caption ? /* @__PURE__ */ React.createElement(
|
|
93
|
+
Text,
|
|
94
|
+
{
|
|
95
|
+
style: [styles.caption, { color: colors.foregroundMuted }, captionStyle],
|
|
96
|
+
numberOfLines: 1,
|
|
97
|
+
allowFontScaling: true
|
|
98
|
+
},
|
|
99
|
+
caption
|
|
100
|
+
) : null),
|
|
101
|
+
effectiveRight !== void 0 ? /* @__PURE__ */ React.createElement(View, { style: styles.rightContainer }, typeof effectiveRight === "string" ? /* @__PURE__ */ React.createElement(
|
|
102
|
+
Text,
|
|
103
|
+
{
|
|
104
|
+
style: [styles.rightText, { color: colors.foregroundMuted }],
|
|
105
|
+
allowFontScaling: true
|
|
106
|
+
},
|
|
107
|
+
effectiveRight
|
|
108
|
+
) : effectiveRight) : showChevron ? /* @__PURE__ */ React.createElement(Entypo, { name: "chevron-with-circle-right", size: 20, color: colors.foregroundMuted }) : null
|
|
109
|
+
), showSeparator ? /* @__PURE__ */ React.createElement(
|
|
110
|
+
View,
|
|
111
|
+
{
|
|
112
|
+
style: [
|
|
113
|
+
styles.separator,
|
|
114
|
+
{ backgroundColor: colors.separator }
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
) : null);
|
|
118
|
+
}
|
|
119
|
+
var ListItem = React.memo(ListItemBase);
|
|
120
|
+
var styles = StyleSheet.create({
|
|
121
|
+
container: {
|
|
122
|
+
flexDirection: "row",
|
|
123
|
+
alignItems: "center",
|
|
124
|
+
paddingHorizontal: s(16),
|
|
125
|
+
paddingVertical: vs(10),
|
|
126
|
+
gap: s(12)
|
|
127
|
+
},
|
|
128
|
+
leftContainer: {
|
|
129
|
+
width: s(44),
|
|
130
|
+
height: s(44),
|
|
131
|
+
alignItems: "center",
|
|
132
|
+
justifyContent: "center",
|
|
133
|
+
flexShrink: 0
|
|
134
|
+
},
|
|
135
|
+
content: {
|
|
136
|
+
flex: 1,
|
|
137
|
+
gap: vs(4)
|
|
138
|
+
},
|
|
139
|
+
title: {
|
|
140
|
+
fontFamily: "Sohne-Medium",
|
|
141
|
+
fontSize: ms(15),
|
|
142
|
+
lineHeight: mvs(22)
|
|
143
|
+
},
|
|
144
|
+
subtitle: {
|
|
145
|
+
fontFamily: "Sohne-Regular",
|
|
146
|
+
fontSize: ms(13),
|
|
147
|
+
lineHeight: mvs(18)
|
|
148
|
+
},
|
|
149
|
+
caption: {
|
|
150
|
+
fontFamily: "Sohne-Regular",
|
|
151
|
+
fontSize: ms(12),
|
|
152
|
+
lineHeight: mvs(16),
|
|
153
|
+
opacity: 0.7
|
|
154
|
+
},
|
|
155
|
+
rightContainer: {
|
|
156
|
+
alignItems: "flex-end",
|
|
157
|
+
justifyContent: "center",
|
|
158
|
+
flexShrink: 0,
|
|
159
|
+
maxWidth: s(160)
|
|
160
|
+
},
|
|
161
|
+
rightText: {
|
|
162
|
+
fontFamily: "Sohne-Regular",
|
|
163
|
+
fontSize: ms(14)
|
|
164
|
+
},
|
|
165
|
+
separator: {
|
|
166
|
+
height: StyleSheet.hairlineWidth,
|
|
167
|
+
marginRight: 0
|
|
168
|
+
},
|
|
169
|
+
disabled: {
|
|
170
|
+
opacity: 0.45
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
export { ListItem };
|
|
@@ -0,0 +1,139 @@
|
|
|
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 { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
7
|
+
import { vs, s, ms } from './chunk-2CE3TQVY.mjs';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { StyleSheet, TouchableOpacity, View } from 'react-native';
|
|
10
|
+
import Animated, { useAnimatedStyle, interpolateColor } from 'react-native-reanimated';
|
|
11
|
+
import { FontAwesome5 } from '@expo/vector-icons';
|
|
12
|
+
|
|
13
|
+
function ToggleIcon({ pressed, iconName, activeIconName, icon, activeIcon, iconColor, activeIconColor, iconSize, primaryColor, mutedColor }) {
|
|
14
|
+
const renderProp = (prop) => {
|
|
15
|
+
if (!prop) return null;
|
|
16
|
+
if (typeof prop === "function") return prop(pressed);
|
|
17
|
+
return prop;
|
|
18
|
+
};
|
|
19
|
+
if (pressed) {
|
|
20
|
+
if (activeIconName) return /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(activeIconName, iconSize, activeIconColor ?? primaryColor));
|
|
21
|
+
const active = renderProp(activeIcon);
|
|
22
|
+
if (active) return /* @__PURE__ */ React.createElement(React.Fragment, null, active);
|
|
23
|
+
return /* @__PURE__ */ React.createElement(FontAwesome5, { name: "check-circle", size: iconSize, color: primaryColor });
|
|
24
|
+
}
|
|
25
|
+
if (iconName) return /* @__PURE__ */ React.createElement(React.Fragment, null, renderIcon(iconName, iconSize, iconColor ?? mutedColor));
|
|
26
|
+
const custom = renderProp(icon);
|
|
27
|
+
if (custom) return /* @__PURE__ */ React.createElement(React.Fragment, null, custom);
|
|
28
|
+
return /* @__PURE__ */ React.createElement(FontAwesome5, { name: "circle", size: iconSize, color: mutedColor });
|
|
29
|
+
}
|
|
30
|
+
var sizeStyles = {
|
|
31
|
+
sm: { paddingHorizontal: s(12), paddingVertical: vs(8), minWidth: s(40), minHeight: vs(40) },
|
|
32
|
+
md: { paddingHorizontal: s(16), paddingVertical: vs(12), minWidth: s(44), minHeight: vs(44) },
|
|
33
|
+
lg: { paddingHorizontal: s(20), paddingVertical: vs(14), minWidth: s(48), minHeight: vs(48) }
|
|
34
|
+
};
|
|
35
|
+
var iconSizeMap = { sm: 16, md: 18, lg: 20 };
|
|
36
|
+
function Toggle({
|
|
37
|
+
pressed = false,
|
|
38
|
+
onPressedChange,
|
|
39
|
+
variant = "default",
|
|
40
|
+
size = "md",
|
|
41
|
+
label,
|
|
42
|
+
icon,
|
|
43
|
+
activeIcon,
|
|
44
|
+
iconName,
|
|
45
|
+
activeIconName,
|
|
46
|
+
iconColor,
|
|
47
|
+
activeIconColor,
|
|
48
|
+
disabled,
|
|
49
|
+
style,
|
|
50
|
+
accessibilityLabel,
|
|
51
|
+
...props
|
|
52
|
+
}) {
|
|
53
|
+
const { colors } = useTheme();
|
|
54
|
+
const { animatedStyle: scaleStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
55
|
+
pressScale: PRESS_SCALE.button,
|
|
56
|
+
disabled
|
|
57
|
+
});
|
|
58
|
+
const progress = useColorTransition(pressed);
|
|
59
|
+
const inactiveBorder = variant === "outline" ? colors.border : "transparent";
|
|
60
|
+
const surfaceStyle = useAnimatedStyle(() => ({
|
|
61
|
+
borderColor: interpolateColor(progress.value, [0, 1], [inactiveBorder, colors.primary]),
|
|
62
|
+
backgroundColor: interpolateColor(progress.value, [0, 1], ["transparent", colors.surfaceStrong])
|
|
63
|
+
}));
|
|
64
|
+
const textStyle = useAnimatedStyle(() => ({
|
|
65
|
+
color: interpolateColor(progress.value, [0, 1], [colors.foreground, colors.primary])
|
|
66
|
+
}));
|
|
67
|
+
const iconSize = iconSizeMap[size];
|
|
68
|
+
return /* @__PURE__ */ React.createElement(
|
|
69
|
+
Animated.View,
|
|
70
|
+
{
|
|
71
|
+
style: [scaleStyle, disabled && styles.disabled, style],
|
|
72
|
+
...hoverHandlers
|
|
73
|
+
},
|
|
74
|
+
/* @__PURE__ */ React.createElement(
|
|
75
|
+
TouchableOpacity,
|
|
76
|
+
{
|
|
77
|
+
onPress: () => {
|
|
78
|
+
selectionAsync();
|
|
79
|
+
onPressedChange?.(!pressed);
|
|
80
|
+
},
|
|
81
|
+
onPressIn,
|
|
82
|
+
onPressOut,
|
|
83
|
+
disabled,
|
|
84
|
+
activeOpacity: 1,
|
|
85
|
+
touchSoundDisabled: true,
|
|
86
|
+
accessibilityRole: "button",
|
|
87
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
88
|
+
accessibilityState: { selected: pressed, disabled: !!disabled },
|
|
89
|
+
...props
|
|
90
|
+
},
|
|
91
|
+
/* @__PURE__ */ React.createElement(
|
|
92
|
+
Animated.View,
|
|
93
|
+
{
|
|
94
|
+
style: [
|
|
95
|
+
styles.base,
|
|
96
|
+
sizeStyles[size],
|
|
97
|
+
{ borderWidth: 2 },
|
|
98
|
+
surfaceStyle
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.inner }, /* @__PURE__ */ React.createElement(
|
|
102
|
+
ToggleIcon,
|
|
103
|
+
{
|
|
104
|
+
pressed,
|
|
105
|
+
iconName,
|
|
106
|
+
activeIconName,
|
|
107
|
+
icon,
|
|
108
|
+
activeIcon,
|
|
109
|
+
iconColor,
|
|
110
|
+
activeIconColor,
|
|
111
|
+
iconSize,
|
|
112
|
+
primaryColor: colors.primary,
|
|
113
|
+
mutedColor: colors.foregroundMuted
|
|
114
|
+
}
|
|
115
|
+
), label ? /* @__PURE__ */ React.createElement(Animated.Text, { style: [styles.label, textStyle], allowFontScaling: true }, label) : null)
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
var styles = StyleSheet.create({
|
|
121
|
+
base: {
|
|
122
|
+
borderRadius: ms(8)
|
|
123
|
+
},
|
|
124
|
+
inner: {
|
|
125
|
+
flexDirection: "row",
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
justifyContent: "center",
|
|
128
|
+
gap: s(8)
|
|
129
|
+
},
|
|
130
|
+
disabled: {
|
|
131
|
+
opacity: 0.45
|
|
132
|
+
},
|
|
133
|
+
label: {
|
|
134
|
+
fontFamily: "Sohne-Medium",
|
|
135
|
+
fontSize: ms(14)
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export { Toggle };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Button } from './chunk-CRYBX2CM.mjs';
|
|
2
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
4
|
+
import { s, vs, mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
7
|
+
|
|
8
|
+
function EmptyState({ icon, iconName, iconColor, title, description, action, actionLabel, onAction, size = "default", style }) {
|
|
9
|
+
const { colors } = useTheme();
|
|
10
|
+
const isCompact = size === "compact";
|
|
11
|
+
const effectiveIcon = iconName ? renderIcon(iconName, isCompact ? 32 : 48, iconColor ?? colors.foregroundMuted) : icon;
|
|
12
|
+
return /* @__PURE__ */ React.createElement(
|
|
13
|
+
View,
|
|
14
|
+
{
|
|
15
|
+
style: [
|
|
16
|
+
styles.container,
|
|
17
|
+
isCompact && styles.containerCompact,
|
|
18
|
+
{ borderColor: colors.border },
|
|
19
|
+
style
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
effectiveIcon ? /* @__PURE__ */ React.createElement(
|
|
23
|
+
View,
|
|
24
|
+
{
|
|
25
|
+
style: [
|
|
26
|
+
styles.iconWrapper,
|
|
27
|
+
isCompact && styles.iconWrapperCompact,
|
|
28
|
+
{ backgroundColor: colors.surface }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
effectiveIcon
|
|
32
|
+
) : null,
|
|
33
|
+
/* @__PURE__ */ React.createElement(View, { style: styles.textWrapper }, /* @__PURE__ */ React.createElement(
|
|
34
|
+
Text,
|
|
35
|
+
{
|
|
36
|
+
style: [styles.title, isCompact && styles.titleCompact, { color: colors.foreground }],
|
|
37
|
+
allowFontScaling: true
|
|
38
|
+
},
|
|
39
|
+
title
|
|
40
|
+
), description && !isCompact ? /* @__PURE__ */ React.createElement(Text, { style: [styles.description, { color: colors.foregroundMuted }], allowFontScaling: true }, description) : null),
|
|
41
|
+
!isCompact && (action ? /* @__PURE__ */ React.createElement(View, { style: styles.action }, action) : actionLabel && onAction ? /* @__PURE__ */ React.createElement(View, { style: styles.action }, /* @__PURE__ */ React.createElement(Button, { label: actionLabel, variant: "primary", onPress: onAction })) : null)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
var styles = StyleSheet.create({
|
|
45
|
+
container: {
|
|
46
|
+
alignItems: "center",
|
|
47
|
+
justifyContent: "center",
|
|
48
|
+
borderWidth: 1,
|
|
49
|
+
borderStyle: "dashed",
|
|
50
|
+
borderRadius: ms(12)
|
|
51
|
+
},
|
|
52
|
+
containerCompact: {},
|
|
53
|
+
iconWrapper: {
|
|
54
|
+
width: s(80),
|
|
55
|
+
height: s(80),
|
|
56
|
+
borderRadius: ms(20),
|
|
57
|
+
alignItems: "center",
|
|
58
|
+
justifyContent: "center",
|
|
59
|
+
marginTop: s(32)
|
|
60
|
+
},
|
|
61
|
+
iconWrapperCompact: {
|
|
62
|
+
width: s(56),
|
|
63
|
+
height: s(56),
|
|
64
|
+
borderRadius: ms(14),
|
|
65
|
+
marginTop: s(20)
|
|
66
|
+
},
|
|
67
|
+
textWrapper: {
|
|
68
|
+
alignItems: "center",
|
|
69
|
+
gap: vs(8),
|
|
70
|
+
maxWidth: s(320),
|
|
71
|
+
paddingHorizontal: s(32),
|
|
72
|
+
marginTop: vs(16)
|
|
73
|
+
},
|
|
74
|
+
title: {
|
|
75
|
+
fontFamily: "Sohne-Medium",
|
|
76
|
+
fontSize: ms(18),
|
|
77
|
+
textAlign: "center"
|
|
78
|
+
},
|
|
79
|
+
titleCompact: {
|
|
80
|
+
fontSize: ms(15),
|
|
81
|
+
marginTop: vs(10)
|
|
82
|
+
},
|
|
83
|
+
description: {
|
|
84
|
+
fontFamily: "Sohne-Regular",
|
|
85
|
+
fontSize: ms(14),
|
|
86
|
+
lineHeight: mvs(20),
|
|
87
|
+
textAlign: "center"
|
|
88
|
+
},
|
|
89
|
+
action: {
|
|
90
|
+
marginTop: vs(8),
|
|
91
|
+
marginBottom: s(32),
|
|
92
|
+
paddingHorizontal: s(32)
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export { EmptyState };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { StyleSheet, View } from 'react-native';
|
|
4
|
+
|
|
5
|
+
function Separator({ orientation = "horizontal", style }) {
|
|
6
|
+
const { colors } = useTheme();
|
|
7
|
+
return /* @__PURE__ */ React.createElement(
|
|
8
|
+
View,
|
|
9
|
+
{
|
|
10
|
+
style: [
|
|
11
|
+
orientation === "horizontal" ? styles.horizontal : styles.vertical,
|
|
12
|
+
{ backgroundColor: colors.separator },
|
|
13
|
+
style
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
var styles = StyleSheet.create({
|
|
19
|
+
horizontal: {
|
|
20
|
+
height: 1,
|
|
21
|
+
width: "100%"
|
|
22
|
+
},
|
|
23
|
+
vertical: {
|
|
24
|
+
width: 1,
|
|
25
|
+
height: "100%"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export { Separator };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
|
+
import { FlatList } from 'react-native';
|
|
3
|
+
|
|
4
|
+
// src/components/VirtualList/VirtualList.tsx
|
|
5
|
+
var defaultKeyExtractor = (item, index) => {
|
|
6
|
+
const id = item?.id;
|
|
7
|
+
return id !== void 0 ? String(id) : String(index);
|
|
8
|
+
};
|
|
9
|
+
function VirtualListInner({ itemHeight, keyExtractor, renderItem, ...props }, ref) {
|
|
10
|
+
const getItemLayout = useCallback(
|
|
11
|
+
(_data, index) => ({
|
|
12
|
+
length: itemHeight ?? 0,
|
|
13
|
+
offset: (itemHeight ?? 0) * index,
|
|
14
|
+
index
|
|
15
|
+
}),
|
|
16
|
+
[itemHeight]
|
|
17
|
+
);
|
|
18
|
+
return /* @__PURE__ */ React.createElement(
|
|
19
|
+
FlatList,
|
|
20
|
+
{
|
|
21
|
+
ref,
|
|
22
|
+
keyExtractor: keyExtractor ?? defaultKeyExtractor,
|
|
23
|
+
renderItem,
|
|
24
|
+
getItemLayout: itemHeight !== void 0 ? getItemLayout : void 0,
|
|
25
|
+
removeClippedSubviews: true,
|
|
26
|
+
...props
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
var VirtualList = React.forwardRef(VirtualListInner);
|
|
31
|
+
|
|
32
|
+
export { VirtualList };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { selectionAsync } from './chunk-RTC3CFXF.mjs';
|
|
2
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
3
|
+
import { vs, ms } from './chunk-2CE3TQVY.mjs';
|
|
4
|
+
import React, { useRef } from 'react';
|
|
5
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
6
|
+
import RNSlider from '@react-native-community/slider';
|
|
7
|
+
|
|
8
|
+
function Slider({
|
|
9
|
+
value = 0,
|
|
10
|
+
minimumValue = 0,
|
|
11
|
+
maximumValue = 1,
|
|
12
|
+
step = 0,
|
|
13
|
+
onValueChange,
|
|
14
|
+
onSlidingComplete,
|
|
15
|
+
label,
|
|
16
|
+
showValue = false,
|
|
17
|
+
formatValue = (v) => v.toFixed(2),
|
|
18
|
+
accessibilityLabel,
|
|
19
|
+
disabled,
|
|
20
|
+
style
|
|
21
|
+
}) {
|
|
22
|
+
const { colors } = useTheme();
|
|
23
|
+
const lastSteppedValue = useRef(value);
|
|
24
|
+
const handleValueChange = (v) => {
|
|
25
|
+
if (step && v !== lastSteppedValue.current) {
|
|
26
|
+
lastSteppedValue.current = v;
|
|
27
|
+
selectionAsync();
|
|
28
|
+
}
|
|
29
|
+
onValueChange?.(v);
|
|
30
|
+
};
|
|
31
|
+
return /* @__PURE__ */ React.createElement(
|
|
32
|
+
View,
|
|
33
|
+
{
|
|
34
|
+
style: [styles.wrapper, style],
|
|
35
|
+
accessibilityRole: "adjustable",
|
|
36
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
37
|
+
accessibilityValue: {
|
|
38
|
+
min: minimumValue,
|
|
39
|
+
max: maximumValue,
|
|
40
|
+
now: value,
|
|
41
|
+
text: formatValue(value)
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
label || showValue ? /* @__PURE__ */ React.createElement(View, { style: styles.header }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, showValue ? /* @__PURE__ */ React.createElement(Text, { style: [styles.valueText, { color: colors.foregroundMuted }], allowFontScaling: true }, formatValue(value)) : null) : null,
|
|
45
|
+
/* @__PURE__ */ React.createElement(View, { style: disabled ? styles.disabled : void 0 }, /* @__PURE__ */ React.createElement(
|
|
46
|
+
RNSlider,
|
|
47
|
+
{
|
|
48
|
+
value,
|
|
49
|
+
minimumValue,
|
|
50
|
+
maximumValue,
|
|
51
|
+
step: step || 0,
|
|
52
|
+
disabled,
|
|
53
|
+
onValueChange: handleValueChange,
|
|
54
|
+
onSlidingComplete,
|
|
55
|
+
minimumTrackTintColor: colors.primary,
|
|
56
|
+
maximumTrackTintColor: colors.surface,
|
|
57
|
+
thumbTintColor: colors.primary,
|
|
58
|
+
style: styles.slider,
|
|
59
|
+
accessibilityLabel
|
|
60
|
+
}
|
|
61
|
+
))
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
var styles = StyleSheet.create({
|
|
65
|
+
wrapper: {
|
|
66
|
+
gap: vs(8)
|
|
67
|
+
},
|
|
68
|
+
header: {
|
|
69
|
+
flexDirection: "row",
|
|
70
|
+
justifyContent: "space-between",
|
|
71
|
+
alignItems: "center"
|
|
72
|
+
},
|
|
73
|
+
label: {
|
|
74
|
+
fontFamily: "Sohne-Medium",
|
|
75
|
+
fontSize: ms(15)
|
|
76
|
+
},
|
|
77
|
+
valueText: {
|
|
78
|
+
fontFamily: "Sohne-Medium",
|
|
79
|
+
fontSize: ms(14)
|
|
80
|
+
},
|
|
81
|
+
slider: {
|
|
82
|
+
width: "100%",
|
|
83
|
+
height: vs(60)
|
|
84
|
+
},
|
|
85
|
+
disabled: {
|
|
86
|
+
opacity: 0.45
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export { Slider };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PRESS_SCALE, SPRINGS } from './chunk-5IKW3VNC.mjs';
|
|
2
|
+
import { useState, useCallback } from 'react';
|
|
3
|
+
import { Platform } from 'react-native';
|
|
4
|
+
import { useSharedValue, withSpring, useAnimatedStyle } from 'react-native-reanimated';
|
|
5
|
+
|
|
6
|
+
function useHover() {
|
|
7
|
+
const [hovered, setHovered] = useState(false);
|
|
8
|
+
const onMouseEnter = useCallback(() => setHovered(true), []);
|
|
9
|
+
const onMouseLeave = useCallback(() => setHovered(false), []);
|
|
10
|
+
if (Platform.OS !== "web") {
|
|
11
|
+
return { hovered: false, hoverHandlers: {} };
|
|
12
|
+
}
|
|
13
|
+
return { hovered, hoverHandlers: { onMouseEnter, onMouseLeave } };
|
|
14
|
+
}
|
|
15
|
+
function usePressScale({
|
|
16
|
+
pressScale = PRESS_SCALE.button,
|
|
17
|
+
hoverScale = 1.02,
|
|
18
|
+
pressInSpring = SPRINGS.pressIn,
|
|
19
|
+
pressOutSpring = SPRINGS.pressOut,
|
|
20
|
+
disabled = false
|
|
21
|
+
} = {}) {
|
|
22
|
+
const scale = useSharedValue(1);
|
|
23
|
+
const { hovered, hoverHandlers } = useHover();
|
|
24
|
+
const onPressIn = useCallback(() => {
|
|
25
|
+
if (disabled) return;
|
|
26
|
+
scale.value = withSpring(pressScale, pressInSpring);
|
|
27
|
+
}, [disabled, pressScale, pressInSpring, scale]);
|
|
28
|
+
const onPressOut = useCallback(() => {
|
|
29
|
+
if (disabled) return;
|
|
30
|
+
scale.value = withSpring(1, pressOutSpring);
|
|
31
|
+
}, [disabled, pressOutSpring, scale]);
|
|
32
|
+
const hoverActive = Platform.OS === "web" && hovered && hoverScale !== 1 && !disabled;
|
|
33
|
+
const animatedStyle = useAnimatedStyle(() => ({
|
|
34
|
+
transform: [
|
|
35
|
+
{ scale: scale.value * (hoverActive ? hoverScale : 1) }
|
|
36
|
+
]
|
|
37
|
+
}));
|
|
38
|
+
return {
|
|
39
|
+
animatedStyle,
|
|
40
|
+
onPressIn,
|
|
41
|
+
onPressOut,
|
|
42
|
+
hoverHandlers
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export { useHover, usePressScale };
|