@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,127 @@
|
|
|
1
|
+
import { useColorTransition } from './chunk-7H2OR44A.mjs';
|
|
2
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
3
|
+
import { TIMINGS } from './chunk-5IKW3VNC.mjs';
|
|
4
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
5
|
+
import { vs, ms, s } from './chunk-2CE3TQVY.mjs';
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
import { Platform, StyleSheet, View, Text, TextInput } from 'react-native';
|
|
8
|
+
import Animated, { useAnimatedStyle, interpolate, interpolateColor } from 'react-native-reanimated';
|
|
9
|
+
|
|
10
|
+
var webInputResetStyle = Platform.OS === "web" ? { outlineStyle: "none", outlineWidth: 0, outlineColor: "transparent", boxShadow: "none" } : {};
|
|
11
|
+
function Textarea({
|
|
12
|
+
label,
|
|
13
|
+
error,
|
|
14
|
+
hint,
|
|
15
|
+
rows = 4,
|
|
16
|
+
prefixIcon,
|
|
17
|
+
prefixIconNode,
|
|
18
|
+
prefixIconColor,
|
|
19
|
+
containerStyle,
|
|
20
|
+
style,
|
|
21
|
+
onFocus,
|
|
22
|
+
onBlur,
|
|
23
|
+
accessibilityLabel,
|
|
24
|
+
...props
|
|
25
|
+
}) {
|
|
26
|
+
const { colors } = useTheme();
|
|
27
|
+
const [focused, setFocused] = useState(false);
|
|
28
|
+
const focusProgress = useColorTransition(focused, {
|
|
29
|
+
duration: focused ? TIMINGS.focusIn.duration : TIMINGS.focusOut.duration
|
|
30
|
+
});
|
|
31
|
+
const resolvedPrefixIcon = prefixIcon ? renderIcon(prefixIcon, ms(16), prefixIconColor ?? colors.foregroundMuted) : prefixIconNode;
|
|
32
|
+
const borderAnimStyle = useAnimatedStyle(() => ({
|
|
33
|
+
borderColor: error ? colors.destructive : interpolateColor(focusProgress.value, [0, 1], [colors.border, colors.primary]),
|
|
34
|
+
borderWidth: error ? 2 : interpolate(focusProgress.value, [0, 1], [1, 2])
|
|
35
|
+
}));
|
|
36
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, containerStyle] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foreground }], allowFontScaling: true }, label) : null, /* @__PURE__ */ React.createElement(
|
|
37
|
+
Animated.View,
|
|
38
|
+
{
|
|
39
|
+
style: [
|
|
40
|
+
styles.inputWrapper,
|
|
41
|
+
{ backgroundColor: colors.background }
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
/* @__PURE__ */ React.createElement(Animated.View, { style: [styles.borderOverlay, borderAnimStyle], pointerEvents: "none" }),
|
|
45
|
+
resolvedPrefixIcon ? /* @__PURE__ */ React.createElement(View, { style: styles.prefixIcon }, resolvedPrefixIcon) : null,
|
|
46
|
+
/* @__PURE__ */ React.createElement(
|
|
47
|
+
TextInput,
|
|
48
|
+
{
|
|
49
|
+
multiline: true,
|
|
50
|
+
numberOfLines: rows,
|
|
51
|
+
textAlignVertical: "top",
|
|
52
|
+
style: [
|
|
53
|
+
styles.input,
|
|
54
|
+
{
|
|
55
|
+
color: colors.foreground,
|
|
56
|
+
minHeight: rows * vs(30)
|
|
57
|
+
},
|
|
58
|
+
webInputResetStyle,
|
|
59
|
+
style
|
|
60
|
+
],
|
|
61
|
+
onFocus: (e) => {
|
|
62
|
+
setFocused(true);
|
|
63
|
+
onFocus?.(e);
|
|
64
|
+
},
|
|
65
|
+
onBlur: (e) => {
|
|
66
|
+
setFocused(false);
|
|
67
|
+
onBlur?.(e);
|
|
68
|
+
},
|
|
69
|
+
placeholderTextColor: colors.foregroundMuted,
|
|
70
|
+
allowFontScaling: true,
|
|
71
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
72
|
+
...props
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
), error ? /* @__PURE__ */ React.createElement(
|
|
76
|
+
Text,
|
|
77
|
+
{
|
|
78
|
+
style: [styles.helperText, { color: colors.destructive }],
|
|
79
|
+
allowFontScaling: true,
|
|
80
|
+
accessibilityLiveRegion: "polite"
|
|
81
|
+
},
|
|
82
|
+
error
|
|
83
|
+
) : null, !error && hint ? /* @__PURE__ */ React.createElement(Text, { style: [styles.helperText, { color: colors.foregroundMuted }], allowFontScaling: true }, hint) : null);
|
|
84
|
+
}
|
|
85
|
+
var styles = StyleSheet.create({
|
|
86
|
+
container: {
|
|
87
|
+
gap: vs(4)
|
|
88
|
+
},
|
|
89
|
+
label: {
|
|
90
|
+
fontFamily: "Sohne-Medium",
|
|
91
|
+
fontSize: ms(13),
|
|
92
|
+
lineHeight: vs(18),
|
|
93
|
+
marginBottom: vs(2)
|
|
94
|
+
},
|
|
95
|
+
inputWrapper: {
|
|
96
|
+
// Border lives on borderOverlay (absolute); wrapper carries none so the
|
|
97
|
+
// focus weight change never reflows content.
|
|
98
|
+
borderRadius: 8,
|
|
99
|
+
paddingHorizontal: s(14),
|
|
100
|
+
paddingVertical: vs(11),
|
|
101
|
+
gap: s(8)
|
|
102
|
+
},
|
|
103
|
+
borderOverlay: {
|
|
104
|
+
...StyleSheet.absoluteFillObject,
|
|
105
|
+
borderRadius: 8
|
|
106
|
+
},
|
|
107
|
+
prefixIcon: {
|
|
108
|
+
alignItems: "flex-start",
|
|
109
|
+
justifyContent: "flex-start",
|
|
110
|
+
paddingTop: vs(2)
|
|
111
|
+
},
|
|
112
|
+
input: {
|
|
113
|
+
fontFamily: "Sohne-Regular",
|
|
114
|
+
fontSize: ms(14),
|
|
115
|
+
lineHeight: vs(22),
|
|
116
|
+
padding: 0,
|
|
117
|
+
margin: 0
|
|
118
|
+
},
|
|
119
|
+
helperText: {
|
|
120
|
+
fontFamily: "Sohne-Regular",
|
|
121
|
+
fontSize: ms(12),
|
|
122
|
+
lineHeight: vs(16),
|
|
123
|
+
marginTop: vs(4)
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
export { Textarea };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import { vs, s } from './chunk-2CE3TQVY.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
function Form({ children, style }) {
|
|
7
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.form, style] }, children);
|
|
8
|
+
}
|
|
9
|
+
function FormField({
|
|
10
|
+
children,
|
|
11
|
+
label,
|
|
12
|
+
error,
|
|
13
|
+
required,
|
|
14
|
+
style,
|
|
15
|
+
labelStyle,
|
|
16
|
+
errorStyle
|
|
17
|
+
}) {
|
|
18
|
+
const { colors } = useTheme();
|
|
19
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.field, style] }, label ? /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foreground }, labelStyle], allowFontScaling: true }, label, required ? /* @__PURE__ */ React.createElement(Text, { style: { color: colors.destructive } }, " *") : null) : null, children, error ? /* @__PURE__ */ React.createElement(Text, { style: [styles.error, { color: colors.destructive }, errorStyle], allowFontScaling: true }, error) : null);
|
|
20
|
+
}
|
|
21
|
+
function FormSection({ children, title, description, style }) {
|
|
22
|
+
const { colors } = useTheme();
|
|
23
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.section, style] }, title ? /* @__PURE__ */ React.createElement(View, { style: styles.sectionHeader }, /* @__PURE__ */ React.createElement(Text, { style: [styles.sectionTitle, { color: colors.foreground }], allowFontScaling: true }, title), description ? /* @__PURE__ */ React.createElement(Text, { style: [styles.sectionDescription, { color: colors.foregroundMuted }], allowFontScaling: true }, description) : null) : null, children);
|
|
24
|
+
}
|
|
25
|
+
function FormFooter({ children, style }) {
|
|
26
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.footer, style] }, children);
|
|
27
|
+
}
|
|
28
|
+
Form.Field = FormField;
|
|
29
|
+
Form.Section = FormSection;
|
|
30
|
+
Form.Footer = FormFooter;
|
|
31
|
+
var styles = StyleSheet.create({
|
|
32
|
+
form: {
|
|
33
|
+
gap: vs(16)
|
|
34
|
+
},
|
|
35
|
+
field: {
|
|
36
|
+
gap: vs(6)
|
|
37
|
+
},
|
|
38
|
+
label: {
|
|
39
|
+
fontFamily: "Sohne-Medium",
|
|
40
|
+
fontSize: 14,
|
|
41
|
+
lineHeight: 20
|
|
42
|
+
},
|
|
43
|
+
error: {
|
|
44
|
+
fontFamily: "Sohne-Regular",
|
|
45
|
+
fontSize: 12,
|
|
46
|
+
lineHeight: 16
|
|
47
|
+
},
|
|
48
|
+
section: {
|
|
49
|
+
gap: vs(16)
|
|
50
|
+
},
|
|
51
|
+
sectionHeader: {
|
|
52
|
+
gap: vs(4)
|
|
53
|
+
},
|
|
54
|
+
sectionTitle: {
|
|
55
|
+
fontFamily: "Sohne-SemiBold",
|
|
56
|
+
fontSize: 16,
|
|
57
|
+
lineHeight: 24
|
|
58
|
+
},
|
|
59
|
+
sectionDescription: {
|
|
60
|
+
fontFamily: "Sohne-Regular",
|
|
61
|
+
fontSize: 14,
|
|
62
|
+
lineHeight: 20
|
|
63
|
+
},
|
|
64
|
+
footer: {
|
|
65
|
+
flexDirection: "row",
|
|
66
|
+
gap: s(12),
|
|
67
|
+
paddingTop: vs(8)
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export { Form, FormField, FormFooter, FormSection };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import { ms, mvs, vs } from './chunk-2CE3TQVY.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, View, ActivityIndicator, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
var sizeMap = {
|
|
7
|
+
sm: "small",
|
|
8
|
+
md: "small",
|
|
9
|
+
lg: "large"
|
|
10
|
+
};
|
|
11
|
+
var labelFontSize = {
|
|
12
|
+
sm: ms(11),
|
|
13
|
+
md: ms(13),
|
|
14
|
+
lg: ms(14)
|
|
15
|
+
};
|
|
16
|
+
function Spinner({ size = "md", color, label, ...props }) {
|
|
17
|
+
const { colors } = useTheme();
|
|
18
|
+
if (label) {
|
|
19
|
+
return /* @__PURE__ */ React.createElement(View, { style: styles.wrapper }, /* @__PURE__ */ React.createElement(ActivityIndicator, { size: sizeMap[size], color: color ?? colors.primary, ...props }), /* @__PURE__ */ React.createElement(
|
|
20
|
+
Text,
|
|
21
|
+
{
|
|
22
|
+
style: [styles.label, { color: colors.foregroundMuted, fontSize: labelFontSize[size] }],
|
|
23
|
+
allowFontScaling: true
|
|
24
|
+
},
|
|
25
|
+
label
|
|
26
|
+
));
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ React.createElement(ActivityIndicator, { size: sizeMap[size], color: color ?? colors.primary, ...props });
|
|
29
|
+
}
|
|
30
|
+
var styles = StyleSheet.create({
|
|
31
|
+
wrapper: {
|
|
32
|
+
alignItems: "center",
|
|
33
|
+
gap: vs(6)
|
|
34
|
+
},
|
|
35
|
+
label: {
|
|
36
|
+
fontFamily: "Sohne-Regular",
|
|
37
|
+
lineHeight: mvs(18)
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export { Spinner };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TIMINGS, EASINGS } from './chunk-5IKW3VNC.mjs';
|
|
2
|
+
import { useEffect } from 'react';
|
|
3
|
+
import { useSharedValue, withTiming } from 'react-native-reanimated';
|
|
4
|
+
|
|
5
|
+
function useColorTransition(active, options = {}) {
|
|
6
|
+
const { duration = TIMINGS.state.duration } = options;
|
|
7
|
+
const progress = useSharedValue(active ? 1 : 0);
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
progress.value = withTiming(active ? 1 : 0, { duration, easing: EASINGS.standard });
|
|
10
|
+
}, [active, duration, progress]);
|
|
11
|
+
return progress;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { useColorTransition };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
2
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
3
|
+
import { mvs, ms, s } from './chunk-2CE3TQVY.mjs';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
6
|
+
|
|
7
|
+
function LabelValueBase({ label, value, iconName, iconColor, style }) {
|
|
8
|
+
const { colors } = useTheme();
|
|
9
|
+
const resolvedIcon = iconName ? renderIcon(iconName, ms(14), iconColor ?? colors.foregroundMuted) : null;
|
|
10
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, style] }, /* @__PURE__ */ React.createElement(View, { style: styles.labelSide }, resolvedIcon ? /* @__PURE__ */ React.createElement(View, { style: styles.icon }, resolvedIcon) : null, /* @__PURE__ */ React.createElement(Text, { style: [styles.label, { color: colors.foregroundMuted }], allowFontScaling: true }, label)), typeof value === "string" ? /* @__PURE__ */ React.createElement(Text, { style: [styles.value, { color: colors.foreground }], allowFontScaling: true }, value) : value);
|
|
11
|
+
}
|
|
12
|
+
var LabelValue = React.memo(LabelValueBase);
|
|
13
|
+
var styles = StyleSheet.create({
|
|
14
|
+
container: {
|
|
15
|
+
flexDirection: "row",
|
|
16
|
+
justifyContent: "space-between",
|
|
17
|
+
alignItems: "center",
|
|
18
|
+
gap: s(12)
|
|
19
|
+
},
|
|
20
|
+
labelSide: {
|
|
21
|
+
flexDirection: "row",
|
|
22
|
+
alignItems: "center",
|
|
23
|
+
gap: s(4)
|
|
24
|
+
},
|
|
25
|
+
icon: {
|
|
26
|
+
alignItems: "center",
|
|
27
|
+
justifyContent: "center"
|
|
28
|
+
},
|
|
29
|
+
label: {
|
|
30
|
+
fontFamily: "Sohne-Regular",
|
|
31
|
+
fontSize: ms(13),
|
|
32
|
+
lineHeight: mvs(18)
|
|
33
|
+
},
|
|
34
|
+
value: {
|
|
35
|
+
fontFamily: "Sohne-Medium",
|
|
36
|
+
fontSize: ms(14),
|
|
37
|
+
lineHeight: mvs(20),
|
|
38
|
+
textAlign: "right"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export { LabelValue };
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { impactMedium } from './chunk-RTC3CFXF.mjs';
|
|
2
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
3
|
+
import { s, vs, mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
4
|
+
import React, { useRef, useEffect, useCallback } from 'react';
|
|
5
|
+
import { Dimensions, Platform, StyleSheet, View, Text, TouchableOpacity } from 'react-native';
|
|
6
|
+
import { BottomSheetBackdrop, BottomSheetFooter, BottomSheetModal, BottomSheetScrollView, BottomSheetView } from '@gorhom/bottom-sheet';
|
|
7
|
+
export { BottomSheetModalProvider, BottomSheetTextInput } from '@gorhom/bottom-sheet';
|
|
8
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
9
|
+
import { AntDesign } from '@expo/vector-icons';
|
|
10
|
+
|
|
11
|
+
var SCREEN_HEIGHT = Dimensions.get("window").height;
|
|
12
|
+
var DEFAULT_MAX_HEIGHT = SCREEN_HEIGHT * 0.85;
|
|
13
|
+
var isAndroid = Platform.OS === "android";
|
|
14
|
+
function SheetHeader({ children, style }) {
|
|
15
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.header, style] }, children);
|
|
16
|
+
}
|
|
17
|
+
function SheetContent({ children, style }) {
|
|
18
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.sheetContent, style] }, children);
|
|
19
|
+
}
|
|
20
|
+
function SheetFooter({ children, style }) {
|
|
21
|
+
const { colors } = useTheme();
|
|
22
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.sheetFooter, { backgroundColor: colors.card, borderTopColor: colors.border }, style] }, children);
|
|
23
|
+
}
|
|
24
|
+
function Sheet({
|
|
25
|
+
open,
|
|
26
|
+
onClose,
|
|
27
|
+
title,
|
|
28
|
+
subtitle,
|
|
29
|
+
description,
|
|
30
|
+
showCloseButton = false,
|
|
31
|
+
children,
|
|
32
|
+
style,
|
|
33
|
+
contentStyle,
|
|
34
|
+
scrollable,
|
|
35
|
+
maxHeight,
|
|
36
|
+
keyboardBehavior,
|
|
37
|
+
keyboardBlurBehavior = "restore",
|
|
38
|
+
enableBlurKeyboardOnGesture = true,
|
|
39
|
+
android_keyboardInputMode = "adjustPan",
|
|
40
|
+
footer,
|
|
41
|
+
snapPoints
|
|
42
|
+
}) {
|
|
43
|
+
const { colors } = useTheme();
|
|
44
|
+
const insets = useSafeAreaInsets();
|
|
45
|
+
const ref = useRef(null);
|
|
46
|
+
const effectiveKeyboardBehavior = keyboardBehavior ?? "interactive";
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (open) {
|
|
49
|
+
impactMedium();
|
|
50
|
+
ref.current?.present();
|
|
51
|
+
} else {
|
|
52
|
+
ref.current?.dismiss();
|
|
53
|
+
}
|
|
54
|
+
}, [open]);
|
|
55
|
+
const renderBackdrop = useCallback((props) => /* @__PURE__ */ React.createElement(
|
|
56
|
+
BottomSheetBackdrop,
|
|
57
|
+
{
|
|
58
|
+
...props,
|
|
59
|
+
disappearsOnIndex: -1,
|
|
60
|
+
appearsOnIndex: 0,
|
|
61
|
+
pressBehavior: "close"
|
|
62
|
+
}
|
|
63
|
+
), []);
|
|
64
|
+
const childArray = React.Children.toArray(children);
|
|
65
|
+
const customHeader = childArray.find((child) => React.isValidElement(child) && child.type === SheetHeader);
|
|
66
|
+
const customContent = childArray.find((child) => React.isValidElement(child) && child.type === SheetContent);
|
|
67
|
+
const customFooter = childArray.find((child) => React.isValidElement(child) && child.type === SheetFooter);
|
|
68
|
+
const filteredChildren = customHeader || customContent || customFooter ? childArray.filter(
|
|
69
|
+
(child) => !React.isValidElement(child) || child.type !== SheetHeader && child.type !== SheetContent && child.type !== SheetFooter
|
|
70
|
+
) : children;
|
|
71
|
+
const effectiveSubtitle = subtitle ?? description;
|
|
72
|
+
const showHeader = !!(title || effectiveSubtitle || showCloseButton) && !customHeader;
|
|
73
|
+
const headerNode = customHeader ? customHeader : showHeader ? /* @__PURE__ */ React.createElement(View, { style: styles.header, accessibilityRole: "header" }, /* @__PURE__ */ React.createElement(View, { style: styles.headerRow }, title ? /* @__PURE__ */ React.createElement(Text, { style: [styles.title, { color: colors.foreground }], allowFontScaling: true }, title) : /* @__PURE__ */ React.createElement(View, { style: { flex: 1 } }), showCloseButton ? /* @__PURE__ */ React.createElement(
|
|
74
|
+
TouchableOpacity,
|
|
75
|
+
{
|
|
76
|
+
onPress: onClose,
|
|
77
|
+
style: styles.closeButton,
|
|
78
|
+
activeOpacity: 0.6,
|
|
79
|
+
touchSoundDisabled: true,
|
|
80
|
+
accessibilityRole: "button",
|
|
81
|
+
accessibilityLabel: "Close",
|
|
82
|
+
hitSlop: { top: 12, bottom: 12, left: 12, right: 12 }
|
|
83
|
+
},
|
|
84
|
+
/* @__PURE__ */ React.createElement(AntDesign, { name: "close", size: ms(18), color: colors.foregroundMuted })
|
|
85
|
+
) : null), effectiveSubtitle ? /* @__PURE__ */ React.createElement(Text, { style: [styles.subtitle, { color: colors.foregroundMuted }], allowFontScaling: true }, effectiveSubtitle) : null) : null;
|
|
86
|
+
const contentNode = customContent ? customContent : filteredChildren;
|
|
87
|
+
const effectiveFooter = customFooter ? customFooter : footer;
|
|
88
|
+
const renderFooter = useCallback((props) => {
|
|
89
|
+
if (!effectiveFooter) return null;
|
|
90
|
+
return /* @__PURE__ */ React.createElement(BottomSheetFooter, { ...props }, effectiveFooter);
|
|
91
|
+
}, [effectiveFooter]);
|
|
92
|
+
const useScroll = scrollable || !!maxHeight;
|
|
93
|
+
const effectiveMaxHeight = maxHeight ?? DEFAULT_MAX_HEIGHT;
|
|
94
|
+
const useDynamicSizing = !snapPoints;
|
|
95
|
+
return /* @__PURE__ */ React.createElement(
|
|
96
|
+
BottomSheetModal,
|
|
97
|
+
{
|
|
98
|
+
ref,
|
|
99
|
+
enableDynamicSizing: useDynamicSizing,
|
|
100
|
+
snapPoints,
|
|
101
|
+
maxDynamicContentSize: useDynamicSizing ? effectiveMaxHeight : void 0,
|
|
102
|
+
onDismiss: onClose,
|
|
103
|
+
backdropComponent: renderBackdrop,
|
|
104
|
+
footerComponent: effectiveFooter ? renderFooter : void 0,
|
|
105
|
+
backgroundStyle: [styles.background, { backgroundColor: colors.card }],
|
|
106
|
+
handleIndicatorStyle: [styles.handle, { backgroundColor: colors.border }],
|
|
107
|
+
enablePanDownToClose: true,
|
|
108
|
+
topInset: insets.top,
|
|
109
|
+
keyboardBehavior: effectiveKeyboardBehavior,
|
|
110
|
+
keyboardBlurBehavior,
|
|
111
|
+
android_keyboardInputMode,
|
|
112
|
+
enableBlurKeyboardOnGesture
|
|
113
|
+
},
|
|
114
|
+
useScroll ? /* @__PURE__ */ React.createElement(
|
|
115
|
+
BottomSheetScrollView,
|
|
116
|
+
{
|
|
117
|
+
contentContainerStyle: [
|
|
118
|
+
styles.scrollContent,
|
|
119
|
+
style
|
|
120
|
+
],
|
|
121
|
+
style: contentStyle,
|
|
122
|
+
showsVerticalScrollIndicator: true,
|
|
123
|
+
indicatorStyle: "black",
|
|
124
|
+
persistentScrollbar: isAndroid
|
|
125
|
+
},
|
|
126
|
+
headerNode,
|
|
127
|
+
contentNode
|
|
128
|
+
) : /* @__PURE__ */ React.createElement(BottomSheetView, { style: [styles.content, contentStyle, style] }, headerNode, contentNode)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
Sheet.Header = SheetHeader;
|
|
132
|
+
Sheet.Content = SheetContent;
|
|
133
|
+
Sheet.Footer = SheetFooter;
|
|
134
|
+
var styles = StyleSheet.create({
|
|
135
|
+
background: {
|
|
136
|
+
borderTopLeftRadius: ms(16),
|
|
137
|
+
borderTopRightRadius: ms(16)
|
|
138
|
+
},
|
|
139
|
+
handle: {
|
|
140
|
+
width: s(36),
|
|
141
|
+
height: vs(4),
|
|
142
|
+
borderRadius: ms(2)
|
|
143
|
+
},
|
|
144
|
+
header: {
|
|
145
|
+
paddingHorizontal: s(16),
|
|
146
|
+
paddingTop: vs(4),
|
|
147
|
+
paddingBottom: vs(12),
|
|
148
|
+
gap: vs(4)
|
|
149
|
+
},
|
|
150
|
+
headerRow: {
|
|
151
|
+
flexDirection: "row",
|
|
152
|
+
alignItems: "center",
|
|
153
|
+
justifyContent: "space-between"
|
|
154
|
+
},
|
|
155
|
+
title: {
|
|
156
|
+
fontFamily: "Sohne-SemiBold",
|
|
157
|
+
fontSize: ms(18),
|
|
158
|
+
flex: 1
|
|
159
|
+
},
|
|
160
|
+
subtitle: {
|
|
161
|
+
fontFamily: "Sohne-Regular",
|
|
162
|
+
fontSize: ms(14),
|
|
163
|
+
lineHeight: mvs(20)
|
|
164
|
+
},
|
|
165
|
+
closeButton: {
|
|
166
|
+
padding: s(4),
|
|
167
|
+
marginLeft: s(8)
|
|
168
|
+
},
|
|
169
|
+
content: {
|
|
170
|
+
paddingHorizontal: s(16),
|
|
171
|
+
paddingBottom: vs(32)
|
|
172
|
+
},
|
|
173
|
+
scrollContent: {
|
|
174
|
+
paddingHorizontal: s(16),
|
|
175
|
+
paddingBottom: vs(32),
|
|
176
|
+
paddingRight: s(16)
|
|
177
|
+
},
|
|
178
|
+
sheetContent: {
|
|
179
|
+
gap: vs(16)
|
|
180
|
+
},
|
|
181
|
+
sheetFooter: {
|
|
182
|
+
paddingHorizontal: s(16),
|
|
183
|
+
paddingVertical: vs(16),
|
|
184
|
+
borderTopWidth: 1,
|
|
185
|
+
flexDirection: "row",
|
|
186
|
+
gap: s(12)
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
export { Sheet };
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
2
|
+
import { ms } from './chunk-2CE3TQVY.mjs';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { StyleSheet, View, Text } from 'react-native';
|
|
5
|
+
|
|
6
|
+
var variantFontSize = {
|
|
7
|
+
hero: ms(48),
|
|
8
|
+
large: ms(32),
|
|
9
|
+
medium: ms(18),
|
|
10
|
+
small: ms(14)
|
|
11
|
+
};
|
|
12
|
+
var variantLetterSpacing = {
|
|
13
|
+
hero: -2,
|
|
14
|
+
large: -1,
|
|
15
|
+
medium: -0.5,
|
|
16
|
+
small: 0
|
|
17
|
+
};
|
|
18
|
+
function formatValue(value, prefix, showDecimals) {
|
|
19
|
+
const num = typeof value === "string" ? parseFloat(value.replace(/[^0-9.-]/g, "")) : value;
|
|
20
|
+
if (isNaN(num)) return `${prefix}0`;
|
|
21
|
+
const abs = Math.abs(num);
|
|
22
|
+
const sign = num < 0 ? "-" : "";
|
|
23
|
+
const intPart = Math.floor(abs).toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
|
|
24
|
+
if (showDecimals) {
|
|
25
|
+
const decStr = (abs % 1).toFixed(2).slice(2);
|
|
26
|
+
return `${sign}${prefix}${intPart},${decStr}`;
|
|
27
|
+
}
|
|
28
|
+
return `${sign}${prefix}${intPart}`;
|
|
29
|
+
}
|
|
30
|
+
function CurrencyDisplayBase({ value, prefix = "$", showDecimals = false, textColor, variant, autoScale, maxFontSize, style }) {
|
|
31
|
+
const { colors } = useTheme();
|
|
32
|
+
const formatted = formatValue(value, prefix, showDecimals);
|
|
33
|
+
const baseFontSize = variant ? variantFontSize[variant] : ms(56);
|
|
34
|
+
const fontSize = maxFontSize ?? baseFontSize;
|
|
35
|
+
const letterSpacing = variant ? variantLetterSpacing[variant] : -2;
|
|
36
|
+
return /* @__PURE__ */ React.createElement(View, { style: [styles.container, style] }, /* @__PURE__ */ React.createElement(
|
|
37
|
+
Text,
|
|
38
|
+
{
|
|
39
|
+
style: [styles.amount, { color: textColor ?? colors.foreground, fontSize, letterSpacing }],
|
|
40
|
+
allowFontScaling: true,
|
|
41
|
+
numberOfLines: autoScale ? 1 : void 0,
|
|
42
|
+
adjustsFontSizeToFit: autoScale,
|
|
43
|
+
minimumFontScale: autoScale ? 0.5 : void 0
|
|
44
|
+
},
|
|
45
|
+
formatted
|
|
46
|
+
));
|
|
47
|
+
}
|
|
48
|
+
var CurrencyDisplay = React.memo(CurrencyDisplayBase);
|
|
49
|
+
var styles = StyleSheet.create({
|
|
50
|
+
container: {
|
|
51
|
+
alignSelf: "flex-start"
|
|
52
|
+
},
|
|
53
|
+
amount: {
|
|
54
|
+
fontFamily: "Sohne-Bold",
|
|
55
|
+
includeFontPadding: false,
|
|
56
|
+
textAlignVertical: "top"
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export { CurrencyDisplay };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { renderIcon } from './chunk-T7XZ7H7Y.mjs';
|
|
2
|
+
import { usePressScale } from './chunk-QCNARS3X.mjs';
|
|
3
|
+
import { impactMedium } from './chunk-RTC3CFXF.mjs';
|
|
4
|
+
import { PRESS_SCALE } from './chunk-5IKW3VNC.mjs';
|
|
5
|
+
import { TYPOGRAPHY, RADIUS } from './chunk-QY3X2UYR.mjs';
|
|
6
|
+
import { useTheme } from './chunk-SOYNZDVY.mjs';
|
|
7
|
+
import { vs, s, mvs, ms } from './chunk-2CE3TQVY.mjs';
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { StyleSheet, TouchableOpacity, ActivityIndicator, Text } from 'react-native';
|
|
10
|
+
import Animated from 'react-native-reanimated';
|
|
11
|
+
|
|
12
|
+
var containerSizeStyles = {
|
|
13
|
+
sm: { paddingHorizontal: s(16), paddingVertical: vs(10), minHeight: 40 },
|
|
14
|
+
md: { paddingHorizontal: s(24), paddingVertical: vs(14), minHeight: 48 },
|
|
15
|
+
lg: { paddingHorizontal: s(28), paddingVertical: vs(16), minHeight: 56 }
|
|
16
|
+
};
|
|
17
|
+
var labelSizeStyles = {
|
|
18
|
+
sm: { ...TYPOGRAPHY["button-sm"], fontSize: ms(TYPOGRAPHY["button-sm"].fontSize) },
|
|
19
|
+
md: { ...TYPOGRAPHY["button-lg"], fontSize: ms(TYPOGRAPHY["button-lg"].fontSize) },
|
|
20
|
+
lg: { ...TYPOGRAPHY["button-lg"], fontSize: ms(TYPOGRAPHY["button-lg"].fontSize + 1), lineHeight: mvs(24) }
|
|
21
|
+
};
|
|
22
|
+
var iconSizeMap = { sm: 16, md: 18, lg: 20 };
|
|
23
|
+
function ButtonBase({
|
|
24
|
+
label,
|
|
25
|
+
variant = "primary",
|
|
26
|
+
size = "md",
|
|
27
|
+
loading = false,
|
|
28
|
+
fullWidth = false,
|
|
29
|
+
icon,
|
|
30
|
+
iconName,
|
|
31
|
+
iconColor,
|
|
32
|
+
iconPosition = "left",
|
|
33
|
+
disabled,
|
|
34
|
+
style,
|
|
35
|
+
onPress,
|
|
36
|
+
accessibilityLabel,
|
|
37
|
+
accessibilityHint,
|
|
38
|
+
...props
|
|
39
|
+
}) {
|
|
40
|
+
const { colors } = useTheme();
|
|
41
|
+
const isDisabled = disabled || loading;
|
|
42
|
+
const { animatedStyle, onPressIn, onPressOut, hoverHandlers } = usePressScale({
|
|
43
|
+
pressScale: PRESS_SCALE.button,
|
|
44
|
+
disabled: isDisabled
|
|
45
|
+
});
|
|
46
|
+
const handlePress = (e) => {
|
|
47
|
+
impactMedium();
|
|
48
|
+
onPress?.(e);
|
|
49
|
+
};
|
|
50
|
+
const containerVariantStyle = {
|
|
51
|
+
primary: { backgroundColor: colors.primary },
|
|
52
|
+
secondary: { backgroundColor: "transparent", borderWidth: 1.5, borderColor: colors.primary },
|
|
53
|
+
text: { backgroundColor: "transparent" },
|
|
54
|
+
destructive: { backgroundColor: colors.destructive }
|
|
55
|
+
}[variant];
|
|
56
|
+
const labelVariantStyle = {
|
|
57
|
+
primary: { color: colors.primaryForeground },
|
|
58
|
+
secondary: { color: colors.primary },
|
|
59
|
+
// AUDIT FIX: was colors.foreground — visually indistinguishable from plain text,
|
|
60
|
+
// no affordance that it's a CTA. Now uses accentResolved so text-only buttons
|
|
61
|
+
// carry the brand voltage. Falls back to primary when no accent is defined.
|
|
62
|
+
text: { color: colors.accentResolved },
|
|
63
|
+
destructive: { color: colors.destructiveForeground }
|
|
64
|
+
}[variant];
|
|
65
|
+
const textColor = iconColor ?? labelVariantStyle.color;
|
|
66
|
+
const effectiveIcon = iconName ? renderIcon(iconName, iconSizeMap[size], textColor) : typeof icon === "function" ? icon({ label, size, variant, color: textColor }) : icon;
|
|
67
|
+
const spinnerColor = variant === "destructive" ? colors.destructiveForeground : variant === "primary" ? colors.primaryForeground : colors.accentResolved;
|
|
68
|
+
const styleArray = Array.isArray(style) ? style : style ? [style] : [];
|
|
69
|
+
const flatStyle = StyleSheet.flatten(styleArray);
|
|
70
|
+
const { flex, ...restStyle } = flatStyle || {};
|
|
71
|
+
return /* @__PURE__ */ React.createElement(
|
|
72
|
+
Animated.View,
|
|
73
|
+
{
|
|
74
|
+
style: [fullWidth && styles.fullWidth, flex !== void 0 && { flex }, animatedStyle],
|
|
75
|
+
...hoverHandlers
|
|
76
|
+
},
|
|
77
|
+
/* @__PURE__ */ React.createElement(
|
|
78
|
+
TouchableOpacity,
|
|
79
|
+
{
|
|
80
|
+
style: [
|
|
81
|
+
styles.base,
|
|
82
|
+
containerVariantStyle,
|
|
83
|
+
containerSizeStyles[size],
|
|
84
|
+
fullWidth && styles.fullWidth,
|
|
85
|
+
isDisabled && styles.disabled,
|
|
86
|
+
restStyle
|
|
87
|
+
],
|
|
88
|
+
disabled: isDisabled,
|
|
89
|
+
activeOpacity: 1,
|
|
90
|
+
touchSoundDisabled: true,
|
|
91
|
+
onPress: handlePress,
|
|
92
|
+
onPressIn,
|
|
93
|
+
onPressOut,
|
|
94
|
+
accessibilityRole: "button",
|
|
95
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
96
|
+
accessibilityHint,
|
|
97
|
+
accessibilityState: { disabled: isDisabled, busy: loading },
|
|
98
|
+
...props
|
|
99
|
+
},
|
|
100
|
+
loading ? /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ActivityIndicator, { size: "small", color: spinnerColor, style: { marginRight: s(6) } }), /* @__PURE__ */ React.createElement(
|
|
101
|
+
Text,
|
|
102
|
+
{
|
|
103
|
+
style: [styles.label, labelVariantStyle, labelSizeStyles[size], styles.labelLoading],
|
|
104
|
+
allowFontScaling: true,
|
|
105
|
+
numberOfLines: 1
|
|
106
|
+
},
|
|
107
|
+
label
|
|
108
|
+
)) : /* @__PURE__ */ React.createElement(React.Fragment, null, effectiveIcon && iconPosition === "left" && /* @__PURE__ */ React.createElement(React.Fragment, null, effectiveIcon), /* @__PURE__ */ React.createElement(
|
|
109
|
+
Text,
|
|
110
|
+
{
|
|
111
|
+
style: [styles.label, labelVariantStyle, labelSizeStyles[size], effectiveIcon ? styles.labelWithIcon : void 0],
|
|
112
|
+
allowFontScaling: true,
|
|
113
|
+
numberOfLines: 1
|
|
114
|
+
},
|
|
115
|
+
label
|
|
116
|
+
), effectiveIcon && iconPosition === "right" && /* @__PURE__ */ React.createElement(React.Fragment, null, effectiveIcon))
|
|
117
|
+
)
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
var Button = React.memo(ButtonBase);
|
|
121
|
+
var styles = StyleSheet.create({
|
|
122
|
+
base: {
|
|
123
|
+
borderRadius: RADIUS.md,
|
|
124
|
+
alignItems: "center",
|
|
125
|
+
justifyContent: "center",
|
|
126
|
+
flexDirection: "row"
|
|
127
|
+
},
|
|
128
|
+
fullWidth: {
|
|
129
|
+
width: "100%"
|
|
130
|
+
},
|
|
131
|
+
disabled: {
|
|
132
|
+
opacity: 0.45
|
|
133
|
+
},
|
|
134
|
+
label: {
|
|
135
|
+
fontFamily: "Sohne-Medium",
|
|
136
|
+
flexShrink: 1
|
|
137
|
+
},
|
|
138
|
+
labelWithIcon: {
|
|
139
|
+
marginHorizontal: s(6)
|
|
140
|
+
},
|
|
141
|
+
labelLoading: {
|
|
142
|
+
opacity: 0.6
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
export { Button };
|