dash-ui-kit 1.0.93 → 2.0.0-dev
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/README.md +52 -0
- package/dist/react/components/accordion/index.cjs.js +193 -0
- package/dist/react/components/accordion/index.cjs.js.map +1 -0
- package/dist/react/components/accordion/index.esm.js +169 -0
- package/dist/react/components/accordion/index.esm.js.map +1 -0
- package/dist/react/components/avatar/index.cjs.js +39 -0
- package/dist/react/components/avatar/index.cjs.js.map +1 -0
- package/dist/react/components/avatar/index.esm.js +34 -0
- package/dist/react/components/avatar/index.esm.js.map +1 -0
- package/dist/react/components/badge/index.cjs.js +92 -0
- package/dist/react/components/badge/index.cjs.js.map +1 -0
- package/dist/react/components/badge/index.esm.js +87 -0
- package/dist/react/components/badge/index.esm.js.map +1 -0
- package/dist/react/components/bigNumber/index.cjs.js +100 -0
- package/dist/react/components/bigNumber/index.cjs.js.map +1 -0
- package/dist/react/components/bigNumber/index.esm.js +95 -0
- package/dist/react/components/bigNumber/index.esm.js.map +1 -0
- package/dist/react/components/button/index.cjs.js +535 -0
- package/dist/react/components/button/index.cjs.js.map +1 -0
- package/dist/react/components/button/index.d.ts +3 -1
- package/dist/react/components/button/index.esm.js +530 -0
- package/dist/react/components/button/index.esm.js.map +1 -0
- package/dist/react/components/copyButton/index.cjs.js +95 -0
- package/dist/react/components/copyButton/index.cjs.js.map +1 -0
- package/dist/react/components/copyButton/index.esm.js +71 -0
- package/dist/react/components/copyButton/index.esm.js.map +1 -0
- package/dist/react/components/dashLogo/index.cjs.js +74 -0
- package/dist/react/components/dashLogo/index.cjs.js.map +1 -0
- package/dist/react/components/dashLogo/index.esm.js +69 -0
- package/dist/react/components/dashLogo/index.esm.js.map +1 -0
- package/dist/react/components/dateBlock/index.cjs.js +120 -0
- package/dist/react/components/dateBlock/index.cjs.js.map +1 -0
- package/dist/react/components/dateBlock/index.esm.js +115 -0
- package/dist/react/components/dateBlock/index.esm.js.map +1 -0
- package/dist/react/components/dialog/index.cjs.js +292 -0
- package/dist/react/components/dialog/index.cjs.js.map +1 -0
- package/dist/react/components/dialog/index.esm.js +270 -0
- package/dist/react/components/dialog/index.esm.js.map +1 -0
- package/dist/react/components/heading/index.cjs.js +60 -0
- package/dist/react/components/heading/index.cjs.js.map +1 -0
- package/dist/react/components/heading/index.esm.js +58 -0
- package/dist/react/components/heading/index.esm.js.map +1 -0
- package/dist/react/components/icons/index.cjs.js +1173 -0
- package/dist/react/components/icons/index.cjs.js.map +1 -0
- package/dist/react/components/icons/index.d.ts +2 -0
- package/dist/react/components/icons/index.esm.js +1128 -0
- package/dist/react/components/icons/index.esm.js.map +1 -0
- package/dist/react/components/identifier/index.cjs.js +286 -0
- package/dist/react/components/identifier/index.cjs.js.map +1 -0
- package/dist/react/components/identifier/index.esm.js +282 -0
- package/dist/react/components/identifier/index.esm.js.map +1 -0
- package/dist/react/components/index.cjs.js +101 -0
- package/dist/react/components/index.cjs.js.map +1 -0
- package/dist/react/components/index.d.ts +1 -1
- package/dist/react/components/index.esm.js +29 -0
- package/dist/react/components/index.esm.js.map +1 -0
- package/dist/react/components/input/index.cjs.js +237 -0
- package/dist/react/components/input/index.cjs.js.map +1 -0
- package/dist/react/components/input/index.esm.js +232 -0
- package/dist/react/components/input/index.esm.js.map +1 -0
- package/dist/react/components/list/index.cjs.js +49 -0
- package/dist/react/components/list/index.cjs.js.map +1 -0
- package/dist/react/components/list/index.esm.js +47 -0
- package/dist/react/components/list/index.esm.js.map +1 -0
- package/dist/react/components/notActive/index.cjs.js +40 -0
- package/dist/react/components/notActive/index.cjs.js.map +1 -0
- package/dist/react/components/notActive/index.esm.js +38 -0
- package/dist/react/components/notActive/index.esm.js.map +1 -0
- package/dist/react/components/overlayMenu/index.cjs.js +425 -0
- package/dist/react/components/overlayMenu/index.cjs.js.map +1 -0
- package/dist/react/components/overlayMenu/index.esm.js +420 -0
- package/dist/react/components/overlayMenu/index.esm.js.map +1 -0
- package/dist/react/components/overlaySelect/index.cjs.js +345 -0
- package/dist/react/components/overlaySelect/index.cjs.js.map +1 -0
- package/dist/react/components/overlaySelect/index.esm.js +340 -0
- package/dist/react/components/overlaySelect/index.esm.js.map +1 -0
- package/dist/react/components/progressStepBar/index.cjs.js +49 -0
- package/dist/react/components/progressStepBar/index.cjs.js.map +1 -0
- package/dist/react/components/progressStepBar/index.d.ts +2 -1
- package/dist/react/components/progressStepBar/index.esm.js +47 -0
- package/dist/react/components/progressStepBar/index.esm.js.map +1 -0
- package/dist/react/components/select/index.cjs.js +236 -0
- package/dist/react/components/select/index.cjs.js.map +1 -0
- package/dist/react/components/select/index.esm.js +212 -0
- package/dist/react/components/select/index.esm.js.map +1 -0
- package/dist/react/components/switch/index.cjs.js +184 -0
- package/dist/react/components/switch/index.cjs.js.map +1 -0
- package/dist/react/components/switch/index.esm.js +179 -0
- package/dist/react/components/switch/index.esm.js.map +1 -0
- package/dist/react/components/tabs/index.cjs.js +178 -0
- package/dist/react/components/tabs/index.cjs.js.map +1 -0
- package/dist/react/components/tabs/index.esm.js +154 -0
- package/dist/react/components/tabs/index.esm.js.map +1 -0
- package/dist/react/components/text/index.cjs.js +120 -0
- package/dist/react/components/text/index.cjs.js.map +1 -0
- package/dist/react/components/text/index.esm.js +115 -0
- package/dist/react/components/text/index.esm.js.map +1 -0
- package/dist/react/components/textarea/index.cjs.js +256 -0
- package/dist/react/components/textarea/index.cjs.js.map +1 -0
- package/dist/react/components/textarea/index.esm.js +251 -0
- package/dist/react/components/textarea/index.esm.js.map +1 -0
- package/dist/react/components/timeDelta/index.cjs.js +93 -0
- package/dist/react/components/timeDelta/index.cjs.js.map +1 -0
- package/dist/react/components/timeDelta/index.d.ts +1 -1
- package/dist/react/components/timeDelta/index.esm.js +88 -0
- package/dist/react/components/timeDelta/index.esm.js.map +1 -0
- package/dist/react/components/transactionStatusIcon/index.cjs.js +59 -0
- package/dist/react/components/transactionStatusIcon/index.cjs.js.map +1 -0
- package/dist/react/components/transactionStatusIcon/index.esm.js +54 -0
- package/dist/react/components/transactionStatusIcon/index.esm.js.map +1 -0
- package/dist/react/components/valueCard/index.cjs.js +176 -0
- package/dist/react/components/valueCard/index.cjs.js.map +1 -0
- package/dist/react/components/valueCard/index.d.ts +1 -1
- package/dist/react/components/valueCard/index.esm.js +171 -0
- package/dist/react/components/valueCard/index.esm.js.map +1 -0
- package/dist/react/contexts/ThemeContext.cjs.js +79 -0
- package/dist/react/contexts/ThemeContext.cjs.js.map +1 -0
- package/dist/react/contexts/ThemeContext.esm.js +76 -0
- package/dist/react/contexts/ThemeContext.esm.js.map +1 -0
- package/dist/react/contexts/index.cjs.js +11 -0
- package/dist/react/contexts/index.cjs.js.map +1 -0
- package/dist/react/contexts/index.esm.js +4 -0
- package/dist/react/contexts/index.esm.js.map +1 -0
- package/dist/react/hooks/useDebounce.cjs.js +83 -0
- package/dist/react/hooks/useDebounce.cjs.js.map +1 -0
- package/dist/react/hooks/useDebounce.esm.js +78 -0
- package/dist/react/hooks/useDebounce.esm.js.map +1 -0
- package/dist/react/index.cjs.js +99 -12811
- package/dist/react/index.cjs.js.map +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/index.esm.js +27 -12725
- package/dist/react/index.esm.js.map +1 -1
- package/dist/react/shared/utils/datetime.cjs.js +59 -0
- package/dist/react/shared/utils/datetime.cjs.js.map +1 -0
- package/dist/react/shared/utils/datetime.esm.js +57 -0
- package/dist/react/shared/utils/datetime.esm.js.map +1 -0
- package/dist/react/utils/copyToClipboard.cjs.js +31 -0
- package/dist/react/utils/copyToClipboard.cjs.js.map +1 -0
- package/dist/react/utils/copyToClipboard.esm.js +26 -0
- package/dist/react/utils/copyToClipboard.esm.js.map +1 -0
- package/dist/react/utils/index.d.ts +1 -1
- package/dist/react-native/components/avatar/index.d.ts +26 -0
- package/dist/react-native/components/avatar/index.web.d.ts +24 -0
- package/dist/react-native/components/badge/index.d.ts +51 -0
- package/dist/react-native/components/bigNumber/index.d.ts +26 -0
- package/dist/react-native/components/button/index.d.ts +39 -0
- package/dist/react-native/components/copyButton/index.d.ts +22 -0
- package/dist/react-native/components/copyButton/index.web.d.ts +20 -0
- package/dist/react-native/components/dashLogo/index.d.ts +30 -0
- package/dist/react-native/components/heading/index.d.ts +25 -0
- package/dist/react-native/components/icons/index.d.ts +43 -0
- package/dist/react-native/components/identifier/index.d.ts +47 -0
- package/dist/react-native/components/index.d.ts +15 -0
- package/dist/react-native/components/input/index.d.ts +53 -0
- package/dist/react-native/components/notActive/index.d.ts +16 -0
- package/dist/react-native/components/tabs/index.d.ts +50 -0
- package/dist/react-native/components/text/index.d.ts +28 -0
- package/dist/react-native/components/transactionStatusIcon/index.d.ts +24 -0
- package/dist/react-native/components/valueCard/index.d.ts +43 -0
- package/dist/react-native/hooks/index.d.ts +1 -0
- package/dist/react-native/hooks/useDebounce.d.ts +43 -0
- package/dist/react-native/index.cjs.js +2856 -0
- package/dist/react-native/index.cjs.js.map +1 -0
- package/dist/react-native/index.d.ts +4 -0
- package/dist/react-native/index.esm.js +2808 -0
- package/dist/react-native/index.esm.js.map +1 -0
- package/dist/react-native/styles/index.d.ts +11 -0
- package/dist/react-native/styles/tokens.d.ts +308 -0
- package/dist/react-native/styles/utils.d.ts +65 -0
- package/dist/react-native/utils/clipboard.d.ts +27 -0
- package/dist/react-native/utils/index.d.ts +2 -0
- package/dist/react-native/utils/tw.d.ts +7 -0
- package/dist/shared/constants/colors.d.ts +25 -0
- package/dist/shared/constants/index.d.ts +2 -0
- package/dist/shared/constants/sizes.d.ts +49 -0
- package/dist/shared/index.cjs.js +171 -0
- package/dist/shared/index.cjs.js.map +1 -0
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.esm.js +161 -0
- package/dist/shared/index.esm.js.map +1 -0
- package/dist/shared/types/common.d.ts +33 -0
- package/dist/shared/types/index.d.ts +1 -0
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/styles.css +1 -1
- package/package.json +50 -8
- /package/dist/{react → shared}/utils/datetime.d.ts +0 -0
|
@@ -0,0 +1,2808 @@
|
|
|
1
|
+
import { __rest } from 'tslib';
|
|
2
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import { Text as Text$1, Pressable, ActivityIndicator, View, TextInput, TouchableOpacity, ScrollView, Platform } from 'react-native';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
import { create } from 'twrnc';
|
|
6
|
+
import { useState, useMemo, useRef, useCallback, useEffect } from 'react';
|
|
7
|
+
import Svg, { Path, G, Defs, ClipPath, Rect, Circle, Line, SvgXml } from 'react-native-svg';
|
|
8
|
+
import { minidenticon } from 'minidenticons';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Tailwind utility for React Native using twrnc
|
|
12
|
+
* Converts Tailwind className strings to React Native style objects
|
|
13
|
+
*/
|
|
14
|
+
// Inline Tailwind config with Dash brand colors for React Native
|
|
15
|
+
// Colors from src/styles/theme.pcss
|
|
16
|
+
const tailwindConfig = {
|
|
17
|
+
theme: {
|
|
18
|
+
extend: {
|
|
19
|
+
colors: {
|
|
20
|
+
// Dash brand colors - matching Web version
|
|
21
|
+
'dash-brand': '#4C7EFF',
|
|
22
|
+
// Primary brand color
|
|
23
|
+
'dash-brand-dim': '#96A7FF',
|
|
24
|
+
// Dimmed brand color
|
|
25
|
+
'dash-brand-dark': '#4D5895',
|
|
26
|
+
// Dark brand color
|
|
27
|
+
'dash-brand-darkness': '#13172A',
|
|
28
|
+
// Darkest brand color
|
|
29
|
+
'dash-mint': '#60F6D2',
|
|
30
|
+
// Mint/teal color
|
|
31
|
+
'dash-mint-hover': '#4DD4B1',
|
|
32
|
+
// Mint hover state
|
|
33
|
+
'dash-yellow-light': '#FEF3C7',
|
|
34
|
+
// Light yellow
|
|
35
|
+
'dash-yellow': '#FDE68A',
|
|
36
|
+
// Yellow
|
|
37
|
+
'dash-primary-die-subdued': '#0c1c3308',
|
|
38
|
+
// Subdued color with alpha
|
|
39
|
+
'dash-primary-dark-blue': '#0C1C33',
|
|
40
|
+
// Dark blue
|
|
41
|
+
// State colors
|
|
42
|
+
'dash-green': '#40BF40',
|
|
43
|
+
'dash-red': '#CD2E00',
|
|
44
|
+
'dash-orange': '#F98F12'
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
// Create a tailwind instance with React Native compatible colors
|
|
50
|
+
const tw = create(tailwindConfig);
|
|
51
|
+
/**
|
|
52
|
+
* Helper to convert className string to React Native style object
|
|
53
|
+
* @param className - Tailwind class names string
|
|
54
|
+
* @returns React Native style object
|
|
55
|
+
*/
|
|
56
|
+
const cn = className => tw`${className}`;
|
|
57
|
+
|
|
58
|
+
const textStyles$2 = cva('', {
|
|
59
|
+
variants: {
|
|
60
|
+
variant: {
|
|
61
|
+
body: 'text-base',
|
|
62
|
+
caption: 'text-sm',
|
|
63
|
+
label: 'text-xs'
|
|
64
|
+
},
|
|
65
|
+
weight: {
|
|
66
|
+
regular: 'font-normal',
|
|
67
|
+
medium: 'font-medium',
|
|
68
|
+
semibold: 'font-semibold',
|
|
69
|
+
bold: 'font-bold'
|
|
70
|
+
},
|
|
71
|
+
color: {
|
|
72
|
+
default: 'text-gray-900 dark:text-gray-100',
|
|
73
|
+
blue: 'text-dash-brand',
|
|
74
|
+
red: 'text-red-700 dark:text-red-400',
|
|
75
|
+
gray: 'text-gray-600 dark:text-gray-400'
|
|
76
|
+
},
|
|
77
|
+
italic: {
|
|
78
|
+
false: '',
|
|
79
|
+
true: 'italic'
|
|
80
|
+
},
|
|
81
|
+
underline: {
|
|
82
|
+
false: '',
|
|
83
|
+
true: 'underline'
|
|
84
|
+
},
|
|
85
|
+
lineThrough: {
|
|
86
|
+
false: '',
|
|
87
|
+
true: 'line-through'
|
|
88
|
+
},
|
|
89
|
+
transform: {
|
|
90
|
+
none: '',
|
|
91
|
+
uppercase: 'uppercase',
|
|
92
|
+
capitalize: 'capitalize'
|
|
93
|
+
},
|
|
94
|
+
opacity: {
|
|
95
|
+
100: 'opacity-100',
|
|
96
|
+
80: 'opacity-80',
|
|
97
|
+
60: 'opacity-60',
|
|
98
|
+
40: 'opacity-40'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
defaultVariants: {
|
|
102
|
+
variant: 'body',
|
|
103
|
+
weight: 'regular',
|
|
104
|
+
color: 'default',
|
|
105
|
+
italic: false,
|
|
106
|
+
underline: false,
|
|
107
|
+
lineThrough: false,
|
|
108
|
+
transform: 'none',
|
|
109
|
+
opacity: 100
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
/**
|
|
113
|
+
* React Native Text component with variants, weights, and styling options.
|
|
114
|
+
* Uses twrnc for Tailwind-like styling converted to React Native styles.
|
|
115
|
+
*/
|
|
116
|
+
const Text = _a => {
|
|
117
|
+
var {
|
|
118
|
+
variant,
|
|
119
|
+
weight,
|
|
120
|
+
color,
|
|
121
|
+
italic,
|
|
122
|
+
underline,
|
|
123
|
+
lineThrough,
|
|
124
|
+
transform,
|
|
125
|
+
opacity,
|
|
126
|
+
className = '',
|
|
127
|
+
style,
|
|
128
|
+
children
|
|
129
|
+
} = _a,
|
|
130
|
+
props = __rest(_a, ["variant", "weight", "color", "italic", "underline", "lineThrough", "transform", "opacity", "className", "style", "children"]);
|
|
131
|
+
const classes = textStyles$2({
|
|
132
|
+
variant,
|
|
133
|
+
weight,
|
|
134
|
+
color,
|
|
135
|
+
italic,
|
|
136
|
+
underline,
|
|
137
|
+
lineThrough,
|
|
138
|
+
transform,
|
|
139
|
+
opacity
|
|
140
|
+
}) + (className ? ` ${className}` : '');
|
|
141
|
+
// Convert Tailwind classes to React Native style object
|
|
142
|
+
const textStyle = [cn(classes), style].filter(Boolean);
|
|
143
|
+
return jsx(Text$1, Object.assign({
|
|
144
|
+
style: textStyle
|
|
145
|
+
}, props, {
|
|
146
|
+
children: children
|
|
147
|
+
}));
|
|
148
|
+
};
|
|
149
|
+
|
|
150
|
+
const headingStyles = cva('font-bold text-gray-900 dark:text-gray-100', {
|
|
151
|
+
variants: {
|
|
152
|
+
level: {
|
|
153
|
+
1: 'text-4xl',
|
|
154
|
+
2: 'text-3xl',
|
|
155
|
+
3: 'text-2xl',
|
|
156
|
+
4: 'text-xl',
|
|
157
|
+
5: 'text-lg',
|
|
158
|
+
6: 'text-base'
|
|
159
|
+
},
|
|
160
|
+
weight: {
|
|
161
|
+
normal: 'font-normal',
|
|
162
|
+
medium: 'font-medium',
|
|
163
|
+
semibold: 'font-semibold',
|
|
164
|
+
bold: 'font-bold',
|
|
165
|
+
extrabold: 'font-extrabold'
|
|
166
|
+
},
|
|
167
|
+
color: {
|
|
168
|
+
default: '',
|
|
169
|
+
black: 'text-black dark:text-white',
|
|
170
|
+
gray: 'text-gray-600 dark:text-gray-300',
|
|
171
|
+
blue: 'text-blue-600 dark:text-blue-400',
|
|
172
|
+
red: 'text-red-600 dark:text-red-400',
|
|
173
|
+
green: 'text-green-600 dark:text-green-400'
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
defaultVariants: {
|
|
177
|
+
level: 1,
|
|
178
|
+
weight: 'extrabold',
|
|
179
|
+
color: 'default'
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
/**
|
|
183
|
+
* React Native Heading component with semantic levels and customizable styling.
|
|
184
|
+
* Uses twrnc for Tailwind-like styling converted to React Native styles.
|
|
185
|
+
*/
|
|
186
|
+
const Heading = _a => {
|
|
187
|
+
var {
|
|
188
|
+
level,
|
|
189
|
+
weight,
|
|
190
|
+
color,
|
|
191
|
+
className = '',
|
|
192
|
+
style,
|
|
193
|
+
children
|
|
194
|
+
} = _a,
|
|
195
|
+
props = __rest(_a, ["level", "weight", "color", "className", "style", "children"]);
|
|
196
|
+
const classes = headingStyles({
|
|
197
|
+
level,
|
|
198
|
+
weight,
|
|
199
|
+
color
|
|
200
|
+
}) + (className ? ` ${className}` : '');
|
|
201
|
+
// Convert Tailwind classes to React Native style object
|
|
202
|
+
const headingStyle = [cn(classes), style].filter(Boolean);
|
|
203
|
+
return jsx(Text$1, Object.assign({
|
|
204
|
+
style: headingStyle
|
|
205
|
+
}, props, {
|
|
206
|
+
children: children
|
|
207
|
+
}));
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
const buttonStyles = cva('items-center justify-center flex-row min-h-11 transition-colors border border-transparent', {
|
|
211
|
+
variants: {
|
|
212
|
+
variant: {
|
|
213
|
+
solid: '',
|
|
214
|
+
outline: 'border-current bg-transparent',
|
|
215
|
+
ghost: 'bg-transparent border-transparent'
|
|
216
|
+
},
|
|
217
|
+
colorScheme: {
|
|
218
|
+
brand: '',
|
|
219
|
+
mint: '',
|
|
220
|
+
gray: '',
|
|
221
|
+
red: '',
|
|
222
|
+
lightBlue: '',
|
|
223
|
+
lightGray: '',
|
|
224
|
+
white: '',
|
|
225
|
+
halfWhite: '',
|
|
226
|
+
halfBlue: ''
|
|
227
|
+
},
|
|
228
|
+
size: {
|
|
229
|
+
sm: 'px-3 py-2',
|
|
230
|
+
md: 'px-[18px] py-3',
|
|
231
|
+
lg: 'px-6 py-4',
|
|
232
|
+
xl: 'px-[25px] py-5'
|
|
233
|
+
},
|
|
234
|
+
rounded: {
|
|
235
|
+
default: '',
|
|
236
|
+
full: 'rounded-full'
|
|
237
|
+
},
|
|
238
|
+
disabled: {
|
|
239
|
+
false: '',
|
|
240
|
+
true: 'opacity-50'
|
|
241
|
+
}
|
|
242
|
+
},
|
|
243
|
+
compoundVariants: [
|
|
244
|
+
// Border radius per size (when rounded is default)
|
|
245
|
+
{
|
|
246
|
+
size: 'sm',
|
|
247
|
+
rounded: 'default',
|
|
248
|
+
class: 'rounded-[10px]'
|
|
249
|
+
}, {
|
|
250
|
+
size: 'md',
|
|
251
|
+
rounded: 'default',
|
|
252
|
+
class: 'rounded-[14px]'
|
|
253
|
+
}, {
|
|
254
|
+
size: 'lg',
|
|
255
|
+
rounded: 'default',
|
|
256
|
+
class: 'rounded-[14px]'
|
|
257
|
+
}, {
|
|
258
|
+
size: 'xl',
|
|
259
|
+
rounded: 'default',
|
|
260
|
+
class: 'rounded-[16px]'
|
|
261
|
+
},
|
|
262
|
+
// Solid variants - brand
|
|
263
|
+
{
|
|
264
|
+
variant: 'solid',
|
|
265
|
+
colorScheme: 'brand',
|
|
266
|
+
disabled: false,
|
|
267
|
+
class: 'bg-dash-brand'
|
|
268
|
+
}, {
|
|
269
|
+
variant: 'solid',
|
|
270
|
+
colorScheme: 'mint',
|
|
271
|
+
disabled: false,
|
|
272
|
+
class: 'bg-dash-mint'
|
|
273
|
+
}, {
|
|
274
|
+
variant: 'solid',
|
|
275
|
+
colorScheme: 'gray',
|
|
276
|
+
disabled: false,
|
|
277
|
+
class: 'bg-gray-200 dark:bg-gray-600'
|
|
278
|
+
}, {
|
|
279
|
+
variant: 'solid',
|
|
280
|
+
colorScheme: 'red',
|
|
281
|
+
disabled: false,
|
|
282
|
+
class: 'bg-red-200 dark:bg-red-600'
|
|
283
|
+
}, {
|
|
284
|
+
variant: 'solid',
|
|
285
|
+
colorScheme: 'lightBlue',
|
|
286
|
+
disabled: false,
|
|
287
|
+
class: 'bg-dash-brand/10 dark:bg-dash-brand/20'
|
|
288
|
+
}, {
|
|
289
|
+
variant: 'solid',
|
|
290
|
+
colorScheme: 'lightGray',
|
|
291
|
+
disabled: false,
|
|
292
|
+
class: 'bg-gray-100 dark:bg-gray-700/20'
|
|
293
|
+
}, {
|
|
294
|
+
variant: 'solid',
|
|
295
|
+
colorScheme: 'white',
|
|
296
|
+
disabled: false,
|
|
297
|
+
class: 'bg-white'
|
|
298
|
+
}, {
|
|
299
|
+
variant: 'solid',
|
|
300
|
+
colorScheme: 'halfWhite',
|
|
301
|
+
disabled: false,
|
|
302
|
+
class: 'bg-white/15'
|
|
303
|
+
}, {
|
|
304
|
+
variant: 'solid',
|
|
305
|
+
colorScheme: 'halfBlue',
|
|
306
|
+
disabled: false,
|
|
307
|
+
class: 'bg-dash-brand/15'
|
|
308
|
+
},
|
|
309
|
+
// Outline variants
|
|
310
|
+
{
|
|
311
|
+
variant: 'outline',
|
|
312
|
+
colorScheme: 'brand',
|
|
313
|
+
class: 'border-dash-brand'
|
|
314
|
+
}, {
|
|
315
|
+
variant: 'outline',
|
|
316
|
+
colorScheme: 'mint',
|
|
317
|
+
class: 'border-dash-mint'
|
|
318
|
+
}, {
|
|
319
|
+
variant: 'outline',
|
|
320
|
+
colorScheme: 'gray',
|
|
321
|
+
class: 'border-gray-700 dark:border-gray-300'
|
|
322
|
+
}, {
|
|
323
|
+
variant: 'outline',
|
|
324
|
+
colorScheme: 'red',
|
|
325
|
+
class: 'border-red-700 dark:border-red-400'
|
|
326
|
+
}, {
|
|
327
|
+
variant: 'outline',
|
|
328
|
+
colorScheme: 'white',
|
|
329
|
+
class: 'border-white'
|
|
330
|
+
}, {
|
|
331
|
+
variant: 'outline',
|
|
332
|
+
colorScheme: 'halfWhite',
|
|
333
|
+
class: 'border-white/50'
|
|
334
|
+
}, {
|
|
335
|
+
variant: 'outline',
|
|
336
|
+
colorScheme: 'halfBlue',
|
|
337
|
+
class: 'border-dash-brand/50'
|
|
338
|
+
}],
|
|
339
|
+
defaultVariants: {
|
|
340
|
+
variant: 'solid',
|
|
341
|
+
colorScheme: 'brand',
|
|
342
|
+
size: 'md',
|
|
343
|
+
rounded: 'default',
|
|
344
|
+
disabled: false
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
const textStyles$1 = cva('font-medium', {
|
|
348
|
+
variants: {
|
|
349
|
+
variant: {
|
|
350
|
+
solid: '',
|
|
351
|
+
outline: '',
|
|
352
|
+
ghost: ''
|
|
353
|
+
},
|
|
354
|
+
colorScheme: {
|
|
355
|
+
brand: '',
|
|
356
|
+
mint: '',
|
|
357
|
+
gray: '',
|
|
358
|
+
red: '',
|
|
359
|
+
lightBlue: '',
|
|
360
|
+
lightGray: '',
|
|
361
|
+
white: '',
|
|
362
|
+
halfWhite: '',
|
|
363
|
+
halfBlue: ''
|
|
364
|
+
},
|
|
365
|
+
size: {
|
|
366
|
+
sm: 'text-sm',
|
|
367
|
+
// 14px
|
|
368
|
+
md: 'text-base',
|
|
369
|
+
// 16px
|
|
370
|
+
lg: 'text-base',
|
|
371
|
+
// 16px
|
|
372
|
+
xl: 'text-lg' // 18px
|
|
373
|
+
}
|
|
374
|
+
},
|
|
375
|
+
compoundVariants: [
|
|
376
|
+
// Solid text colors
|
|
377
|
+
{
|
|
378
|
+
variant: 'solid',
|
|
379
|
+
colorScheme: 'brand',
|
|
380
|
+
class: 'text-white'
|
|
381
|
+
}, {
|
|
382
|
+
variant: 'solid',
|
|
383
|
+
colorScheme: 'mint',
|
|
384
|
+
class: 'text-black'
|
|
385
|
+
}, {
|
|
386
|
+
variant: 'solid',
|
|
387
|
+
colorScheme: 'gray',
|
|
388
|
+
class: 'text-gray-700 dark:text-gray-100'
|
|
389
|
+
}, {
|
|
390
|
+
variant: 'solid',
|
|
391
|
+
colorScheme: 'red',
|
|
392
|
+
class: 'text-red-700 dark:text-red-100'
|
|
393
|
+
}, {
|
|
394
|
+
variant: 'solid',
|
|
395
|
+
colorScheme: 'lightBlue',
|
|
396
|
+
class: 'text-dash-brand'
|
|
397
|
+
}, {
|
|
398
|
+
variant: 'solid',
|
|
399
|
+
colorScheme: 'lightGray',
|
|
400
|
+
class: 'text-gray-900 dark:text-gray-300'
|
|
401
|
+
}, {
|
|
402
|
+
variant: 'solid',
|
|
403
|
+
colorScheme: 'white',
|
|
404
|
+
class: 'text-dash-brand'
|
|
405
|
+
}, {
|
|
406
|
+
variant: 'solid',
|
|
407
|
+
colorScheme: 'halfWhite',
|
|
408
|
+
class: 'text-white'
|
|
409
|
+
}, {
|
|
410
|
+
variant: 'solid',
|
|
411
|
+
colorScheme: 'halfBlue',
|
|
412
|
+
class: 'text-dash-brand'
|
|
413
|
+
},
|
|
414
|
+
// Outline text colors
|
|
415
|
+
{
|
|
416
|
+
variant: 'outline',
|
|
417
|
+
colorScheme: 'brand',
|
|
418
|
+
class: 'text-dash-brand'
|
|
419
|
+
}, {
|
|
420
|
+
variant: 'outline',
|
|
421
|
+
colorScheme: 'mint',
|
|
422
|
+
class: 'text-dash-mint'
|
|
423
|
+
}, {
|
|
424
|
+
variant: 'outline',
|
|
425
|
+
colorScheme: 'gray',
|
|
426
|
+
class: 'text-gray-700 dark:text-gray-300'
|
|
427
|
+
}, {
|
|
428
|
+
variant: 'outline',
|
|
429
|
+
colorScheme: 'red',
|
|
430
|
+
class: 'text-red-700 dark:text-red-400'
|
|
431
|
+
}, {
|
|
432
|
+
variant: 'outline',
|
|
433
|
+
colorScheme: 'white',
|
|
434
|
+
class: 'text-white'
|
|
435
|
+
}, {
|
|
436
|
+
variant: 'outline',
|
|
437
|
+
colorScheme: 'halfWhite',
|
|
438
|
+
class: 'text-white'
|
|
439
|
+
}, {
|
|
440
|
+
variant: 'outline',
|
|
441
|
+
colorScheme: 'halfBlue',
|
|
442
|
+
class: 'text-dash-brand'
|
|
443
|
+
},
|
|
444
|
+
// Ghost text colors
|
|
445
|
+
{
|
|
446
|
+
variant: 'ghost',
|
|
447
|
+
colorScheme: 'brand',
|
|
448
|
+
class: 'text-dash-brand'
|
|
449
|
+
}],
|
|
450
|
+
defaultVariants: {
|
|
451
|
+
variant: 'solid',
|
|
452
|
+
colorScheme: 'brand',
|
|
453
|
+
size: 'md'
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
/**
|
|
457
|
+
* React Native Button component with variants, color schemes, sizes, and loading state.
|
|
458
|
+
* Uses Pressable for touch interactions and twrnc for Tailwind styling.
|
|
459
|
+
*/
|
|
460
|
+
const Button = _a => {
|
|
461
|
+
var {
|
|
462
|
+
variant,
|
|
463
|
+
colorScheme,
|
|
464
|
+
size,
|
|
465
|
+
rounded,
|
|
466
|
+
disabled = false,
|
|
467
|
+
loading = false,
|
|
468
|
+
className = '',
|
|
469
|
+
style,
|
|
470
|
+
textStyle,
|
|
471
|
+
children,
|
|
472
|
+
onPress
|
|
473
|
+
} = _a,
|
|
474
|
+
props = __rest(_a, ["variant", "colorScheme", "size", "rounded", "disabled", "loading", "className", "style", "textStyle", "children", "onPress"]);
|
|
475
|
+
const isDisabled = disabled || loading;
|
|
476
|
+
const buttonClasses = buttonStyles({
|
|
477
|
+
variant,
|
|
478
|
+
colorScheme,
|
|
479
|
+
size,
|
|
480
|
+
rounded,
|
|
481
|
+
disabled: isDisabled
|
|
482
|
+
}) + (className ? ` ${className}` : '');
|
|
483
|
+
const textClasses = textStyles$1({
|
|
484
|
+
variant,
|
|
485
|
+
colorScheme,
|
|
486
|
+
size
|
|
487
|
+
});
|
|
488
|
+
// Convert Tailwind classes to React Native style objects
|
|
489
|
+
const buttonStyle = [cn(buttonClasses), style].filter(Boolean);
|
|
490
|
+
const textStyleMerged = [cn(textClasses), textStyle].filter(Boolean);
|
|
491
|
+
return jsx(Pressable, Object.assign({
|
|
492
|
+
style: ({
|
|
493
|
+
pressed
|
|
494
|
+
}) => [...buttonStyle, pressed && !isDisabled && {
|
|
495
|
+
opacity: 0.7
|
|
496
|
+
}],
|
|
497
|
+
disabled: isDisabled,
|
|
498
|
+
onPress: onPress
|
|
499
|
+
}, props, {
|
|
500
|
+
children: loading ? jsx(ActivityIndicator, {
|
|
501
|
+
size: "small",
|
|
502
|
+
color: variant === 'solid' && colorScheme === 'brand' ? '#fff' : '#3B82F6'
|
|
503
|
+
}) : typeof children === 'string' ? jsx(Text$1, {
|
|
504
|
+
style: textStyleMerged,
|
|
505
|
+
children: children
|
|
506
|
+
}) : children
|
|
507
|
+
}));
|
|
508
|
+
};
|
|
509
|
+
|
|
510
|
+
const ArrowIcon = ({
|
|
511
|
+
color = 'white',
|
|
512
|
+
size = 14,
|
|
513
|
+
onPress
|
|
514
|
+
}) => {
|
|
515
|
+
return jsx(Svg, {
|
|
516
|
+
width: size,
|
|
517
|
+
height: size,
|
|
518
|
+
viewBox: '0 0 9 14',
|
|
519
|
+
fill: 'none',
|
|
520
|
+
onPress: onPress,
|
|
521
|
+
color: color,
|
|
522
|
+
children: jsx(Path, {
|
|
523
|
+
d: 'M7.29297 0.292893C7.68349 -0.0976311 8.31651 -0.0976311 8.70703 0.292893C9.09756 0.683418 9.09756 1.31643 8.70703 1.70696L3.41406 6.99992L8.70703 12.2929L8.77539 12.3691C9.09574 12.7618 9.07315 13.3408 8.70703 13.707C8.34092 14.0731 7.76191 14.0957 7.36914 13.7753L7.29297 13.707L0.585938 6.99992L7.29297 0.292893Z',
|
|
524
|
+
fill: color
|
|
525
|
+
})
|
|
526
|
+
});
|
|
527
|
+
};
|
|
528
|
+
const CopyIcon = ({
|
|
529
|
+
color = 'white',
|
|
530
|
+
size = 16,
|
|
531
|
+
onPress
|
|
532
|
+
}) => {
|
|
533
|
+
return jsxs(Svg, {
|
|
534
|
+
width: size,
|
|
535
|
+
height: size,
|
|
536
|
+
viewBox: '0 0 16 16',
|
|
537
|
+
fill: 'none',
|
|
538
|
+
onPress: onPress,
|
|
539
|
+
color: color,
|
|
540
|
+
children: [jsx(G, {
|
|
541
|
+
clipPath: 'url(#clip0_3876_6767)',
|
|
542
|
+
children: jsx(G, {
|
|
543
|
+
clipPath: 'url(#clip1_3876_6767)',
|
|
544
|
+
children: jsx(G, {
|
|
545
|
+
clipPath: 'url(#clip2_3876_6767)',
|
|
546
|
+
children: jsx(Path, {
|
|
547
|
+
d: 'M11.4512 10.5645H5.28516V1.75586H9.32335L11.4512 3.88369V10.5645ZM12.332 3.51758L9.68945 0.875H5.28516H4.4043V1.75586V10.5645V11.4453H5.28516H11.4512H12.332V10.5645V3.51758ZM0.880859 4.39844H0V5.2793V14.0879V14.9688H0.880859H7.04688H7.92773V14.0879V12.3262H7.04688V14.0879H0.880859V5.2793H3.52344V4.39844H0.880859Z',
|
|
548
|
+
fill: color
|
|
549
|
+
})
|
|
550
|
+
})
|
|
551
|
+
})
|
|
552
|
+
}), jsxs(Defs, {
|
|
553
|
+
children: [jsx(ClipPath, {
|
|
554
|
+
id: 'clip0_3876_6767',
|
|
555
|
+
children: jsx(Rect, {
|
|
556
|
+
width: '16',
|
|
557
|
+
height: '16',
|
|
558
|
+
fill: 'white'
|
|
559
|
+
})
|
|
560
|
+
}), jsx(ClipPath, {
|
|
561
|
+
id: 'clip1_3876_6767',
|
|
562
|
+
children: jsx(Rect, {
|
|
563
|
+
width: '16',
|
|
564
|
+
height: '14.25',
|
|
565
|
+
fill: 'white',
|
|
566
|
+
transform: 'translate(0 0.875)'
|
|
567
|
+
})
|
|
568
|
+
}), jsx(ClipPath, {
|
|
569
|
+
id: 'clip2_3876_6767',
|
|
570
|
+
children: jsx(Rect, {
|
|
571
|
+
width: '12.332',
|
|
572
|
+
height: '14.0938',
|
|
573
|
+
fill: 'white',
|
|
574
|
+
transform: 'translate(0 0.875)'
|
|
575
|
+
})
|
|
576
|
+
})]
|
|
577
|
+
})]
|
|
578
|
+
});
|
|
579
|
+
};
|
|
580
|
+
const SuccessIcon = ({
|
|
581
|
+
color = '#1CC400',
|
|
582
|
+
size = 18,
|
|
583
|
+
onPress
|
|
584
|
+
}) => jsxs(Svg, {
|
|
585
|
+
width: size,
|
|
586
|
+
height: size,
|
|
587
|
+
viewBox: '0 0 18 18',
|
|
588
|
+
fill: 'none',
|
|
589
|
+
onPress: onPress,
|
|
590
|
+
color: color,
|
|
591
|
+
children: [jsx(Circle, {
|
|
592
|
+
cx: '9',
|
|
593
|
+
cy: '9',
|
|
594
|
+
r: '9',
|
|
595
|
+
fill: color,
|
|
596
|
+
fillOpacity: '.2'
|
|
597
|
+
}), jsx(Path, {
|
|
598
|
+
d: 'M5 8.5L8 11.5L13.5 6',
|
|
599
|
+
stroke: color,
|
|
600
|
+
strokeWidth: '2',
|
|
601
|
+
strokeLinecap: 'round'
|
|
602
|
+
})]
|
|
603
|
+
});
|
|
604
|
+
const ErrorIcon = ({
|
|
605
|
+
color = '#F45858',
|
|
606
|
+
size = 18,
|
|
607
|
+
onPress
|
|
608
|
+
}) => jsxs(Svg, {
|
|
609
|
+
width: size,
|
|
610
|
+
height: size,
|
|
611
|
+
viewBox: '0 0 18 18',
|
|
612
|
+
fill: 'none',
|
|
613
|
+
onPress: onPress,
|
|
614
|
+
color: color,
|
|
615
|
+
children: [jsx(Rect, {
|
|
616
|
+
width: '18',
|
|
617
|
+
height: '18',
|
|
618
|
+
rx: '4',
|
|
619
|
+
fill: color,
|
|
620
|
+
fillOpacity: '.2'
|
|
621
|
+
}), jsx(Path, {
|
|
622
|
+
d: 'M9.06951 10L9.0695 4.86092',
|
|
623
|
+
stroke: color,
|
|
624
|
+
strokeWidth: '2',
|
|
625
|
+
strokeLinecap: 'round'
|
|
626
|
+
}), jsx(Path, {
|
|
627
|
+
d: 'M9.06951 13L9.06951 13.0102',
|
|
628
|
+
stroke: color,
|
|
629
|
+
strokeWidth: '2',
|
|
630
|
+
strokeLinecap: 'round'
|
|
631
|
+
})]
|
|
632
|
+
});
|
|
633
|
+
const CheckIcon = ({
|
|
634
|
+
color = '#4C7EFF',
|
|
635
|
+
size = 20,
|
|
636
|
+
onPress
|
|
637
|
+
}) => {
|
|
638
|
+
return jsxs(Svg, {
|
|
639
|
+
width: size,
|
|
640
|
+
height: size,
|
|
641
|
+
viewBox: '0 0 20 20',
|
|
642
|
+
fill: 'none',
|
|
643
|
+
onPress: onPress,
|
|
644
|
+
children: [jsx(Circle, {
|
|
645
|
+
cx: '10',
|
|
646
|
+
cy: '10',
|
|
647
|
+
r: '10',
|
|
648
|
+
fill: 'rgba(12, 28, 51, 0.05)'
|
|
649
|
+
}), jsx(Path, {
|
|
650
|
+
d: 'M6.33 10L8.83 12.5L13.67 7.67',
|
|
651
|
+
stroke: color,
|
|
652
|
+
strokeWidth: '1.5',
|
|
653
|
+
strokeLinecap: 'round',
|
|
654
|
+
strokeLinejoin: 'round'
|
|
655
|
+
})]
|
|
656
|
+
});
|
|
657
|
+
};
|
|
658
|
+
const CrossIcon = ({
|
|
659
|
+
color = '#0C1C33',
|
|
660
|
+
size = 16,
|
|
661
|
+
onPress
|
|
662
|
+
}) => jsx(Svg, {
|
|
663
|
+
width: size,
|
|
664
|
+
height: size * 17 / 16,
|
|
665
|
+
viewBox: '0 0 16 17',
|
|
666
|
+
fill: 'none',
|
|
667
|
+
onPress: onPress,
|
|
668
|
+
color: color,
|
|
669
|
+
children: jsx(Path, {
|
|
670
|
+
d: 'M13.5693 3.40266L13.0973 2.93066L8 8.02866L2.90266 2.93066L2.43066 3.40266L7.52866 8.5L2.43066 13.5973L2.90266 14.0693L8 8.97133L13.0973 14.0693L13.5693 13.5973L8.47133 8.5L13.5693 3.40266Z',
|
|
671
|
+
fill: color
|
|
672
|
+
})
|
|
673
|
+
});
|
|
674
|
+
const PlusIcon = ({
|
|
675
|
+
color = '#4C7EFF',
|
|
676
|
+
size = 17,
|
|
677
|
+
onPress
|
|
678
|
+
}) => jsx(Svg, {
|
|
679
|
+
width: size,
|
|
680
|
+
height: size * 16 / 17,
|
|
681
|
+
viewBox: '0 0 17 16',
|
|
682
|
+
fill: 'none',
|
|
683
|
+
onPress: onPress,
|
|
684
|
+
color: color,
|
|
685
|
+
children: jsx(Path, {
|
|
686
|
+
d: 'M15.1667 7.66665H8.83337V1.33331H8.16671V7.66665H1.83337V8.33331H8.16671V14.6666H8.83337V8.33331H15.1667V7.66665Z',
|
|
687
|
+
fill: color
|
|
688
|
+
})
|
|
689
|
+
});
|
|
690
|
+
const ChevronIcon = ({
|
|
691
|
+
color = '#0C1C33',
|
|
692
|
+
size = 12,
|
|
693
|
+
onPress
|
|
694
|
+
}) => jsx(Svg, {
|
|
695
|
+
width: size,
|
|
696
|
+
height: size,
|
|
697
|
+
viewBox: '0 0 12 12',
|
|
698
|
+
fill: 'none',
|
|
699
|
+
onPress: onPress,
|
|
700
|
+
color: color,
|
|
701
|
+
children: jsx(Path, {
|
|
702
|
+
d: 'M6 8.9395L1.65149 4.59099L2.18149 4.06049L6 7.879L9.8185 4.06049L10.3485 4.59099L6 8.9395Z',
|
|
703
|
+
fill: color
|
|
704
|
+
})
|
|
705
|
+
});
|
|
706
|
+
const SearchIcon = ({
|
|
707
|
+
color = '#0C1C33',
|
|
708
|
+
size = 16,
|
|
709
|
+
onPress
|
|
710
|
+
}) => jsx(Svg, {
|
|
711
|
+
width: size,
|
|
712
|
+
height: size,
|
|
713
|
+
viewBox: '0 0 16 16',
|
|
714
|
+
fill: 'none',
|
|
715
|
+
onPress: onPress,
|
|
716
|
+
color: color,
|
|
717
|
+
children: jsx(Path, {
|
|
718
|
+
d: 'M14.569 14.0977L10.6623 10.191C11.5815 9.14938 12.0591 7.79092 11.9941 6.40327C11.9292 5.01564 11.3267 3.70776 10.3143 2.75659C9.30178 1.80542 7.95892 1.28563 6.56994 1.30729C5.18095 1.32895 3.85492 1.89036 2.87264 2.87264C1.89036 3.85492 1.32895 5.18095 1.30729 6.56994C1.28563 7.95892 1.80542 9.30178 2.75659 10.3143C3.70776 11.3267 5.01564 11.9292 6.40327 11.9941C7.79092 12.0591 9.14938 11.5815 10.191 10.6623L14.0977 14.569L14.569 14.0977ZM6.66665 11.3333C5.74364 11.3333 4.84138 11.0596 4.07396 10.5468C3.30653 10.0341 2.70839 9.30518 2.35518 8.45245C2.00197 7.59978 1.90956 6.66145 2.08962 5.7562C2.26968 4.85095 2.71414 4.01943 3.36678 3.36678C4.01943 2.71414 4.85095 2.26968 5.7562 2.08962C6.66145 1.90956 7.59978 2.00197 8.45245 2.35518C9.30518 2.70839 10.0341 3.30653 10.5468 4.07396C11.0596 4.84138 11.3333 5.74364 11.3333 6.66665C11.3319 7.90385 10.8398 9.09005 9.96492 9.96492C9.09005 10.8398 7.90385 11.3319 6.66665 11.3333Z',
|
|
719
|
+
fill: color
|
|
720
|
+
})
|
|
721
|
+
});
|
|
722
|
+
const InfoCircleIcon = ({
|
|
723
|
+
color = '#4C7EFF',
|
|
724
|
+
size = 19,
|
|
725
|
+
onPress
|
|
726
|
+
}) => jsxs(Svg, {
|
|
727
|
+
width: size,
|
|
728
|
+
height: size,
|
|
729
|
+
viewBox: '0 0 19 19',
|
|
730
|
+
fill: 'none',
|
|
731
|
+
onPress: onPress,
|
|
732
|
+
color: color,
|
|
733
|
+
children: [jsxs(G, {
|
|
734
|
+
clipPath: 'url(#clip0_1166_258)',
|
|
735
|
+
children: [jsx(Path, {
|
|
736
|
+
d: 'M9.5 5.5H9.51ZM9.5 8.5V13.5ZM18.5 9.5C18.5 14.4706 14.4706 18.5 9.5 18.5C4.52944 18.5 0.5 14.4706 0.5 9.5C0.5 4.52944 4.52944 0.5 9.5 0.5C14.4706 0.5 18.5 4.52944 18.5 9.5Z',
|
|
737
|
+
fill: color,
|
|
738
|
+
fillOpacity: '0.05'
|
|
739
|
+
}), jsx(Path, {
|
|
740
|
+
d: 'M18 9.5C18 4.80558 14.1945 1 9.5 1C4.80558 1 1 4.80558 1 9.5C1 14.1945 4.80558 18 9.5 18C14.1945 18 18 14.1945 18 9.5ZM9 13.5V8.5C9 8.22386 9.22386 8 9.5 8C9.77614 8 10 8.22386 10 8.5V13.5C10 13.7761 9.77614 14 9.5 14C9.22386 14 9 13.7761 9 13.5ZM9.50977 5C9.78591 5 10.0098 5.22386 10.0098 5.5C10.0098 5.77614 9.78591 6 9.50977 6H9.5C9.22386 6 9 5.77614 9 5.5C9 5.22386 9.22386 5 9.5 5H9.50977ZM19 9.5C19 14.7467 14.7467 19 9.5 19C4.2533 19 0 14.7467 0 9.5C0 4.2533 4.2533 0 9.5 0C14.7467 0 19 4.2533 19 9.5Z',
|
|
741
|
+
fill: color
|
|
742
|
+
})]
|
|
743
|
+
}), jsx(Defs, {
|
|
744
|
+
children: jsx(ClipPath, {
|
|
745
|
+
id: 'clip0_1166_258',
|
|
746
|
+
children: jsx(Rect, {
|
|
747
|
+
width: '19',
|
|
748
|
+
height: '19',
|
|
749
|
+
fill: 'white'
|
|
750
|
+
})
|
|
751
|
+
})
|
|
752
|
+
})]
|
|
753
|
+
});
|
|
754
|
+
const EyeOpenIcon = ({
|
|
755
|
+
color = 'currentColor',
|
|
756
|
+
size = 16,
|
|
757
|
+
onPress
|
|
758
|
+
}) => jsx(Svg, {
|
|
759
|
+
width: size,
|
|
760
|
+
height: size * 10 / 16,
|
|
761
|
+
viewBox: '0 0 16 10',
|
|
762
|
+
fill: 'none',
|
|
763
|
+
onPress: onPress,
|
|
764
|
+
color: color,
|
|
765
|
+
children: jsx(Path, {
|
|
766
|
+
d: 'M7.89888 0C6.24409 0.000806406 4.62351 0.471042 3.22533 1.35609C1.82715 2.24114 0.708743 3.50469 0 5C0.708092 6.49578 1.82635 7.75974 3.22468 8.64489C4.623 9.53004 6.24392 9.99999 7.89888 9.99999C9.55378 9.99999 11.1747 9.53004 12.573 8.64489C13.9713 7.75974 15.0896 6.49578 15.7977 5C15.089 3.50469 13.9706 2.24114 12.5724 1.35609C11.1742 0.471042 9.55364 0.000806406 7.89888 0ZM7.89888 8.98344C6.52084 8.97755 5.16914 8.60565 3.98212 7.90571C2.79509 7.20576 1.81538 6.20297 1.14327 5C1.81083 3.7931 2.78951 2.78709 3.97757 2.08654C5.16561 1.38601 6.51964 1.01653 7.89888 1.01653C9.27804 1.01653 10.6321 1.38601 11.8201 2.08654C13.0082 2.78709 13.9868 3.7931 14.6545 5C13.9823 6.20297 13.0026 7.20576 11.8156 7.90571C10.6285 8.60565 9.27689 8.97755 7.89888 8.98344ZM7.89888 2.51693C7.40772 2.51693 6.92767 2.66256 6.51934 2.93541C6.11101 3.20825 5.79274 3.59605 5.60481 4.0498C5.41687 4.50349 5.3677 5.00271 5.46351 5.48439C5.55932 5.96606 5.7958 6.4085 6.14306 6.7558C6.49033 7.10303 6.93275 7.33953 7.41443 7.43535C7.8961 7.53117 8.39533 7.48197 8.84909 7.29406C9.30277 7.10608 9.69059 6.78785 9.96342 6.3795C10.2362 5.97114 10.3819 5.4911 10.3819 5C10.3819 4.34146 10.1203 3.70989 9.65461 3.24421C9.189 2.77854 8.55742 2.51693 7.89888 2.51693ZM7.89888 6.46658C7.60878 6.46658 7.32525 6.38058 7.08407 6.21937C6.8429 6.05822 6.65492 5.82918 6.54392 5.56123C6.43291 5.29322 6.40387 4.99837 6.46045 4.7139C6.51704 4.42942 6.65675 4.16805 6.8618 3.96299C7.06693 3.75786 7.32823 3.61818 7.61271 3.5616C7.89726 3.50501 8.1921 3.53405 8.46011 3.64504C8.72806 3.75603 8.9571 3.94402 9.11825 4.18519C9.27939 4.42637 9.36546 4.7099 9.36546 5C9.36498 5.38884 9.21034 5.76161 8.93542 6.03654C8.66043 6.31146 8.28765 6.4661 7.89888 6.46658Z',
|
|
767
|
+
fill: color
|
|
768
|
+
})
|
|
769
|
+
});
|
|
770
|
+
const EyeClosedIcon = ({
|
|
771
|
+
color = 'currentColor',
|
|
772
|
+
size = 16,
|
|
773
|
+
onPress
|
|
774
|
+
}) => jsxs(Svg, {
|
|
775
|
+
width: size,
|
|
776
|
+
height: size,
|
|
777
|
+
viewBox: '0 0 16 16',
|
|
778
|
+
fill: 'none',
|
|
779
|
+
onPress: onPress,
|
|
780
|
+
color: color,
|
|
781
|
+
children: [jsx(Path, {
|
|
782
|
+
d: 'M7.89888 3C6.24409 3.00081 4.62351 3.47104 3.22533 4.35609C1.82715 5.24114 0.708743 6.50469 0 8C0.708092 9.49578 1.82635 10.7597 3.22468 11.6449C4.623 12.53 6.24392 13 7.89888 13C9.55378 13 11.1747 12.53 12.573 11.6449C13.9713 10.7597 15.0896 9.49578 15.7977 8C15.089 6.50469 13.9706 5.24114 12.5724 4.35609C11.1742 3.47104 9.55364 3.00081 7.89888 3ZM7.89888 11.9834C6.52084 11.9776 5.16914 11.6056 3.98212 10.9057C2.79509 10.2058 1.81538 9.20297 1.14327 8C1.81083 6.7931 2.78951 5.78709 3.97757 5.08654C5.16561 4.38601 6.51964 4.01653 7.89888 4.01653C9.27804 4.01653 10.6321 4.38601 11.8201 5.08654C13.0082 5.78709 13.9868 6.7931 14.6545 8C13.9823 9.20297 13.0026 10.2058 11.8156 10.9057C10.6285 11.6056 9.27689 11.9776 7.89888 11.9834Z',
|
|
783
|
+
fill: color
|
|
784
|
+
}), jsx(Line, {
|
|
785
|
+
x1: '1',
|
|
786
|
+
y1: '15',
|
|
787
|
+
x2: '15',
|
|
788
|
+
y2: '1',
|
|
789
|
+
stroke: color,
|
|
790
|
+
strokeWidth: '1.5',
|
|
791
|
+
strokeLinecap: 'round'
|
|
792
|
+
})]
|
|
793
|
+
});
|
|
794
|
+
const AsteriskIcon = ({
|
|
795
|
+
color = '#0C1C33',
|
|
796
|
+
size = 16,
|
|
797
|
+
onPress
|
|
798
|
+
}) => jsx(Svg, {
|
|
799
|
+
width: size,
|
|
800
|
+
height: size * 17 / 16,
|
|
801
|
+
viewBox: '0 0 16 17',
|
|
802
|
+
fill: 'none',
|
|
803
|
+
onPress: onPress,
|
|
804
|
+
color: color,
|
|
805
|
+
children: jsx(Path, {
|
|
806
|
+
d: 'M6.38944 0H9.61056L9.24092 8.5H6.75908L6.38944 0ZM6.38944 17L6.75908 8.5H9.24092L9.61056 17H6.38944ZM0 5.50476L1.63696 2.96825L8.60726 7.50159L7.36634 9.47143L0 5.50476ZM16 5.50476L8.63366 9.47143L7.39274 7.50159L14.363 2.96825L16 5.50476ZM16 11.4683L14.363 14.0048L7.39274 9.47143L8.63366 7.50159L16 11.4683ZM0 11.5222L7.36634 7.55556L8.60726 9.5254L1.63696 14.0587L0 11.5222Z',
|
|
807
|
+
fill: color
|
|
808
|
+
})
|
|
809
|
+
});
|
|
810
|
+
const TopRightArrowIcon = ({
|
|
811
|
+
color = '#0C1C33',
|
|
812
|
+
size = 25,
|
|
813
|
+
onPress
|
|
814
|
+
}) => jsx(Svg, {
|
|
815
|
+
width: size,
|
|
816
|
+
height: size,
|
|
817
|
+
viewBox: '0 0 25 25',
|
|
818
|
+
fill: 'none',
|
|
819
|
+
onPress: onPress,
|
|
820
|
+
color: color,
|
|
821
|
+
children: jsx(Path, {
|
|
822
|
+
d: 'M21.3388 3.66117L21.3388 21.3388M21.3388 3.66117L3.66116 3.66117M21.3388 3.66117L3.66116 21.3388',
|
|
823
|
+
stroke: color,
|
|
824
|
+
strokeWidth: '2',
|
|
825
|
+
strokeLinecap: 'round',
|
|
826
|
+
strokeLinejoin: 'round'
|
|
827
|
+
})
|
|
828
|
+
});
|
|
829
|
+
const QueuedIcon = ({
|
|
830
|
+
color = '#F4A358',
|
|
831
|
+
size = 18,
|
|
832
|
+
onPress
|
|
833
|
+
}) => jsxs(Svg, {
|
|
834
|
+
width: size,
|
|
835
|
+
height: size,
|
|
836
|
+
viewBox: '0 0 18 18',
|
|
837
|
+
fill: 'none',
|
|
838
|
+
onPress: onPress,
|
|
839
|
+
color: color,
|
|
840
|
+
children: [jsx(Rect, {
|
|
841
|
+
width: '18',
|
|
842
|
+
height: '18',
|
|
843
|
+
rx: '4',
|
|
844
|
+
fill: color,
|
|
845
|
+
fillOpacity: '.2'
|
|
846
|
+
}), jsx(Path, {
|
|
847
|
+
d: 'M11.6756 12.6482C11.8311 12.8601 12.1306 12.9075 12.3268 12.7326C13.1311 12.0158 13.6857 11.055 13.9009 9.99071C14.1476 8.77034 13.9301 7.50182 13.2909 6.43333C12.6518 5.36484 11.637 4.57324 10.4451 4.2134C9.25315 3.85356 7.96985 3.95136 6.84622 4.48768C5.72259 5.024 4.83949 5.96024 4.36966 7.11325C3.89983 8.26626 3.87708 9.55308 4.30587 10.722C4.73466 11.8909 5.58412 12.8577 6.6881 13.4334C7.65084 13.9355 8.74673 14.1085 9.80981 13.934C10.0691 13.8914 10.2207 13.6287 10.1537 13.3746C10.0867 13.1205 9.82636 12.9718 9.56614 13.0086C8.7336 13.1262 7.88063 12.982 7.12813 12.5896C6.23429 12.1235 5.5465 11.3406 5.19933 10.3942C4.85216 9.44781 4.87057 8.40592 5.25098 7.47237C5.63138 6.53882 6.3464 5.78078 7.25616 5.34654C8.16592 4.91231 9.20497 4.83312 10.17 5.12447C11.1351 5.41582 11.9567 6.05674 12.4742 6.92186C12.9917 7.78698 13.1678 8.81405 12.9681 9.80215C12.7999 10.634 12.3756 11.3878 11.7605 11.9612C11.5683 12.1404 11.5202 12.4362 11.6756 12.6482Z',
|
|
848
|
+
fill: color
|
|
849
|
+
})]
|
|
850
|
+
});
|
|
851
|
+
const PooledIcon = ({
|
|
852
|
+
color = '#008DE4',
|
|
853
|
+
size = 18,
|
|
854
|
+
onPress
|
|
855
|
+
}) => jsxs(Svg, {
|
|
856
|
+
width: size,
|
|
857
|
+
height: size,
|
|
858
|
+
viewBox: '0 0 18 18',
|
|
859
|
+
fill: 'none',
|
|
860
|
+
onPress: onPress,
|
|
861
|
+
color: color,
|
|
862
|
+
children: [jsx(Rect, {
|
|
863
|
+
width: '18',
|
|
864
|
+
height: '18',
|
|
865
|
+
rx: '4',
|
|
866
|
+
fill: color,
|
|
867
|
+
fillOpacity: '.2'
|
|
868
|
+
}), jsx(Path, {
|
|
869
|
+
d: 'M14 7L12.4328 6.01491C11.4484 5.39611 10.1941 5.40565 9.21918 6.03935C8.30752 6.63193 7.14565 6.6816 6.18674 6.16899L4 5',
|
|
870
|
+
stroke: color,
|
|
871
|
+
strokeLinecap: 'round'
|
|
872
|
+
}), jsx(Path, {
|
|
873
|
+
d: 'M14 10L12.4328 9.01491C11.4484 8.39611 10.1941 8.40565 9.21918 9.03935C8.30752 9.63193 7.14565 9.6816 6.18674 9.16899L4 8',
|
|
874
|
+
stroke: color,
|
|
875
|
+
strokeLinecap: 'round'
|
|
876
|
+
}), jsx(Path, {
|
|
877
|
+
d: 'M14 13L12.4328 12.0149C11.4484 11.3961 10.1941 11.4057 9.21918 12.0393C8.30752 12.6319 7.14565 12.6816 6.18674 12.169L4 11',
|
|
878
|
+
stroke: color,
|
|
879
|
+
strokeLinecap: 'round'
|
|
880
|
+
})]
|
|
881
|
+
});
|
|
882
|
+
const BroadcastedIcon = ({
|
|
883
|
+
color = '#008DE4',
|
|
884
|
+
size = 18,
|
|
885
|
+
onPress
|
|
886
|
+
}) => jsxs(Svg, {
|
|
887
|
+
width: size,
|
|
888
|
+
height: size,
|
|
889
|
+
viewBox: '0 0 18 18',
|
|
890
|
+
fill: 'none',
|
|
891
|
+
onPress: onPress,
|
|
892
|
+
color: color,
|
|
893
|
+
children: [jsx(Rect, {
|
|
894
|
+
width: '18',
|
|
895
|
+
height: '18',
|
|
896
|
+
rx: '4',
|
|
897
|
+
fill: color,
|
|
898
|
+
fillOpacity: '.2'
|
|
899
|
+
}), jsx(Path, {
|
|
900
|
+
d: 'M4.86093 8.74967L12.5 8.74993M12.5 8.74993L9.5 5.74993M12.5 8.74993L9.5 11.7499',
|
|
901
|
+
stroke: color,
|
|
902
|
+
strokeWidth: '2',
|
|
903
|
+
strokeLinecap: 'round',
|
|
904
|
+
strokeLinejoin: 'round'
|
|
905
|
+
})]
|
|
906
|
+
});
|
|
907
|
+
// Export all icons as a collection
|
|
908
|
+
const Icons = {
|
|
909
|
+
ArrowIcon,
|
|
910
|
+
CopyIcon,
|
|
911
|
+
SuccessIcon,
|
|
912
|
+
ErrorIcon,
|
|
913
|
+
CheckIcon,
|
|
914
|
+
CrossIcon,
|
|
915
|
+
PlusIcon,
|
|
916
|
+
ChevronIcon,
|
|
917
|
+
SearchIcon,
|
|
918
|
+
InfoCircleIcon,
|
|
919
|
+
EyeOpenIcon,
|
|
920
|
+
EyeClosedIcon,
|
|
921
|
+
TopRightArrowIcon,
|
|
922
|
+
QueuedIcon,
|
|
923
|
+
PooledIcon,
|
|
924
|
+
BroadcastedIcon,
|
|
925
|
+
AsteriskIcon
|
|
926
|
+
};
|
|
927
|
+
|
|
928
|
+
const inputStyles = cva('w-full font-normal text-sm leading-[17px]', {
|
|
929
|
+
variants: {
|
|
930
|
+
colorScheme: {
|
|
931
|
+
default: '',
|
|
932
|
+
brand: '',
|
|
933
|
+
error: '',
|
|
934
|
+
success: '',
|
|
935
|
+
'light-gray': ''
|
|
936
|
+
},
|
|
937
|
+
size: {
|
|
938
|
+
sm: 'px-3 py-2 rounded-[10px]',
|
|
939
|
+
md: 'px-4 py-3 rounded-[12px]',
|
|
940
|
+
xl: 'px-4 py-[18px] rounded-[14px]'
|
|
941
|
+
},
|
|
942
|
+
variant: {
|
|
943
|
+
outlined: 'border',
|
|
944
|
+
filled: 'border-0'
|
|
945
|
+
},
|
|
946
|
+
disabled: {
|
|
947
|
+
false: '',
|
|
948
|
+
true: 'opacity-60'
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
compoundVariants: [
|
|
952
|
+
// Outlined variant colors
|
|
953
|
+
{
|
|
954
|
+
variant: 'outlined',
|
|
955
|
+
colorScheme: 'default',
|
|
956
|
+
class: 'border-[rgba(17,17,17,0.32)] bg-white'
|
|
957
|
+
}, {
|
|
958
|
+
variant: 'outlined',
|
|
959
|
+
colorScheme: 'brand',
|
|
960
|
+
class: 'border-dash-brand/30 bg-white'
|
|
961
|
+
}, {
|
|
962
|
+
variant: 'outlined',
|
|
963
|
+
colorScheme: 'error',
|
|
964
|
+
class: 'border-red-500 bg-white'
|
|
965
|
+
}, {
|
|
966
|
+
variant: 'outlined',
|
|
967
|
+
colorScheme: 'success',
|
|
968
|
+
class: 'border-green-500 bg-white'
|
|
969
|
+
}, {
|
|
970
|
+
variant: 'outlined',
|
|
971
|
+
colorScheme: 'light-gray',
|
|
972
|
+
class: 'border-gray-500/50 bg-white'
|
|
973
|
+
},
|
|
974
|
+
// Filled variant colors
|
|
975
|
+
{
|
|
976
|
+
variant: 'filled',
|
|
977
|
+
colorScheme: 'default',
|
|
978
|
+
class: 'bg-dash-brand/15'
|
|
979
|
+
}, {
|
|
980
|
+
variant: 'filled',
|
|
981
|
+
colorScheme: 'brand',
|
|
982
|
+
class: 'bg-dash-brand/15'
|
|
983
|
+
}, {
|
|
984
|
+
variant: 'filled',
|
|
985
|
+
colorScheme: 'error',
|
|
986
|
+
class: 'bg-red-500/15'
|
|
987
|
+
}, {
|
|
988
|
+
variant: 'filled',
|
|
989
|
+
colorScheme: 'success',
|
|
990
|
+
class: 'bg-green-500/15'
|
|
991
|
+
}, {
|
|
992
|
+
variant: 'filled',
|
|
993
|
+
colorScheme: 'light-gray',
|
|
994
|
+
class: 'bg-gray-100'
|
|
995
|
+
}],
|
|
996
|
+
defaultVariants: {
|
|
997
|
+
colorScheme: 'default',
|
|
998
|
+
size: 'xl',
|
|
999
|
+
variant: 'outlined',
|
|
1000
|
+
disabled: false
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
/**
|
|
1004
|
+
* React Native Input component that adapts to various color schemes, sizes, variants, and states.
|
|
1005
|
+
* For password inputs (secureTextEntry), includes a toggleable eye icon.
|
|
1006
|
+
* Supports prefix text or elements before input content.
|
|
1007
|
+
*
|
|
1008
|
+
* @example
|
|
1009
|
+
* <Input
|
|
1010
|
+
* secureTextEntry
|
|
1011
|
+
* placeholder="Enter password"
|
|
1012
|
+
* colorScheme="brand"
|
|
1013
|
+
* size="xl"
|
|
1014
|
+
* prefix="https://"
|
|
1015
|
+
* />
|
|
1016
|
+
*/
|
|
1017
|
+
const Input = _a => {
|
|
1018
|
+
var {
|
|
1019
|
+
className = '',
|
|
1020
|
+
colorScheme,
|
|
1021
|
+
size,
|
|
1022
|
+
variant,
|
|
1023
|
+
error = false,
|
|
1024
|
+
success = false,
|
|
1025
|
+
disabled = false,
|
|
1026
|
+
secureTextEntry = false,
|
|
1027
|
+
prefix,
|
|
1028
|
+
prefixStyle,
|
|
1029
|
+
showPasswordToggle = true,
|
|
1030
|
+
style,
|
|
1031
|
+
textStyle
|
|
1032
|
+
} = _a,
|
|
1033
|
+
props = __rest(_a, ["className", "colorScheme", "size", "variant", "error", "success", "disabled", "secureTextEntry", "prefix", "prefixStyle", "showPasswordToggle", "style", "textStyle"]);
|
|
1034
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
1035
|
+
// Determine color scheme based on state
|
|
1036
|
+
let finalColorScheme = colorScheme;
|
|
1037
|
+
if (error) finalColorScheme = 'error';else if (success) finalColorScheme = 'success';
|
|
1038
|
+
const classes = inputStyles({
|
|
1039
|
+
colorScheme: finalColorScheme,
|
|
1040
|
+
size,
|
|
1041
|
+
variant,
|
|
1042
|
+
disabled
|
|
1043
|
+
}) + (className ? ` ${className}` : '');
|
|
1044
|
+
const isPassword = secureTextEntry;
|
|
1045
|
+
const shouldShowToggle = isPassword && showPasswordToggle;
|
|
1046
|
+
const hasPrefix = Boolean(prefix);
|
|
1047
|
+
const togglePasswordVisibility = () => {
|
|
1048
|
+
setShowPassword(!showPassword);
|
|
1049
|
+
};
|
|
1050
|
+
// Convert Tailwind classes to React Native style objects
|
|
1051
|
+
const inputStyle = [cn(classes), style].filter(Boolean);
|
|
1052
|
+
const inputTextStyle = [{
|
|
1053
|
+
color: '#111111',
|
|
1054
|
+
fontSize: 14,
|
|
1055
|
+
lineHeight: 17,
|
|
1056
|
+
fontWeight: '300'
|
|
1057
|
+
}, textStyle].filter(Boolean);
|
|
1058
|
+
// Adjust padding for password toggle button and prefix
|
|
1059
|
+
const containerStyle = {};
|
|
1060
|
+
if (shouldShowToggle) containerStyle.paddingRight = 40;
|
|
1061
|
+
if (hasPrefix) containerStyle.paddingLeft = 70; // Extra space for prefix
|
|
1062
|
+
// Default prefix style
|
|
1063
|
+
const defaultPrefixStyle = {
|
|
1064
|
+
color: 'rgba(17, 17, 17, 0.6)',
|
|
1065
|
+
fontSize: 14,
|
|
1066
|
+
lineHeight: 17
|
|
1067
|
+
};
|
|
1068
|
+
// Render prefix element
|
|
1069
|
+
const renderPrefix = () => {
|
|
1070
|
+
if (!hasPrefix) return null;
|
|
1071
|
+
return jsx(View, {
|
|
1072
|
+
style: {
|
|
1073
|
+
position: 'absolute',
|
|
1074
|
+
left: 16,
|
|
1075
|
+
height: '100%',
|
|
1076
|
+
justifyContent: 'center',
|
|
1077
|
+
zIndex: 10,
|
|
1078
|
+
pointerEvents: 'none'
|
|
1079
|
+
},
|
|
1080
|
+
children: typeof prefix === 'string' ? jsx(Text$1, {
|
|
1081
|
+
style: [defaultPrefixStyle, prefixStyle],
|
|
1082
|
+
children: prefix
|
|
1083
|
+
}) : prefix
|
|
1084
|
+
});
|
|
1085
|
+
};
|
|
1086
|
+
if (isPassword || hasPrefix) {
|
|
1087
|
+
return jsxs(View, {
|
|
1088
|
+
style: {
|
|
1089
|
+
position: 'relative'
|
|
1090
|
+
},
|
|
1091
|
+
children: [renderPrefix(), jsx(TextInput, Object.assign({
|
|
1092
|
+
style: [inputStyle, containerStyle, inputTextStyle],
|
|
1093
|
+
editable: !disabled,
|
|
1094
|
+
secureTextEntry: isPassword && !showPassword,
|
|
1095
|
+
placeholderTextColor: "rgba(17, 17, 17, 0.6)"
|
|
1096
|
+
}, props)), shouldShowToggle && jsx(TouchableOpacity, {
|
|
1097
|
+
style: {
|
|
1098
|
+
position: 'absolute',
|
|
1099
|
+
right: 16,
|
|
1100
|
+
height: '100%',
|
|
1101
|
+
justifyContent: 'center',
|
|
1102
|
+
alignItems: 'center',
|
|
1103
|
+
opacity: 0.5
|
|
1104
|
+
},
|
|
1105
|
+
onPress: togglePasswordVisibility,
|
|
1106
|
+
activeOpacity: 0.7,
|
|
1107
|
+
children: showPassword ? jsx(EyeClosedIcon, {
|
|
1108
|
+
size: 16,
|
|
1109
|
+
color: '#0C1C33'
|
|
1110
|
+
}) : jsx(EyeOpenIcon, {
|
|
1111
|
+
size: 16,
|
|
1112
|
+
color: '#0C1C33'
|
|
1113
|
+
})
|
|
1114
|
+
})]
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
// Regular input without prefix or password
|
|
1118
|
+
return jsx(TextInput, Object.assign({
|
|
1119
|
+
style: [inputStyle, inputTextStyle],
|
|
1120
|
+
editable: !disabled,
|
|
1121
|
+
placeholderTextColor: "rgba(17, 17, 17, 0.6)"
|
|
1122
|
+
}, props));
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
const tabsRootStyles = cva('flex-col w-full', {
|
|
1126
|
+
variants: {
|
|
1127
|
+
theme: {
|
|
1128
|
+
light: '',
|
|
1129
|
+
dark: ''
|
|
1130
|
+
}
|
|
1131
|
+
},
|
|
1132
|
+
defaultVariants: {
|
|
1133
|
+
theme: 'light'
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
const tabsListStyles = cva('flex-row relative', {
|
|
1137
|
+
variants: {
|
|
1138
|
+
theme: {
|
|
1139
|
+
light: '',
|
|
1140
|
+
dark: ''
|
|
1141
|
+
}
|
|
1142
|
+
},
|
|
1143
|
+
defaultVariants: {
|
|
1144
|
+
theme: 'light'
|
|
1145
|
+
}
|
|
1146
|
+
});
|
|
1147
|
+
const tabsTriggerStyles = cva(['flex-row items-center justify-center relative', 'font-light transition-all'], {
|
|
1148
|
+
variants: {
|
|
1149
|
+
theme: {
|
|
1150
|
+
light: '',
|
|
1151
|
+
dark: ''
|
|
1152
|
+
},
|
|
1153
|
+
active: {
|
|
1154
|
+
true: '',
|
|
1155
|
+
false: ''
|
|
1156
|
+
},
|
|
1157
|
+
size: {
|
|
1158
|
+
sm: 'text-sm px-0 pr-3 pb-2',
|
|
1159
|
+
lg: 'text-xl px-0 pr-4 pb-3',
|
|
1160
|
+
xl: 'text-2xl px-0 pr-[14px] pb-[10px]'
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
compoundVariants: [{
|
|
1164
|
+
theme: 'light',
|
|
1165
|
+
active: true,
|
|
1166
|
+
class: 'text-dash-primary-dark-blue'
|
|
1167
|
+
}, {
|
|
1168
|
+
theme: 'light',
|
|
1169
|
+
active: false,
|
|
1170
|
+
class: 'text-[rgba(12,28,51,0.35)]'
|
|
1171
|
+
}, {
|
|
1172
|
+
theme: 'dark',
|
|
1173
|
+
active: true,
|
|
1174
|
+
class: 'text-white'
|
|
1175
|
+
}, {
|
|
1176
|
+
theme: 'dark',
|
|
1177
|
+
active: false,
|
|
1178
|
+
class: 'text-gray-400'
|
|
1179
|
+
}],
|
|
1180
|
+
defaultVariants: {
|
|
1181
|
+
theme: 'light',
|
|
1182
|
+
active: false,
|
|
1183
|
+
size: 'xl'
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
const tabsContentStyles = cva('', {
|
|
1187
|
+
variants: {
|
|
1188
|
+
theme: {
|
|
1189
|
+
light: '',
|
|
1190
|
+
dark: ''
|
|
1191
|
+
},
|
|
1192
|
+
size: {
|
|
1193
|
+
sm: 'mt-2',
|
|
1194
|
+
lg: 'mt-3',
|
|
1195
|
+
xl: 'mt-4'
|
|
1196
|
+
}
|
|
1197
|
+
},
|
|
1198
|
+
defaultVariants: {
|
|
1199
|
+
theme: 'light',
|
|
1200
|
+
size: 'xl'
|
|
1201
|
+
}
|
|
1202
|
+
});
|
|
1203
|
+
/**
|
|
1204
|
+
* React Native Tabs component with sleek underline style matching Figma design.
|
|
1205
|
+
* Features horizontal scrolling, light/dark theme support, and touch interactions.
|
|
1206
|
+
*/
|
|
1207
|
+
const Tabs = ({
|
|
1208
|
+
items,
|
|
1209
|
+
value,
|
|
1210
|
+
defaultValue,
|
|
1211
|
+
onValueChange,
|
|
1212
|
+
size = 'xl',
|
|
1213
|
+
theme = 'light',
|
|
1214
|
+
className = '',
|
|
1215
|
+
listClassName = '',
|
|
1216
|
+
triggerClassName = '',
|
|
1217
|
+
contentClassName = '',
|
|
1218
|
+
style,
|
|
1219
|
+
listStyle,
|
|
1220
|
+
triggerStyle,
|
|
1221
|
+
contentStyle,
|
|
1222
|
+
textStyle
|
|
1223
|
+
}) => {
|
|
1224
|
+
var _a;
|
|
1225
|
+
const [internalValue, setInternalValue] = useState(defaultValue || ((_a = items[0]) === null || _a === void 0 ? void 0 : _a.value) || '');
|
|
1226
|
+
// Use controlled value if provided, otherwise use internal state
|
|
1227
|
+
const currentValue = value !== undefined ? value : internalValue;
|
|
1228
|
+
const handleValueChange = newValue => {
|
|
1229
|
+
if (value === undefined) {
|
|
1230
|
+
setInternalValue(newValue);
|
|
1231
|
+
}
|
|
1232
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
1233
|
+
};
|
|
1234
|
+
const rootClasses = tabsRootStyles({
|
|
1235
|
+
theme
|
|
1236
|
+
}) + (className ? ` ${className}` : '');
|
|
1237
|
+
const listClasses = tabsListStyles({
|
|
1238
|
+
theme
|
|
1239
|
+
}) + (listClassName ? ` ${listClassName}` : '');
|
|
1240
|
+
const contentClasses = tabsContentStyles({
|
|
1241
|
+
theme,
|
|
1242
|
+
size
|
|
1243
|
+
}) + (contentClassName ? ` ${contentClassName}` : '');
|
|
1244
|
+
const rootStyle = [cn(rootClasses), style].filter(Boolean);
|
|
1245
|
+
const listStyleCombined = [cn(listClasses), listStyle].filter(Boolean);
|
|
1246
|
+
const contentStyleCombined = [cn(contentClasses), contentStyle].filter(Boolean);
|
|
1247
|
+
// Border color based on theme
|
|
1248
|
+
const borderColor = theme === 'light' ? 'rgba(12, 28, 51, 0.15)' : 'rgba(156, 163, 175, 0.5)';
|
|
1249
|
+
const activeBorderColor = '#4C7EFF';
|
|
1250
|
+
return jsxs(View, {
|
|
1251
|
+
style: rootStyle,
|
|
1252
|
+
children: [jsxs(View, {
|
|
1253
|
+
style: {
|
|
1254
|
+
position: 'relative'
|
|
1255
|
+
},
|
|
1256
|
+
children: [jsx(ScrollView, {
|
|
1257
|
+
horizontal: true,
|
|
1258
|
+
showsHorizontalScrollIndicator: false,
|
|
1259
|
+
style: listStyleCombined,
|
|
1260
|
+
contentContainerStyle: {
|
|
1261
|
+
flexDirection: 'row'
|
|
1262
|
+
},
|
|
1263
|
+
children: items.map(item => {
|
|
1264
|
+
const isActive = currentValue === item.value;
|
|
1265
|
+
const triggerClasses = tabsTriggerStyles({
|
|
1266
|
+
theme,
|
|
1267
|
+
active: isActive,
|
|
1268
|
+
size
|
|
1269
|
+
}) + (triggerClassName ? ` ${triggerClassName}` : '');
|
|
1270
|
+
const triggerStyleCombined = [cn(triggerClasses), triggerStyle].filter(Boolean);
|
|
1271
|
+
// Get text size based on size prop
|
|
1272
|
+
let fontSize = 24; // xl
|
|
1273
|
+
let lineHeight = 33; // xl (1.366)
|
|
1274
|
+
if (size === 'sm') {
|
|
1275
|
+
fontSize = 14;
|
|
1276
|
+
lineHeight = 18; // 1.25
|
|
1277
|
+
} else if (size === 'lg') {
|
|
1278
|
+
fontSize = 20;
|
|
1279
|
+
lineHeight = 26; // 1.3
|
|
1280
|
+
}
|
|
1281
|
+
// Text color based on theme and active state
|
|
1282
|
+
let textColor = 'rgba(12, 28, 51, 0.35)'; // light inactive
|
|
1283
|
+
if (theme === 'light' && isActive) {
|
|
1284
|
+
textColor = '#0C1C33'; // light active
|
|
1285
|
+
} else if (theme === 'dark' && isActive) {
|
|
1286
|
+
textColor = '#FFFFFF'; // dark active
|
|
1287
|
+
} else if (theme === 'dark' && !isActive) {
|
|
1288
|
+
textColor = 'rgba(156, 163, 175, 1)'; // dark inactive
|
|
1289
|
+
}
|
|
1290
|
+
const baseTextStyle = {
|
|
1291
|
+
fontSize,
|
|
1292
|
+
lineHeight,
|
|
1293
|
+
color: textColor,
|
|
1294
|
+
fontWeight: isActive ? '500' : '300'
|
|
1295
|
+
};
|
|
1296
|
+
const finalTextStyle = [baseTextStyle, textStyle].filter(Boolean);
|
|
1297
|
+
return jsxs(TouchableOpacity, {
|
|
1298
|
+
disabled: item.disabled,
|
|
1299
|
+
onPress: () => !item.disabled && handleValueChange(item.value),
|
|
1300
|
+
activeOpacity: 0.8,
|
|
1301
|
+
style: triggerStyleCombined,
|
|
1302
|
+
children: [jsx(Text$1, {
|
|
1303
|
+
style: finalTextStyle,
|
|
1304
|
+
children: item.label
|
|
1305
|
+
}), isActive && jsx(View, {
|
|
1306
|
+
style: {
|
|
1307
|
+
position: 'absolute',
|
|
1308
|
+
bottom: 0,
|
|
1309
|
+
left: -4,
|
|
1310
|
+
right: size === 'sm' ? 12 : size === 'lg' ? 16 : 14,
|
|
1311
|
+
height: 1,
|
|
1312
|
+
backgroundColor: activeBorderColor,
|
|
1313
|
+
zIndex: 10
|
|
1314
|
+
}
|
|
1315
|
+
})]
|
|
1316
|
+
}, item.value);
|
|
1317
|
+
})
|
|
1318
|
+
}), jsx(View, {
|
|
1319
|
+
style: {
|
|
1320
|
+
position: 'absolute',
|
|
1321
|
+
bottom: 0,
|
|
1322
|
+
left: 0,
|
|
1323
|
+
right: 0,
|
|
1324
|
+
height: 1,
|
|
1325
|
+
backgroundColor: borderColor
|
|
1326
|
+
}
|
|
1327
|
+
})]
|
|
1328
|
+
}), items.map(item => {
|
|
1329
|
+
if (currentValue !== item.value) return null;
|
|
1330
|
+
return jsx(View, {
|
|
1331
|
+
style: contentStyleCombined,
|
|
1332
|
+
children: item.content
|
|
1333
|
+
}, item.value);
|
|
1334
|
+
})]
|
|
1335
|
+
});
|
|
1336
|
+
};
|
|
1337
|
+
|
|
1338
|
+
/**
|
|
1339
|
+
* Avatar component that creates unique identicons from usernames
|
|
1340
|
+
* with customizable appearance.
|
|
1341
|
+
*
|
|
1342
|
+
* This is the React Native version that uses SvgXml instead of img tag.
|
|
1343
|
+
*/
|
|
1344
|
+
const Avatar = _a => {
|
|
1345
|
+
var {
|
|
1346
|
+
username,
|
|
1347
|
+
className = '',
|
|
1348
|
+
saturation = 50,
|
|
1349
|
+
lightness = 50,
|
|
1350
|
+
width = 40,
|
|
1351
|
+
height = 40,
|
|
1352
|
+
style
|
|
1353
|
+
} = _a,
|
|
1354
|
+
props = __rest(_a, ["username", "className", "saturation", "lightness", "width", "height", "style"]);
|
|
1355
|
+
// Generate SVG string directly (no data URI needed for SvgXml)
|
|
1356
|
+
const svgString = useMemo(() => minidenticon(username, saturation, lightness), [username, saturation, lightness]);
|
|
1357
|
+
const containerClasses = `relative ${className}`.trim();
|
|
1358
|
+
const containerStyle = [cn(containerClasses), style].filter(Boolean);
|
|
1359
|
+
return jsx(View, Object.assign({
|
|
1360
|
+
style: containerStyle
|
|
1361
|
+
}, props, {
|
|
1362
|
+
children: jsx(SvgXml, {
|
|
1363
|
+
xml: svgString,
|
|
1364
|
+
width: width,
|
|
1365
|
+
height: height
|
|
1366
|
+
})
|
|
1367
|
+
}));
|
|
1368
|
+
};
|
|
1369
|
+
|
|
1370
|
+
// Base badge container styles
|
|
1371
|
+
const badgeStyles = cva('inline-flex items-center justify-center font-medium', {
|
|
1372
|
+
variants: {
|
|
1373
|
+
size: {
|
|
1374
|
+
xxs: 'px-1 py-1 text-xs rounded-full',
|
|
1375
|
+
xs: 'px-2 py-1 text-xs rounded-full',
|
|
1376
|
+
sm: 'px-[34px] py-[10px] text-xs rounded-full',
|
|
1377
|
+
xl: 'px-9 py-4 text-lg rounded-full'
|
|
1378
|
+
},
|
|
1379
|
+
borderRadius: {
|
|
1380
|
+
default: '',
|
|
1381
|
+
xs: 'rounded-[4px]'
|
|
1382
|
+
},
|
|
1383
|
+
// Color and variant combinations - blue
|
|
1384
|
+
color_variant_blue_default: {
|
|
1385
|
+
true: ''
|
|
1386
|
+
},
|
|
1387
|
+
color_variant_blue_flat: {
|
|
1388
|
+
true: 'bg-[rgba(76,126,255,0.15)]'
|
|
1389
|
+
},
|
|
1390
|
+
color_variant_blue_solid: {
|
|
1391
|
+
true: 'bg-[#4C7EFF]'
|
|
1392
|
+
},
|
|
1393
|
+
color_variant_blue_bordered: {
|
|
1394
|
+
true: 'border border-[#4C7EFF]'
|
|
1395
|
+
},
|
|
1396
|
+
// Color and variant combinations - white
|
|
1397
|
+
color_variant_white_default: {
|
|
1398
|
+
true: ''
|
|
1399
|
+
},
|
|
1400
|
+
color_variant_white_flat: {
|
|
1401
|
+
true: 'bg-[rgba(255,255,255,0.15)]'
|
|
1402
|
+
},
|
|
1403
|
+
color_variant_white_solid: {
|
|
1404
|
+
true: 'bg-white'
|
|
1405
|
+
},
|
|
1406
|
+
color_variant_white_bordered: {
|
|
1407
|
+
true: 'border border-white'
|
|
1408
|
+
},
|
|
1409
|
+
// Color and variant combinations - gray
|
|
1410
|
+
color_variant_gray_default: {
|
|
1411
|
+
true: ''
|
|
1412
|
+
},
|
|
1413
|
+
color_variant_gray_flat: {
|
|
1414
|
+
true: 'bg-[rgba(12,28,51,0.15)]'
|
|
1415
|
+
},
|
|
1416
|
+
color_variant_gray_solid: {
|
|
1417
|
+
true: 'bg-[#0C1C33]'
|
|
1418
|
+
},
|
|
1419
|
+
color_variant_gray_bordered: {
|
|
1420
|
+
true: 'border border-[#0C1C33]'
|
|
1421
|
+
},
|
|
1422
|
+
// Color and variant combinations - light-gray
|
|
1423
|
+
color_variant_lightgray_default: {
|
|
1424
|
+
true: ''
|
|
1425
|
+
},
|
|
1426
|
+
color_variant_lightgray_flat: {
|
|
1427
|
+
true: 'bg-[rgba(12,28,51,0.05)]'
|
|
1428
|
+
},
|
|
1429
|
+
color_variant_lightgray_solid: {
|
|
1430
|
+
true: 'bg-[rgba(12,28,51,0.15)]'
|
|
1431
|
+
},
|
|
1432
|
+
color_variant_lightgray_bordered: {
|
|
1433
|
+
true: 'border border-[#6B7280]'
|
|
1434
|
+
},
|
|
1435
|
+
// Color and variant combinations - turquoise
|
|
1436
|
+
color_variant_turquoise_default: {
|
|
1437
|
+
true: ''
|
|
1438
|
+
},
|
|
1439
|
+
color_variant_turquoise_flat: {
|
|
1440
|
+
true: 'bg-[rgba(96,246,210,0.15)]'
|
|
1441
|
+
},
|
|
1442
|
+
color_variant_turquoise_solid: {
|
|
1443
|
+
true: 'bg-[#60F6D2]'
|
|
1444
|
+
},
|
|
1445
|
+
color_variant_turquoise_bordered: {
|
|
1446
|
+
true: 'border border-[#60F6D2]'
|
|
1447
|
+
},
|
|
1448
|
+
// Color and variant combinations - red
|
|
1449
|
+
color_variant_red_default: {
|
|
1450
|
+
true: ''
|
|
1451
|
+
},
|
|
1452
|
+
color_variant_red_flat: {
|
|
1453
|
+
true: 'bg-[rgba(205,46,0,0.15)]'
|
|
1454
|
+
},
|
|
1455
|
+
color_variant_red_solid: {
|
|
1456
|
+
true: 'bg-[#CD2E00]'
|
|
1457
|
+
},
|
|
1458
|
+
color_variant_red_bordered: {
|
|
1459
|
+
true: 'border border-[#CD2E00]'
|
|
1460
|
+
},
|
|
1461
|
+
// Color and variant combinations - orange
|
|
1462
|
+
color_variant_orange_default: {
|
|
1463
|
+
true: ''
|
|
1464
|
+
},
|
|
1465
|
+
color_variant_orange_flat: {
|
|
1466
|
+
true: 'bg-[rgba(249,143,18,0.15)]'
|
|
1467
|
+
},
|
|
1468
|
+
color_variant_orange_solid: {
|
|
1469
|
+
true: 'bg-[#F98F12]'
|
|
1470
|
+
},
|
|
1471
|
+
color_variant_orange_bordered: {
|
|
1472
|
+
true: 'border border-[#F98F12]'
|
|
1473
|
+
}
|
|
1474
|
+
},
|
|
1475
|
+
defaultVariants: {
|
|
1476
|
+
size: 'sm',
|
|
1477
|
+
borderRadius: 'default'
|
|
1478
|
+
}
|
|
1479
|
+
});
|
|
1480
|
+
// Text color styles
|
|
1481
|
+
const textStyles = cva('font-medium', {
|
|
1482
|
+
variants: {
|
|
1483
|
+
size: {
|
|
1484
|
+
xxs: 'text-xs',
|
|
1485
|
+
xs: 'text-xs',
|
|
1486
|
+
sm: 'text-xs',
|
|
1487
|
+
xl: 'text-lg'
|
|
1488
|
+
},
|
|
1489
|
+
// Text colors for each color and variant combination
|
|
1490
|
+
color_variant_blue_default: {
|
|
1491
|
+
true: 'text-[#4C7EFF]'
|
|
1492
|
+
},
|
|
1493
|
+
color_variant_blue_flat: {
|
|
1494
|
+
true: 'text-[#4C7EFF]'
|
|
1495
|
+
},
|
|
1496
|
+
color_variant_blue_solid: {
|
|
1497
|
+
true: 'text-white'
|
|
1498
|
+
},
|
|
1499
|
+
color_variant_blue_bordered: {
|
|
1500
|
+
true: 'text-[#4C7EFF]'
|
|
1501
|
+
},
|
|
1502
|
+
color_variant_white_default: {
|
|
1503
|
+
true: 'text-white'
|
|
1504
|
+
},
|
|
1505
|
+
color_variant_white_flat: {
|
|
1506
|
+
true: 'text-white'
|
|
1507
|
+
},
|
|
1508
|
+
color_variant_white_solid: {
|
|
1509
|
+
true: 'text-[#0C1C33]'
|
|
1510
|
+
},
|
|
1511
|
+
color_variant_white_bordered: {
|
|
1512
|
+
true: 'text-white'
|
|
1513
|
+
},
|
|
1514
|
+
color_variant_gray_default: {
|
|
1515
|
+
true: 'text-[#0C1C33]'
|
|
1516
|
+
},
|
|
1517
|
+
color_variant_gray_flat: {
|
|
1518
|
+
true: 'text-[#0C1C33]'
|
|
1519
|
+
},
|
|
1520
|
+
color_variant_gray_solid: {
|
|
1521
|
+
true: 'text-white'
|
|
1522
|
+
},
|
|
1523
|
+
color_variant_gray_bordered: {
|
|
1524
|
+
true: 'text-[#0C1C33]'
|
|
1525
|
+
},
|
|
1526
|
+
color_variant_lightgray_default: {
|
|
1527
|
+
true: 'text-[#6B7280]'
|
|
1528
|
+
},
|
|
1529
|
+
color_variant_lightgray_flat: {
|
|
1530
|
+
true: 'text-[#0C1C33]'
|
|
1531
|
+
},
|
|
1532
|
+
color_variant_lightgray_solid: {
|
|
1533
|
+
true: 'text-[#0C1C33]'
|
|
1534
|
+
},
|
|
1535
|
+
color_variant_lightgray_bordered: {
|
|
1536
|
+
true: 'text-[#6B7280]'
|
|
1537
|
+
},
|
|
1538
|
+
color_variant_turquoise_default: {
|
|
1539
|
+
true: 'text-[#60F6D2]'
|
|
1540
|
+
},
|
|
1541
|
+
color_variant_turquoise_flat: {
|
|
1542
|
+
true: 'text-[#60F6D2]'
|
|
1543
|
+
},
|
|
1544
|
+
color_variant_turquoise_solid: {
|
|
1545
|
+
true: 'text-[#0C1C33]'
|
|
1546
|
+
},
|
|
1547
|
+
color_variant_turquoise_bordered: {
|
|
1548
|
+
true: 'text-[#60F6D2]'
|
|
1549
|
+
},
|
|
1550
|
+
color_variant_red_default: {
|
|
1551
|
+
true: 'text-[#CD2E00]'
|
|
1552
|
+
},
|
|
1553
|
+
color_variant_red_flat: {
|
|
1554
|
+
true: 'text-[#CD2E00]'
|
|
1555
|
+
},
|
|
1556
|
+
color_variant_red_solid: {
|
|
1557
|
+
true: 'text-white'
|
|
1558
|
+
},
|
|
1559
|
+
color_variant_red_bordered: {
|
|
1560
|
+
true: 'text-[#CD2E00]'
|
|
1561
|
+
},
|
|
1562
|
+
color_variant_orange_default: {
|
|
1563
|
+
true: 'text-[#F98F12]'
|
|
1564
|
+
},
|
|
1565
|
+
color_variant_orange_flat: {
|
|
1566
|
+
true: 'text-[#F98F12]'
|
|
1567
|
+
},
|
|
1568
|
+
color_variant_orange_solid: {
|
|
1569
|
+
true: 'text-white'
|
|
1570
|
+
},
|
|
1571
|
+
color_variant_orange_bordered: {
|
|
1572
|
+
true: 'text-[#F98F12]'
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
defaultVariants: {
|
|
1576
|
+
size: 'sm'
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1579
|
+
// Mapping object for color key normalization (handles dashes)
|
|
1580
|
+
const COLOR_KEY_MAP = {
|
|
1581
|
+
'blue': 'blue',
|
|
1582
|
+
'white': 'white',
|
|
1583
|
+
'gray': 'gray',
|
|
1584
|
+
'light-gray': 'lightgray',
|
|
1585
|
+
'turquoise': 'turquoise',
|
|
1586
|
+
'red': 'red',
|
|
1587
|
+
'orange': 'orange'
|
|
1588
|
+
};
|
|
1589
|
+
/**
|
|
1590
|
+
* React Native Badge component with multiple variants, colors, sizes, and border radius options.
|
|
1591
|
+
* Uses CVA for variant management and twrnc for Tailwind styling.
|
|
1592
|
+
*
|
|
1593
|
+
* Supports 28 style combinations (7 colors × 4 variants) with 4 sizes and optional custom border radius.
|
|
1594
|
+
*/
|
|
1595
|
+
const Badge = _a => {
|
|
1596
|
+
var {
|
|
1597
|
+
children,
|
|
1598
|
+
variant = 'default',
|
|
1599
|
+
color = 'blue',
|
|
1600
|
+
size = 'sm',
|
|
1601
|
+
borderRadius,
|
|
1602
|
+
className = '',
|
|
1603
|
+
style,
|
|
1604
|
+
textStyle,
|
|
1605
|
+
onPress
|
|
1606
|
+
} = _a,
|
|
1607
|
+
props = __rest(_a, ["children", "variant", "color", "size", "borderRadius", "className", "style", "textStyle", "onPress"]);
|
|
1608
|
+
// Generate the color_variant key for CVA using explicit mapping
|
|
1609
|
+
const normalizedColor = COLOR_KEY_MAP[color] || color;
|
|
1610
|
+
const colorVariantKey = `color_variant_${normalizedColor}_${variant}`;
|
|
1611
|
+
// Build the badge container classes with proper typing
|
|
1612
|
+
const badgeVariantProps = {
|
|
1613
|
+
size,
|
|
1614
|
+
borderRadius: borderRadius || 'default',
|
|
1615
|
+
[colorVariantKey]: true
|
|
1616
|
+
};
|
|
1617
|
+
const badgeClasses = badgeStyles(badgeVariantProps);
|
|
1618
|
+
// Build the text classes with proper typing
|
|
1619
|
+
const textVariantProps = {
|
|
1620
|
+
size,
|
|
1621
|
+
[colorVariantKey]: true
|
|
1622
|
+
};
|
|
1623
|
+
const textClasses = textStyles(textVariantProps);
|
|
1624
|
+
// Convert Tailwind classes to React Native style objects
|
|
1625
|
+
const combinedClasses = className ? `${badgeClasses} ${className}` : badgeClasses;
|
|
1626
|
+
const badgeStyleArray = [cn(combinedClasses), style].filter(Boolean);
|
|
1627
|
+
const textStyleMerged = [cn(textClasses), textStyle].filter(Boolean);
|
|
1628
|
+
// Render content (string children wrapped in Text, custom content as-is)
|
|
1629
|
+
const content = typeof children === 'string' ? jsx(Text$1, {
|
|
1630
|
+
style: textStyleMerged,
|
|
1631
|
+
children: children
|
|
1632
|
+
}) : children;
|
|
1633
|
+
// If onPress is provided, wrap in Pressable
|
|
1634
|
+
if (onPress) {
|
|
1635
|
+
return jsx(Pressable, Object.assign({
|
|
1636
|
+
style: ({
|
|
1637
|
+
pressed
|
|
1638
|
+
}) => pressed ? [...badgeStyleArray, {
|
|
1639
|
+
opacity: 0.7
|
|
1640
|
+
}] : badgeStyleArray,
|
|
1641
|
+
onPress: onPress
|
|
1642
|
+
}, props, {
|
|
1643
|
+
children: content
|
|
1644
|
+
}));
|
|
1645
|
+
}
|
|
1646
|
+
// Otherwise, just render as View
|
|
1647
|
+
return jsx(View, {
|
|
1648
|
+
style: badgeStyleArray,
|
|
1649
|
+
children: content
|
|
1650
|
+
});
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
/**
|
|
1654
|
+
* Groups digits into chunks of three, right to left.
|
|
1655
|
+
* Used for formatting large numbers with thousand separators.
|
|
1656
|
+
*/
|
|
1657
|
+
const groupDigits = intPart => {
|
|
1658
|
+
return intPart.split('').reverse().reduce((acc, char, idx) => {
|
|
1659
|
+
if (idx % 3 === 0) acc.unshift('');
|
|
1660
|
+
acc[0] = char + acc[0];
|
|
1661
|
+
return acc;
|
|
1662
|
+
}, []);
|
|
1663
|
+
};
|
|
1664
|
+
/**
|
|
1665
|
+
* Splits a numeric string into groups of three characters for display.
|
|
1666
|
+
* Supports two variants:
|
|
1667
|
+
* - `space`: groups separated by gap
|
|
1668
|
+
* - `comma`: groups separated by commas, with decimal part after `.`
|
|
1669
|
+
* Supports light/dark theme via dark: variants.
|
|
1670
|
+
*/
|
|
1671
|
+
const BigNumber = ({
|
|
1672
|
+
children,
|
|
1673
|
+
variant = 'space',
|
|
1674
|
+
className = '',
|
|
1675
|
+
decimalPointSpacing = -2,
|
|
1676
|
+
style,
|
|
1677
|
+
textStyle
|
|
1678
|
+
}) => {
|
|
1679
|
+
const decimalPointStyle = {
|
|
1680
|
+
marginLeft: decimalPointSpacing,
|
|
1681
|
+
marginRight: decimalPointSpacing
|
|
1682
|
+
};
|
|
1683
|
+
if (children === undefined || children === null) return null;
|
|
1684
|
+
const str = children.toString();
|
|
1685
|
+
// Combine base styles with optional className
|
|
1686
|
+
const containerClasses = `flex-row flex-wrap gap-1 ${className || ''}`;
|
|
1687
|
+
const textClasses = 'dark:text-gray-100';
|
|
1688
|
+
const containerStyle = [cn(containerClasses), style].filter(Boolean);
|
|
1689
|
+
const textStyleMerged = [cn(textClasses), textStyle].filter(Boolean);
|
|
1690
|
+
if (variant === 'space') {
|
|
1691
|
+
// Split into integer and decimal parts
|
|
1692
|
+
const [intPart, fracPart] = str.split('.');
|
|
1693
|
+
// group digits every 3, right to left (only for integer part)
|
|
1694
|
+
const groups = groupDigits(intPart);
|
|
1695
|
+
return jsxs(View, {
|
|
1696
|
+
style: containerStyle,
|
|
1697
|
+
children: [groups.map((grp, i) => jsx(Text$1, {
|
|
1698
|
+
style: textStyleMerged,
|
|
1699
|
+
children: grp
|
|
1700
|
+
}, i)), fracPart != null && jsxs(Fragment, {
|
|
1701
|
+
children: [jsx(Text$1, {
|
|
1702
|
+
style: [...textStyleMerged, decimalPointStyle],
|
|
1703
|
+
children: "."
|
|
1704
|
+
}), jsx(Text$1, {
|
|
1705
|
+
style: textStyleMerged,
|
|
1706
|
+
children: fracPart
|
|
1707
|
+
})]
|
|
1708
|
+
})]
|
|
1709
|
+
});
|
|
1710
|
+
} else {
|
|
1711
|
+
// comma variant
|
|
1712
|
+
const [intPart, fracPart] = str.split('.');
|
|
1713
|
+
const groups = groupDigits(intPart);
|
|
1714
|
+
return jsxs(View, {
|
|
1715
|
+
style: containerStyle,
|
|
1716
|
+
children: [groups.map((grp, i) => jsxs(View, {
|
|
1717
|
+
style: cn('flex-row'),
|
|
1718
|
+
children: [jsx(Text$1, {
|
|
1719
|
+
style: textStyleMerged,
|
|
1720
|
+
children: grp
|
|
1721
|
+
}), i < groups.length - 1 && jsx(Text$1, {
|
|
1722
|
+
style: textStyleMerged,
|
|
1723
|
+
children: ","
|
|
1724
|
+
})]
|
|
1725
|
+
}, i)), fracPart != null && jsxs(Fragment, {
|
|
1726
|
+
children: [jsx(Text$1, {
|
|
1727
|
+
style: [...textStyleMerged, decimalPointStyle],
|
|
1728
|
+
children: "."
|
|
1729
|
+
}), jsx(Text$1, {
|
|
1730
|
+
style: textStyleMerged,
|
|
1731
|
+
children: fracPart
|
|
1732
|
+
})]
|
|
1733
|
+
})]
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
};
|
|
1737
|
+
|
|
1738
|
+
/**
|
|
1739
|
+
* Universal Clipboard utility for React Native and Expo
|
|
1740
|
+
*
|
|
1741
|
+
* Supports both:
|
|
1742
|
+
* - @react-native-clipboard/clipboard (React Native)
|
|
1743
|
+
* - expo-clipboard (Expo)
|
|
1744
|
+
*
|
|
1745
|
+
* Automatically detects which one is available and uses it.
|
|
1746
|
+
*/
|
|
1747
|
+
let clipboardInstance = null;
|
|
1748
|
+
/**
|
|
1749
|
+
* Get the clipboard instance
|
|
1750
|
+
* Tries to load expo-clipboard first, then falls back to @react-native-clipboard/clipboard
|
|
1751
|
+
*/
|
|
1752
|
+
function getClipboard() {
|
|
1753
|
+
if (clipboardInstance) {
|
|
1754
|
+
return clipboardInstance;
|
|
1755
|
+
}
|
|
1756
|
+
try {
|
|
1757
|
+
// Try expo-clipboard first (most common in Expo projects)
|
|
1758
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1759
|
+
const ExpoClipboard = require('expo-clipboard');
|
|
1760
|
+
if ((ExpoClipboard === null || ExpoClipboard === void 0 ? void 0 : ExpoClipboard.setStringAsync) && (ExpoClipboard === null || ExpoClipboard === void 0 ? void 0 : ExpoClipboard.getStringAsync)) {
|
|
1761
|
+
clipboardInstance = {
|
|
1762
|
+
setString: text => {
|
|
1763
|
+
ExpoClipboard.setStringAsync(text).catch(err => {
|
|
1764
|
+
console.warn('[dash-ui-kit] Failed to copy to clipboard:', err);
|
|
1765
|
+
});
|
|
1766
|
+
},
|
|
1767
|
+
getString: () => ExpoClipboard.getStringAsync()
|
|
1768
|
+
};
|
|
1769
|
+
return clipboardInstance;
|
|
1770
|
+
}
|
|
1771
|
+
} catch (err) {
|
|
1772
|
+
// expo-clipboard not available, continue to try React Native clipboard
|
|
1773
|
+
}
|
|
1774
|
+
try {
|
|
1775
|
+
// Try @react-native-clipboard/clipboard (React Native)
|
|
1776
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
1777
|
+
const RNClipboard = require('@react-native-clipboard/clipboard');
|
|
1778
|
+
if ((RNClipboard === null || RNClipboard === void 0 ? void 0 : RNClipboard.default) || (RNClipboard === null || RNClipboard === void 0 ? void 0 : RNClipboard.Clipboard)) {
|
|
1779
|
+
const clipboard = RNClipboard.default || RNClipboard.Clipboard;
|
|
1780
|
+
clipboardInstance = {
|
|
1781
|
+
setString: text => clipboard.setString(text),
|
|
1782
|
+
getString: () => clipboard.getString()
|
|
1783
|
+
};
|
|
1784
|
+
return clipboardInstance;
|
|
1785
|
+
}
|
|
1786
|
+
} catch (err) {
|
|
1787
|
+
// @react-native-clipboard/clipboard not available
|
|
1788
|
+
}
|
|
1789
|
+
// No clipboard available - return stub
|
|
1790
|
+
console.warn('[dash-ui-kit] No clipboard library found. Please install either:\n' + ' - expo-clipboard (for Expo projects): npx expo install expo-clipboard\n' + ' - @react-native-clipboard/clipboard (for React Native): npm install @react-native-clipboard/clipboard');
|
|
1791
|
+
clipboardInstance = {
|
|
1792
|
+
setString: () => {
|
|
1793
|
+
console.warn('[dash-ui-kit] Clipboard not available');
|
|
1794
|
+
},
|
|
1795
|
+
getString: async () => ''
|
|
1796
|
+
};
|
|
1797
|
+
return clipboardInstance;
|
|
1798
|
+
}
|
|
1799
|
+
/**
|
|
1800
|
+
* Universal Clipboard object
|
|
1801
|
+
* Compatible with both expo-clipboard and @react-native-clipboard/clipboard
|
|
1802
|
+
*/
|
|
1803
|
+
const Clipboard = {
|
|
1804
|
+
/**
|
|
1805
|
+
* Set string to clipboard
|
|
1806
|
+
* @param text - Text to copy
|
|
1807
|
+
*/
|
|
1808
|
+
setString: text => {
|
|
1809
|
+
const clipboard = getClipboard();
|
|
1810
|
+
clipboard.setString(text);
|
|
1811
|
+
},
|
|
1812
|
+
/**
|
|
1813
|
+
* Get string from clipboard
|
|
1814
|
+
* @returns Promise with clipboard content
|
|
1815
|
+
*/
|
|
1816
|
+
getString: () => {
|
|
1817
|
+
const clipboard = getClipboard();
|
|
1818
|
+
return clipboard.getString();
|
|
1819
|
+
}
|
|
1820
|
+
};
|
|
1821
|
+
|
|
1822
|
+
const FEEDBACK_DURATION_MS = 1000;
|
|
1823
|
+
/**
|
|
1824
|
+
* React Native CopyButton component. Copies text to clipboard on press
|
|
1825
|
+
* and shows "Copied!" feedback briefly.
|
|
1826
|
+
*/
|
|
1827
|
+
const CopyButton = ({
|
|
1828
|
+
text,
|
|
1829
|
+
onCopy,
|
|
1830
|
+
className = '',
|
|
1831
|
+
style,
|
|
1832
|
+
textStyle,
|
|
1833
|
+
accessibilityLabel = 'Copy to clipboard'
|
|
1834
|
+
}) => {
|
|
1835
|
+
const [copied, setCopied] = useState(false);
|
|
1836
|
+
const timeoutRef = useRef(null);
|
|
1837
|
+
const handlePress = useCallback(() => {
|
|
1838
|
+
Clipboard.setString(text);
|
|
1839
|
+
setCopied(true);
|
|
1840
|
+
onCopy === null || onCopy === void 0 ? void 0 : onCopy(true);
|
|
1841
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
1842
|
+
timeoutRef.current = setTimeout(() => setCopied(false), FEEDBACK_DURATION_MS);
|
|
1843
|
+
}, [text, onCopy]);
|
|
1844
|
+
useEffect(() => {
|
|
1845
|
+
return () => {
|
|
1846
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
1847
|
+
};
|
|
1848
|
+
}, []);
|
|
1849
|
+
const buttonClasses = `p-0 flex-shrink-0 min-w-0 bg-transparent ${className}`.trim();
|
|
1850
|
+
const buttonStyle = [cn(buttonClasses), style].filter(Boolean);
|
|
1851
|
+
const copiedTextClasses = 'text-xs text-dash-brand font-medium';
|
|
1852
|
+
const copiedTextStyle = [cn(copiedTextClasses), textStyle].filter(Boolean);
|
|
1853
|
+
return jsx(Pressable, {
|
|
1854
|
+
onPress: handlePress,
|
|
1855
|
+
style: ({
|
|
1856
|
+
pressed
|
|
1857
|
+
}) => [buttonStyle, pressed && {
|
|
1858
|
+
opacity: 0.7
|
|
1859
|
+
}].filter(Boolean),
|
|
1860
|
+
accessibilityLabel: accessibilityLabel,
|
|
1861
|
+
accessibilityRole: "button",
|
|
1862
|
+
children: copied ? jsx(View, {
|
|
1863
|
+
style: cn('items-center justify-center min-w-4 min-h-4'),
|
|
1864
|
+
children: jsx(Text$1, {
|
|
1865
|
+
style: copiedTextStyle,
|
|
1866
|
+
children: "Copied!"
|
|
1867
|
+
})
|
|
1868
|
+
}) : jsx(CopyIcon, {
|
|
1869
|
+
color: "#0C1C33",
|
|
1870
|
+
size: 16
|
|
1871
|
+
})
|
|
1872
|
+
});
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
/**
|
|
1876
|
+
* NotActive component for React Native
|
|
1877
|
+
* Shows "n/a" text with theme-aware styling
|
|
1878
|
+
*/
|
|
1879
|
+
function NotActive(_a) {
|
|
1880
|
+
var {
|
|
1881
|
+
children,
|
|
1882
|
+
className = '',
|
|
1883
|
+
theme = 'light',
|
|
1884
|
+
style
|
|
1885
|
+
} = _a,
|
|
1886
|
+
props = __rest(_a, ["children", "className", "theme", "style"]);
|
|
1887
|
+
const themeColor = theme === 'dark' ? 'text-gray-500' : 'text-gray-400';
|
|
1888
|
+
const textClasses = `text-sm ${themeColor} ${className}`.trim();
|
|
1889
|
+
return jsx(Text$1, Object.assign({
|
|
1890
|
+
style: [cn(textClasses), style].filter(Boolean)
|
|
1891
|
+
}, props, {
|
|
1892
|
+
children: children !== null && children !== void 0 ? children : 'n/a'
|
|
1893
|
+
}));
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
/** CVA for the root container with light/dark theme */
|
|
1897
|
+
const identifier = cva('flex flex-row items-center font-dash-grotesque text-sm font-normal', {
|
|
1898
|
+
variants: {
|
|
1899
|
+
theme: {
|
|
1900
|
+
light: 'text-gray-900',
|
|
1901
|
+
dark: 'text-white'
|
|
1902
|
+
},
|
|
1903
|
+
ellipsis: {
|
|
1904
|
+
false: '',
|
|
1905
|
+
true: 'overflow-hidden'
|
|
1906
|
+
},
|
|
1907
|
+
highlight: {
|
|
1908
|
+
default: '',
|
|
1909
|
+
dim: '',
|
|
1910
|
+
highlight: '',
|
|
1911
|
+
first: '',
|
|
1912
|
+
last: '',
|
|
1913
|
+
both: ''
|
|
1914
|
+
}
|
|
1915
|
+
},
|
|
1916
|
+
defaultVariants: {
|
|
1917
|
+
theme: 'light',
|
|
1918
|
+
ellipsis: false,
|
|
1919
|
+
highlight: 'default'
|
|
1920
|
+
}
|
|
1921
|
+
});
|
|
1922
|
+
/** CVA for each symbol text: inherits root color or dims */
|
|
1923
|
+
const symbol = cva('flex-1', {
|
|
1924
|
+
variants: {
|
|
1925
|
+
dim: {
|
|
1926
|
+
false: '',
|
|
1927
|
+
true: 'opacity-50'
|
|
1928
|
+
}
|
|
1929
|
+
},
|
|
1930
|
+
defaultVariants: {
|
|
1931
|
+
dim: false
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1934
|
+
/** Highlight modes configuration */
|
|
1935
|
+
const highlightModes = {
|
|
1936
|
+
default: {
|
|
1937
|
+
first: true,
|
|
1938
|
+
middle: false,
|
|
1939
|
+
last: true
|
|
1940
|
+
},
|
|
1941
|
+
dim: {
|
|
1942
|
+
first: false,
|
|
1943
|
+
middle: false,
|
|
1944
|
+
last: false
|
|
1945
|
+
},
|
|
1946
|
+
highlight: {
|
|
1947
|
+
first: true,
|
|
1948
|
+
middle: true,
|
|
1949
|
+
last: true
|
|
1950
|
+
},
|
|
1951
|
+
first: {
|
|
1952
|
+
first: true,
|
|
1953
|
+
middle: false,
|
|
1954
|
+
last: false
|
|
1955
|
+
},
|
|
1956
|
+
last: {
|
|
1957
|
+
first: false,
|
|
1958
|
+
middle: false,
|
|
1959
|
+
last: true
|
|
1960
|
+
},
|
|
1961
|
+
both: {
|
|
1962
|
+
first: true,
|
|
1963
|
+
middle: false,
|
|
1964
|
+
last: true
|
|
1965
|
+
}
|
|
1966
|
+
};
|
|
1967
|
+
/**
|
|
1968
|
+
* HighlightedID subcomponent
|
|
1969
|
+
* Renders text with highlighting based on mode
|
|
1970
|
+
*/
|
|
1971
|
+
const HighlightedID = ({
|
|
1972
|
+
children,
|
|
1973
|
+
mode,
|
|
1974
|
+
theme = 'light',
|
|
1975
|
+
textStyle
|
|
1976
|
+
}) => {
|
|
1977
|
+
if (children == null || children === '') return jsx(NotActive, {
|
|
1978
|
+
theme: theme
|
|
1979
|
+
});
|
|
1980
|
+
const text = String(children);
|
|
1981
|
+
const cfg = highlightModes[mode];
|
|
1982
|
+
const count = 5;
|
|
1983
|
+
const minLength = count * 2 + 1; // 11
|
|
1984
|
+
if (text.length < minLength) {
|
|
1985
|
+
const symbolStyle = [cn(symbol({
|
|
1986
|
+
dim: cfg.middle
|
|
1987
|
+
})), textStyle].filter(Boolean);
|
|
1988
|
+
return jsx(Text$1, {
|
|
1989
|
+
style: symbolStyle,
|
|
1990
|
+
children: text
|
|
1991
|
+
});
|
|
1992
|
+
}
|
|
1993
|
+
const first = text.slice(0, count);
|
|
1994
|
+
const middle = text.slice(count, text.length - count);
|
|
1995
|
+
const last = text.slice(-5);
|
|
1996
|
+
const firstStyle = [cn(symbol({
|
|
1997
|
+
dim: !cfg.first
|
|
1998
|
+
})), textStyle].filter(Boolean);
|
|
1999
|
+
const middleStyle = [cn(symbol({
|
|
2000
|
+
dim: !cfg.middle
|
|
2001
|
+
})), textStyle].filter(Boolean);
|
|
2002
|
+
const lastStyle = [cn(symbol({
|
|
2003
|
+
dim: !cfg.last
|
|
2004
|
+
})), textStyle].filter(Boolean);
|
|
2005
|
+
return jsxs(Text$1, {
|
|
2006
|
+
children: [jsx(Text$1, {
|
|
2007
|
+
style: firstStyle,
|
|
2008
|
+
children: first
|
|
2009
|
+
}), jsx(Text$1, {
|
|
2010
|
+
style: middleStyle,
|
|
2011
|
+
children: middle
|
|
2012
|
+
}), jsx(Text$1, {
|
|
2013
|
+
style: lastStyle,
|
|
2014
|
+
children: last
|
|
2015
|
+
})]
|
|
2016
|
+
});
|
|
2017
|
+
};
|
|
2018
|
+
/**
|
|
2019
|
+
* MiddleEllipsisText subcomponent
|
|
2020
|
+
* Renders text with ellipsis in the middle
|
|
2021
|
+
*/
|
|
2022
|
+
const MiddleEllipsisText = ({
|
|
2023
|
+
children,
|
|
2024
|
+
edgeChars,
|
|
2025
|
+
theme = 'light',
|
|
2026
|
+
textStyle
|
|
2027
|
+
}) => {
|
|
2028
|
+
if (children == null || children === '') return jsx(NotActive, {
|
|
2029
|
+
theme: theme
|
|
2030
|
+
});
|
|
2031
|
+
const text = String(children);
|
|
2032
|
+
if (text.length <= edgeChars * 2) {
|
|
2033
|
+
const style = textStyle ? [textStyle] : undefined;
|
|
2034
|
+
return jsx(Text$1, {
|
|
2035
|
+
style: style,
|
|
2036
|
+
children: text
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
const first = text.slice(0, edgeChars);
|
|
2040
|
+
const last = text.slice(-edgeChars);
|
|
2041
|
+
const ellipsisStyle = [cn('opacity-50'), textStyle].filter(Boolean);
|
|
2042
|
+
return jsxs(Text$1, {
|
|
2043
|
+
children: [jsx(Text$1, {
|
|
2044
|
+
style: textStyle,
|
|
2045
|
+
children: first
|
|
2046
|
+
}), jsx(Text$1, {
|
|
2047
|
+
style: ellipsisStyle,
|
|
2048
|
+
children: "\u2026"
|
|
2049
|
+
}), jsx(Text$1, {
|
|
2050
|
+
style: textStyle,
|
|
2051
|
+
children: last
|
|
2052
|
+
})]
|
|
2053
|
+
});
|
|
2054
|
+
};
|
|
2055
|
+
/**
|
|
2056
|
+
* Identifier component for React Native
|
|
2057
|
+
* Shows an ID string with optional highlighting, avatar, copy button, and ellipsis modes.
|
|
2058
|
+
*
|
|
2059
|
+
* Features:
|
|
2060
|
+
* - Highlight modes: default, dim, highlight, first, last, both
|
|
2061
|
+
* - Ellipsis modes: standard (tail), middle, maxLines
|
|
2062
|
+
* - Avatar integration
|
|
2063
|
+
* - Copy button integration
|
|
2064
|
+
* - Theme support (light/dark)
|
|
2065
|
+
*
|
|
2066
|
+
* @example
|
|
2067
|
+
* ```tsx
|
|
2068
|
+
* <Identifier highlight="both">0x1234567890abcdef</Identifier>
|
|
2069
|
+
* <Identifier avatar copyButton>alice@example.com</Identifier>
|
|
2070
|
+
* <Identifier middleEllipsis edgeChars={6}>very-long-identifier</Identifier>
|
|
2071
|
+
* <Identifier maxLines={2}>Multi-line\nidentifier\ntext</Identifier>
|
|
2072
|
+
* ```
|
|
2073
|
+
*/
|
|
2074
|
+
const Identifier = _a => {
|
|
2075
|
+
var {
|
|
2076
|
+
children,
|
|
2077
|
+
ellipsis = false,
|
|
2078
|
+
highlight = undefined,
|
|
2079
|
+
avatar = false,
|
|
2080
|
+
copyButton = false,
|
|
2081
|
+
maxLines = 0,
|
|
2082
|
+
className = '',
|
|
2083
|
+
middleEllipsis = false,
|
|
2084
|
+
edgeChars = 4,
|
|
2085
|
+
theme = 'light',
|
|
2086
|
+
style,
|
|
2087
|
+
textStyle
|
|
2088
|
+
} = _a,
|
|
2089
|
+
props = __rest(_a, ["children", "ellipsis", "highlight", "avatar", "copyButton", "maxLines", "className", "middleEllipsis", "edgeChars", "theme", "style", "textStyle"]);
|
|
2090
|
+
const [containerWidth, setContainerWidth] = useState(0);
|
|
2091
|
+
// Handle container layout changes
|
|
2092
|
+
const handleLayout = useCallback(event => {
|
|
2093
|
+
const {
|
|
2094
|
+
width
|
|
2095
|
+
} = event.nativeEvent.layout;
|
|
2096
|
+
setContainerWidth(width);
|
|
2097
|
+
}, []);
|
|
2098
|
+
const rootClasses = `${identifier({
|
|
2099
|
+
theme: theme,
|
|
2100
|
+
ellipsis,
|
|
2101
|
+
highlight
|
|
2102
|
+
})} ${className}`.trim();
|
|
2103
|
+
// Determine if we should use standard ellipsis with numberOfLines
|
|
2104
|
+
const useStandardEllipsis = ellipsis === true && !middleEllipsis && maxLines === 0;
|
|
2105
|
+
const useMaxLines = maxLines > 0 && !middleEllipsis;
|
|
2106
|
+
// Symbol container classes
|
|
2107
|
+
const symbolContainerClass = ellipsis === true ? 'flex-1 overflow-hidden' : 'flex-1';
|
|
2108
|
+
// Merge text styles
|
|
2109
|
+
const finalTextStyle = [cn('leading-4'), textStyle].filter(Boolean);
|
|
2110
|
+
return jsxs(View, Object.assign({
|
|
2111
|
+
style: [cn(rootClasses), style].filter(Boolean),
|
|
2112
|
+
onLayout: handleLayout
|
|
2113
|
+
}, props, {
|
|
2114
|
+
children: [avatar && children != null && children !== '' && jsx(Avatar, {
|
|
2115
|
+
username: children,
|
|
2116
|
+
className: "mr-2",
|
|
2117
|
+
width: 24,
|
|
2118
|
+
height: 24
|
|
2119
|
+
}), jsx(View, {
|
|
2120
|
+
style: cn(symbolContainerClass),
|
|
2121
|
+
children: children != null && children !== '' && middleEllipsis ? jsx(MiddleEllipsisText, {
|
|
2122
|
+
edgeChars: edgeChars,
|
|
2123
|
+
theme: theme,
|
|
2124
|
+
textStyle: textStyle,
|
|
2125
|
+
children: children
|
|
2126
|
+
}) : children != null && children !== '' && highlight != null ? jsx(HighlightedID, {
|
|
2127
|
+
mode: highlight,
|
|
2128
|
+
theme: theme,
|
|
2129
|
+
textStyle: textStyle,
|
|
2130
|
+
children: children
|
|
2131
|
+
}) : children != null && children !== '' ? jsx(Text$1, {
|
|
2132
|
+
numberOfLines: useStandardEllipsis ? 1 : useMaxLines ? maxLines : undefined,
|
|
2133
|
+
ellipsizeMode: useStandardEllipsis || useMaxLines ? 'tail' : undefined,
|
|
2134
|
+
style: finalTextStyle,
|
|
2135
|
+
children: children
|
|
2136
|
+
}) : jsx(NotActive, {
|
|
2137
|
+
theme: theme
|
|
2138
|
+
})
|
|
2139
|
+
}), copyButton && children != null && children !== '' && jsx(CopyButton, {
|
|
2140
|
+
className: "ml-3",
|
|
2141
|
+
text: children
|
|
2142
|
+
})]
|
|
2143
|
+
}));
|
|
2144
|
+
};
|
|
2145
|
+
|
|
2146
|
+
/**
|
|
2147
|
+
* ValueCard CVA - twrnc-compatible classes.
|
|
2148
|
+
* dash-block-sm/md/xl expanded: px-3 py-2 rounded-[10px], px-[18px] py-3 rounded-[14px], px-[25px] py-5 rounded-[16px]
|
|
2149
|
+
* hover: classes omitted (RN uses Pressable opacity for press feedback)
|
|
2150
|
+
*/
|
|
2151
|
+
const valueCardStyles = cva('flex flex-row items-center', {
|
|
2152
|
+
variants: {
|
|
2153
|
+
theme: {
|
|
2154
|
+
light: 'border-gray-200',
|
|
2155
|
+
dark: 'bg-gray-800/50 border-gray-400'
|
|
2156
|
+
},
|
|
2157
|
+
colorScheme: {
|
|
2158
|
+
default: '',
|
|
2159
|
+
transparent: 'bg-transparent',
|
|
2160
|
+
green: 'text-green-500 bg-green-200 border-green-400',
|
|
2161
|
+
lightBlue: 'bg-[rgba(150,167,255,0.1)] border-[rgba(76,126,255,0.2)]',
|
|
2162
|
+
white: 'bg-white',
|
|
2163
|
+
lightGray: 'bg-[#0c1c3308]',
|
|
2164
|
+
yellow: 'bg-dash-yellow-light border-dash-yellow'
|
|
2165
|
+
},
|
|
2166
|
+
size: {
|
|
2167
|
+
xs: 'px-2 py-1 rounded',
|
|
2168
|
+
sm: 'px-3 py-2 rounded-[10px]',
|
|
2169
|
+
md: 'px-[18px] py-3 rounded-[14px]',
|
|
2170
|
+
xl: 'px-[25px] py-5 rounded-[16px]'
|
|
2171
|
+
},
|
|
2172
|
+
clickable: {
|
|
2173
|
+
false: '',
|
|
2174
|
+
true: ''
|
|
2175
|
+
},
|
|
2176
|
+
loading: {
|
|
2177
|
+
false: '',
|
|
2178
|
+
true: 'opacity-70'
|
|
2179
|
+
},
|
|
2180
|
+
border: {
|
|
2181
|
+
false: 'border-0',
|
|
2182
|
+
true: 'border'
|
|
2183
|
+
}
|
|
2184
|
+
},
|
|
2185
|
+
defaultVariants: {
|
|
2186
|
+
theme: 'light',
|
|
2187
|
+
colorScheme: 'default',
|
|
2188
|
+
size: 'md',
|
|
2189
|
+
clickable: false,
|
|
2190
|
+
loading: false,
|
|
2191
|
+
border: true
|
|
2192
|
+
}
|
|
2193
|
+
});
|
|
2194
|
+
/**
|
|
2195
|
+
* React Native ValueCard - card container with theme, color schemes, sizes,
|
|
2196
|
+
* clickability, loading state, and optional border.
|
|
2197
|
+
*/
|
|
2198
|
+
const ValueCard = _a => {
|
|
2199
|
+
var {
|
|
2200
|
+
theme = 'light',
|
|
2201
|
+
colorScheme = 'default',
|
|
2202
|
+
size = 'md',
|
|
2203
|
+
clickable = false,
|
|
2204
|
+
loading = false,
|
|
2205
|
+
border = true,
|
|
2206
|
+
className = '',
|
|
2207
|
+
style,
|
|
2208
|
+
children,
|
|
2209
|
+
onPress
|
|
2210
|
+
} = _a,
|
|
2211
|
+
props = __rest(_a, ["theme", "colorScheme", "size", "clickable", "loading", "border", "className", "style", "children", "onPress"]);
|
|
2212
|
+
const isClickable = Boolean(onPress !== null && onPress !== void 0 ? onPress : clickable);
|
|
2213
|
+
const isDisabled = loading;
|
|
2214
|
+
const classes = valueCardStyles({
|
|
2215
|
+
theme,
|
|
2216
|
+
colorScheme,
|
|
2217
|
+
size,
|
|
2218
|
+
clickable: isClickable,
|
|
2219
|
+
loading,
|
|
2220
|
+
border
|
|
2221
|
+
});
|
|
2222
|
+
const combinedClasses = className ? `${classes} ${className}` : classes;
|
|
2223
|
+
const containerStyle = [cn(combinedClasses), style].filter(Boolean);
|
|
2224
|
+
const content = loading ? jsx(ActivityIndicator, {
|
|
2225
|
+
testID: "value-card-loading",
|
|
2226
|
+
size: "small",
|
|
2227
|
+
color: colorScheme === 'green' ? '#22c55e' : colorScheme === 'lightBlue' ? '#4C7EFF' : '#6B7280'
|
|
2228
|
+
}) : children;
|
|
2229
|
+
if (isClickable && !isDisabled) {
|
|
2230
|
+
return jsx(Pressable, Object.assign({
|
|
2231
|
+
style: ({
|
|
2232
|
+
pressed
|
|
2233
|
+
}) => [...containerStyle, pressed && {
|
|
2234
|
+
opacity: 0.9
|
|
2235
|
+
}],
|
|
2236
|
+
onPress: onPress,
|
|
2237
|
+
disabled: isDisabled
|
|
2238
|
+
}, props, {
|
|
2239
|
+
children: content
|
|
2240
|
+
}));
|
|
2241
|
+
}
|
|
2242
|
+
return jsx(View, Object.assign({
|
|
2243
|
+
style: containerStyle
|
|
2244
|
+
}, props, {
|
|
2245
|
+
children: content
|
|
2246
|
+
}));
|
|
2247
|
+
};
|
|
2248
|
+
|
|
2249
|
+
/**
|
|
2250
|
+
* Dash Logo component for React Native with customizable size and color
|
|
2251
|
+
* Original aspect ratio: 30:25 (1.2:1)
|
|
2252
|
+
*
|
|
2253
|
+
* Color can be set via:
|
|
2254
|
+
* - color prop (default: #4C7EFF)
|
|
2255
|
+
*
|
|
2256
|
+
* Container supports:
|
|
2257
|
+
* - containerPadding: padding around the logo
|
|
2258
|
+
* - containerSize: width/height of the container
|
|
2259
|
+
* - containerClassName: Tailwind classes for the container
|
|
2260
|
+
* - containerStyle: Additional style object for the container
|
|
2261
|
+
*/
|
|
2262
|
+
const DashLogo = ({
|
|
2263
|
+
color = '#4C7EFF',
|
|
2264
|
+
size,
|
|
2265
|
+
width,
|
|
2266
|
+
height,
|
|
2267
|
+
className = '',
|
|
2268
|
+
onPress,
|
|
2269
|
+
containerPadding,
|
|
2270
|
+
containerSize,
|
|
2271
|
+
containerClassName = '',
|
|
2272
|
+
containerStyle
|
|
2273
|
+
}) => {
|
|
2274
|
+
const logoWidth = width || size || 30;
|
|
2275
|
+
const logoHeight = height || (size ? size * 25 / 30 : 25);
|
|
2276
|
+
const baseContainerClasses = 'flex justify-center items-center';
|
|
2277
|
+
const containerClasses = containerClassName ? `${baseContainerClasses} ${containerClassName}` : baseContainerClasses;
|
|
2278
|
+
const inlineContainerStyle = Object.assign({
|
|
2279
|
+
padding: containerPadding,
|
|
2280
|
+
width: containerSize,
|
|
2281
|
+
height: containerSize
|
|
2282
|
+
}, containerStyle);
|
|
2283
|
+
const combinedContainerStyle = [cn(containerClasses), inlineContainerStyle].filter(Boolean);
|
|
2284
|
+
const logoElement = jsxs(Svg, {
|
|
2285
|
+
width: logoWidth,
|
|
2286
|
+
height: logoHeight,
|
|
2287
|
+
viewBox: '0 0 30 25',
|
|
2288
|
+
fill: 'none',
|
|
2289
|
+
children: [jsx(Path, {
|
|
2290
|
+
d: 'M19.6465 0C29.2466 2.13767e-05 30.9542 5.2464 29.585 12.6006C28.6773 17.5547 26.3845 21.3391 22.5537 23.1084C20.8153 23.9084 19.1848 24.3555 15.3389 24.3555H4.44629L5.33887 19.293H14.9229C20.6921 19.3084 22.2159 16.8009 22.9697 14.6162C23.2467 13.8008 23.9084 11.2619 23.9238 9.76953C23.9699 6.84642 22.5383 5.07715 17.6768 5.07715L7.81543 5.06152L8.72363 0H19.6465Z',
|
|
2291
|
+
fill: color
|
|
2292
|
+
}), jsx(Path, {
|
|
2293
|
+
d: 'M15.2002 9.63184C15.2002 9.63184 15.0775 10.232 14.7236 11.709C14.4621 12.8321 14.0462 14.6934 11.1846 14.6934H0C0.00327153 14.6775 0.12745 14.0734 0.476562 12.6162C0.73811 11.493 1.15435 9.63184 4.01562 9.63184H15.2002Z',
|
|
2294
|
+
fill: color
|
|
2295
|
+
})]
|
|
2296
|
+
});
|
|
2297
|
+
if (onPress) {
|
|
2298
|
+
return jsx(Pressable, {
|
|
2299
|
+
style: combinedContainerStyle,
|
|
2300
|
+
onPress: onPress,
|
|
2301
|
+
children: logoElement
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
return jsx(View, {
|
|
2305
|
+
style: combinedContainerStyle,
|
|
2306
|
+
children: logoElement
|
|
2307
|
+
});
|
|
2308
|
+
};
|
|
2309
|
+
|
|
2310
|
+
const defaultColors = {
|
|
2311
|
+
light: {
|
|
2312
|
+
SUCCESS: '#1CC400',
|
|
2313
|
+
FAIL: '#F45858',
|
|
2314
|
+
QUEUED: '#F4A358',
|
|
2315
|
+
POOLED: '#008DE4',
|
|
2316
|
+
BROADCASTED: '#008DE4'
|
|
2317
|
+
},
|
|
2318
|
+
dark: {
|
|
2319
|
+
SUCCESS: '#22D32E',
|
|
2320
|
+
FAIL: '#FF6B6B',
|
|
2321
|
+
QUEUED: '#FFB366',
|
|
2322
|
+
POOLED: '#42A5F5',
|
|
2323
|
+
BROADCASTED: '#42A5F5'
|
|
2324
|
+
}
|
|
2325
|
+
};
|
|
2326
|
+
const iconMap = {
|
|
2327
|
+
SUCCESS: SuccessIcon,
|
|
2328
|
+
FAIL: ErrorIcon,
|
|
2329
|
+
QUEUED: QueuedIcon,
|
|
2330
|
+
POOLED: PooledIcon,
|
|
2331
|
+
BROADCASTED: BroadcastedIcon
|
|
2332
|
+
};
|
|
2333
|
+
/**
|
|
2334
|
+
* Renders an icon corresponding to the given `status`.
|
|
2335
|
+
* If `status` is not recognized, returns null.
|
|
2336
|
+
* Colors adapt to light/dark theme unless overridden.
|
|
2337
|
+
*/
|
|
2338
|
+
const TransactionStatusIcon = _a => {
|
|
2339
|
+
var {
|
|
2340
|
+
status,
|
|
2341
|
+
color,
|
|
2342
|
+
theme = 'light'
|
|
2343
|
+
} = _a,
|
|
2344
|
+
props = __rest(_a, ["status", "color", "theme"]);
|
|
2345
|
+
const IconComponent = iconMap[status];
|
|
2346
|
+
if (IconComponent == null) return null;
|
|
2347
|
+
const iconColor = color !== null && color !== void 0 ? color : defaultColors[theme][status];
|
|
2348
|
+
return jsx(IconComponent, Object.assign({
|
|
2349
|
+
color: iconColor
|
|
2350
|
+
}, props));
|
|
2351
|
+
};
|
|
2352
|
+
|
|
2353
|
+
/**
|
|
2354
|
+
* Hook for debouncing values with extended functionality
|
|
2355
|
+
* React Native compatible version
|
|
2356
|
+
*
|
|
2357
|
+
* @param value - Value to debounce
|
|
2358
|
+
* @param options - Configuration options
|
|
2359
|
+
* @returns Object with debounced value and control methods
|
|
2360
|
+
*/
|
|
2361
|
+
const useDebounce = (value, options) => {
|
|
2362
|
+
// Backward compatibility support - if number is passed, it's delay
|
|
2363
|
+
const config = typeof options === 'number' ? {
|
|
2364
|
+
delay: options
|
|
2365
|
+
} : options;
|
|
2366
|
+
const {
|
|
2367
|
+
delay,
|
|
2368
|
+
callback,
|
|
2369
|
+
immediate = false
|
|
2370
|
+
} = config;
|
|
2371
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
2372
|
+
const [isPending, setIsPending] = useState(false);
|
|
2373
|
+
const timeoutRef = useRef(null);
|
|
2374
|
+
const isFirstRun = useRef(true);
|
|
2375
|
+
const cancel = useCallback(() => {
|
|
2376
|
+
if (timeoutRef.current) {
|
|
2377
|
+
clearTimeout(timeoutRef.current);
|
|
2378
|
+
timeoutRef.current = null;
|
|
2379
|
+
setIsPending(false);
|
|
2380
|
+
}
|
|
2381
|
+
}, []);
|
|
2382
|
+
const flush = useCallback(() => {
|
|
2383
|
+
cancel();
|
|
2384
|
+
setDebouncedValue(value);
|
|
2385
|
+
callback === null || callback === void 0 ? void 0 : callback(value);
|
|
2386
|
+
setIsPending(false);
|
|
2387
|
+
}, [value, callback, cancel]);
|
|
2388
|
+
useEffect(() => {
|
|
2389
|
+
// If immediate === true and this is first run, set value immediately
|
|
2390
|
+
if (immediate && isFirstRun.current) {
|
|
2391
|
+
setDebouncedValue(value);
|
|
2392
|
+
callback === null || callback === void 0 ? void 0 : callback(value);
|
|
2393
|
+
isFirstRun.current = false;
|
|
2394
|
+
return;
|
|
2395
|
+
}
|
|
2396
|
+
isFirstRun.current = false;
|
|
2397
|
+
setIsPending(true);
|
|
2398
|
+
const handler = setTimeout(() => {
|
|
2399
|
+
setDebouncedValue(value);
|
|
2400
|
+
callback === null || callback === void 0 ? void 0 : callback(value);
|
|
2401
|
+
setIsPending(false);
|
|
2402
|
+
timeoutRef.current = null;
|
|
2403
|
+
}, delay);
|
|
2404
|
+
timeoutRef.current = handler;
|
|
2405
|
+
return () => {
|
|
2406
|
+
clearTimeout(handler);
|
|
2407
|
+
setIsPending(false);
|
|
2408
|
+
};
|
|
2409
|
+
}, [value, delay, callback, immediate]);
|
|
2410
|
+
// Cleanup on unmount
|
|
2411
|
+
useEffect(() => {
|
|
2412
|
+
return () => {
|
|
2413
|
+
if (timeoutRef.current) {
|
|
2414
|
+
clearTimeout(timeoutRef.current);
|
|
2415
|
+
}
|
|
2416
|
+
};
|
|
2417
|
+
}, []);
|
|
2418
|
+
return {
|
|
2419
|
+
debouncedValue,
|
|
2420
|
+
flush,
|
|
2421
|
+
cancel,
|
|
2422
|
+
isPending
|
|
2423
|
+
};
|
|
2424
|
+
};
|
|
2425
|
+
|
|
2426
|
+
/**
|
|
2427
|
+
* Design tokens for React Native
|
|
2428
|
+
*
|
|
2429
|
+
* These tokens are derived from the web theme (src/styles/theme.pcss)
|
|
2430
|
+
* and optimized for React Native StyleSheet usage.
|
|
2431
|
+
*
|
|
2432
|
+
* @example
|
|
2433
|
+
* ```typescript
|
|
2434
|
+
* import { colors, spacing, typography, borderRadius, shadows } from 'dash-ui-kit/react-native';
|
|
2435
|
+
* import { StyleSheet, Platform } from 'react-native';
|
|
2436
|
+
*
|
|
2437
|
+
* const styles = StyleSheet.create({
|
|
2438
|
+
* container: {
|
|
2439
|
+
* backgroundColor: colors.brand,
|
|
2440
|
+
* padding: spacing[4],
|
|
2441
|
+
* borderRadius: borderRadius.md,
|
|
2442
|
+
* ...Platform.select({
|
|
2443
|
+
* ios: shadows.md.ios,
|
|
2444
|
+
* android: shadows.md.android,
|
|
2445
|
+
* }),
|
|
2446
|
+
* },
|
|
2447
|
+
* title: {
|
|
2448
|
+
* fontSize: typography.fontSize.xl,
|
|
2449
|
+
* fontWeight: typography.fontWeight.semibold,
|
|
2450
|
+
* lineHeight: typography.lineHeight.xl,
|
|
2451
|
+
* },
|
|
2452
|
+
* });
|
|
2453
|
+
* ```
|
|
2454
|
+
*/
|
|
2455
|
+
/**
|
|
2456
|
+
* Color palette
|
|
2457
|
+
* Derived from theme.pcss color variables
|
|
2458
|
+
*/
|
|
2459
|
+
const colors = {
|
|
2460
|
+
// Brand colors
|
|
2461
|
+
brand: '#4C7EFF',
|
|
2462
|
+
brandDim: '#96A7FF',
|
|
2463
|
+
brandDark: '#4D5895',
|
|
2464
|
+
brandDarkness: '#13172A',
|
|
2465
|
+
// Accent colors
|
|
2466
|
+
mint: '#60F6D2',
|
|
2467
|
+
mintHover: '#4DD4B1',
|
|
2468
|
+
// Yellow variants
|
|
2469
|
+
yellowLight: '#fef3c7',
|
|
2470
|
+
yellow: '#fde68a',
|
|
2471
|
+
// Primary colors
|
|
2472
|
+
primaryDarkBlue: '#0C1C33',
|
|
2473
|
+
primaryDieSubdued: 'rgba(12, 28, 51, 0.03)',
|
|
2474
|
+
// State colors - Green
|
|
2475
|
+
green: '#40BF40',
|
|
2476
|
+
green75: 'rgba(64, 191, 64, 0.75)',
|
|
2477
|
+
green15: 'rgba(64, 191, 64, 0.15)',
|
|
2478
|
+
green5: 'rgba(64, 191, 64, 0.05)',
|
|
2479
|
+
// State colors - Red
|
|
2480
|
+
red: '#CD2E00',
|
|
2481
|
+
red75: 'rgba(205, 46, 0, 0.75)',
|
|
2482
|
+
red15: 'rgba(205, 46, 0, 0.15)',
|
|
2483
|
+
red5: 'rgba(205, 46, 0, 0.05)',
|
|
2484
|
+
// State colors - Orange
|
|
2485
|
+
orange: '#F98F12',
|
|
2486
|
+
orange75: 'rgba(249, 143, 18, 0.75)',
|
|
2487
|
+
orange15: 'rgba(249, 143, 18, 0.15)',
|
|
2488
|
+
orange5: 'rgba(249, 143, 18, 0.05)',
|
|
2489
|
+
// Common colors
|
|
2490
|
+
white: '#FFFFFF',
|
|
2491
|
+
black: '#000000',
|
|
2492
|
+
transparent: 'transparent'
|
|
2493
|
+
};
|
|
2494
|
+
/**
|
|
2495
|
+
* Spacing scale
|
|
2496
|
+
* Based on 4px base unit (Tailwind-compatible)
|
|
2497
|
+
*/
|
|
2498
|
+
const spacing = {
|
|
2499
|
+
0: 0,
|
|
2500
|
+
1: 4,
|
|
2501
|
+
2: 8,
|
|
2502
|
+
3: 12,
|
|
2503
|
+
4: 16,
|
|
2504
|
+
5: 20,
|
|
2505
|
+
6: 24,
|
|
2506
|
+
7: 28,
|
|
2507
|
+
8: 32,
|
|
2508
|
+
9: 36,
|
|
2509
|
+
10: 40,
|
|
2510
|
+
11: 44,
|
|
2511
|
+
// 2.75rem from theme
|
|
2512
|
+
12: 48,
|
|
2513
|
+
14: 56,
|
|
2514
|
+
16: 64,
|
|
2515
|
+
18: 72,
|
|
2516
|
+
20: 80,
|
|
2517
|
+
24: 96,
|
|
2518
|
+
28: 112,
|
|
2519
|
+
32: 128,
|
|
2520
|
+
36: 144,
|
|
2521
|
+
40: 160,
|
|
2522
|
+
44: 176,
|
|
2523
|
+
48: 192,
|
|
2524
|
+
52: 208,
|
|
2525
|
+
56: 224,
|
|
2526
|
+
60: 240,
|
|
2527
|
+
64: 256
|
|
2528
|
+
};
|
|
2529
|
+
/**
|
|
2530
|
+
* Typography scale
|
|
2531
|
+
* Font sizes, weights, and line heights
|
|
2532
|
+
*/
|
|
2533
|
+
const typography = {
|
|
2534
|
+
/**
|
|
2535
|
+
* Font size scale
|
|
2536
|
+
*/
|
|
2537
|
+
fontSize: {
|
|
2538
|
+
xs: 12,
|
|
2539
|
+
sm: 14,
|
|
2540
|
+
base: 16,
|
|
2541
|
+
lg: 18,
|
|
2542
|
+
xl: 20,
|
|
2543
|
+
'2xl': 24,
|
|
2544
|
+
'3xl': 30,
|
|
2545
|
+
'4xl': 36,
|
|
2546
|
+
'5xl': 48,
|
|
2547
|
+
'6xl': 60,
|
|
2548
|
+
'7xl': 72,
|
|
2549
|
+
'8xl': 96,
|
|
2550
|
+
'9xl': 128
|
|
2551
|
+
},
|
|
2552
|
+
/**
|
|
2553
|
+
* Font weight scale
|
|
2554
|
+
* Values are strings for React Native compatibility
|
|
2555
|
+
*/
|
|
2556
|
+
fontWeight: {
|
|
2557
|
+
normal: '400',
|
|
2558
|
+
medium: '500',
|
|
2559
|
+
semibold: '600',
|
|
2560
|
+
bold: '700',
|
|
2561
|
+
extrabold: '800'
|
|
2562
|
+
},
|
|
2563
|
+
/**
|
|
2564
|
+
* Line height scale (in pixels)
|
|
2565
|
+
* Calculated based on common typography ratios
|
|
2566
|
+
*/
|
|
2567
|
+
lineHeight: {
|
|
2568
|
+
xs: 16,
|
|
2569
|
+
// 1.33x
|
|
2570
|
+
sm: 20,
|
|
2571
|
+
// 1.43x
|
|
2572
|
+
base: 24,
|
|
2573
|
+
// 1.5x
|
|
2574
|
+
lg: 28,
|
|
2575
|
+
// 1.56x
|
|
2576
|
+
xl: 28,
|
|
2577
|
+
// 1.4x
|
|
2578
|
+
'2xl': 32,
|
|
2579
|
+
// 1.33x
|
|
2580
|
+
'3xl': 36,
|
|
2581
|
+
// 1.2x
|
|
2582
|
+
'4xl': 40,
|
|
2583
|
+
// 1.11x
|
|
2584
|
+
'5xl': 56,
|
|
2585
|
+
// 1.17x
|
|
2586
|
+
'6xl': 72,
|
|
2587
|
+
// 1.2x
|
|
2588
|
+
'7xl': 84,
|
|
2589
|
+
// 1.17x
|
|
2590
|
+
'8xl': 112,
|
|
2591
|
+
// 1.17x
|
|
2592
|
+
'9xl': 144 // 1.13x
|
|
2593
|
+
},
|
|
2594
|
+
/**
|
|
2595
|
+
* Letter spacing (tracking)
|
|
2596
|
+
*/
|
|
2597
|
+
letterSpacing: {
|
|
2598
|
+
tighter: -0.8,
|
|
2599
|
+
tight: -0.4,
|
|
2600
|
+
normal: 0,
|
|
2601
|
+
wide: 0.4,
|
|
2602
|
+
wider: 0.8,
|
|
2603
|
+
widest: 1.6
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
/**
|
|
2607
|
+
* Border radius scale
|
|
2608
|
+
*/
|
|
2609
|
+
const borderRadius = {
|
|
2610
|
+
none: 0,
|
|
2611
|
+
xs: 4,
|
|
2612
|
+
sm: 10,
|
|
2613
|
+
md: 12,
|
|
2614
|
+
lg: 14,
|
|
2615
|
+
xl: 16,
|
|
2616
|
+
'2xl': 20,
|
|
2617
|
+
'3xl': 24,
|
|
2618
|
+
full: 9999
|
|
2619
|
+
};
|
|
2620
|
+
/**
|
|
2621
|
+
* Shadow presets
|
|
2622
|
+
* Platform-specific implementations for iOS and Android
|
|
2623
|
+
*
|
|
2624
|
+
* @example
|
|
2625
|
+
* ```typescript
|
|
2626
|
+
* import { Platform } from 'react-native';
|
|
2627
|
+
*
|
|
2628
|
+
* const shadowStyle = Platform.select({
|
|
2629
|
+
* ios: shadows.md.ios,
|
|
2630
|
+
* android: shadows.md.android,
|
|
2631
|
+
* });
|
|
2632
|
+
* ```
|
|
2633
|
+
*/
|
|
2634
|
+
const shadows = {
|
|
2635
|
+
/**
|
|
2636
|
+
* Small shadow - subtle elevation
|
|
2637
|
+
*/
|
|
2638
|
+
sm: {
|
|
2639
|
+
ios: {
|
|
2640
|
+
shadowColor: '#000000',
|
|
2641
|
+
shadowOffset: {
|
|
2642
|
+
width: 0,
|
|
2643
|
+
height: 1
|
|
2644
|
+
},
|
|
2645
|
+
shadowOpacity: 0.1,
|
|
2646
|
+
shadowRadius: 2
|
|
2647
|
+
},
|
|
2648
|
+
android: {
|
|
2649
|
+
elevation: 2
|
|
2650
|
+
}
|
|
2651
|
+
},
|
|
2652
|
+
/**
|
|
2653
|
+
* Medium shadow - standard elevation
|
|
2654
|
+
*/
|
|
2655
|
+
md: {
|
|
2656
|
+
ios: {
|
|
2657
|
+
shadowColor: '#000000',
|
|
2658
|
+
shadowOffset: {
|
|
2659
|
+
width: 0,
|
|
2660
|
+
height: 2
|
|
2661
|
+
},
|
|
2662
|
+
shadowOpacity: 0.15,
|
|
2663
|
+
shadowRadius: 4
|
|
2664
|
+
},
|
|
2665
|
+
android: {
|
|
2666
|
+
elevation: 4
|
|
2667
|
+
}
|
|
2668
|
+
},
|
|
2669
|
+
/**
|
|
2670
|
+
* Large shadow - prominent elevation
|
|
2671
|
+
*/
|
|
2672
|
+
lg: {
|
|
2673
|
+
ios: {
|
|
2674
|
+
shadowColor: '#000000',
|
|
2675
|
+
shadowOffset: {
|
|
2676
|
+
width: 0,
|
|
2677
|
+
height: 4
|
|
2678
|
+
},
|
|
2679
|
+
shadowOpacity: 0.2,
|
|
2680
|
+
shadowRadius: 8
|
|
2681
|
+
},
|
|
2682
|
+
android: {
|
|
2683
|
+
elevation: 8
|
|
2684
|
+
}
|
|
2685
|
+
},
|
|
2686
|
+
/**
|
|
2687
|
+
* Extra large shadow - maximum elevation
|
|
2688
|
+
*/
|
|
2689
|
+
xl: {
|
|
2690
|
+
ios: {
|
|
2691
|
+
shadowColor: '#000000',
|
|
2692
|
+
shadowOffset: {
|
|
2693
|
+
width: 0,
|
|
2694
|
+
height: 8
|
|
2695
|
+
},
|
|
2696
|
+
shadowOpacity: 0.25,
|
|
2697
|
+
shadowRadius: 16
|
|
2698
|
+
},
|
|
2699
|
+
android: {
|
|
2700
|
+
elevation: 12
|
|
2701
|
+
}
|
|
2702
|
+
}
|
|
2703
|
+
};
|
|
2704
|
+
/**
|
|
2705
|
+
* Border width scale
|
|
2706
|
+
*/
|
|
2707
|
+
const borderWidth = {
|
|
2708
|
+
0: 0,
|
|
2709
|
+
1: 1,
|
|
2710
|
+
2: 2,
|
|
2711
|
+
4: 4,
|
|
2712
|
+
8: 8
|
|
2713
|
+
};
|
|
2714
|
+
/**
|
|
2715
|
+
* Opacity scale
|
|
2716
|
+
*/
|
|
2717
|
+
const opacity = {
|
|
2718
|
+
0: 0,
|
|
2719
|
+
5: 0.05,
|
|
2720
|
+
10: 0.1,
|
|
2721
|
+
15: 0.15,
|
|
2722
|
+
20: 0.2,
|
|
2723
|
+
25: 0.25,
|
|
2724
|
+
30: 0.3,
|
|
2725
|
+
40: 0.4,
|
|
2726
|
+
50: 0.5,
|
|
2727
|
+
60: 0.6,
|
|
2728
|
+
70: 0.7,
|
|
2729
|
+
75: 0.75,
|
|
2730
|
+
80: 0.8,
|
|
2731
|
+
90: 0.9,
|
|
2732
|
+
95: 0.95,
|
|
2733
|
+
100: 1
|
|
2734
|
+
};
|
|
2735
|
+
/**
|
|
2736
|
+
* Z-index scale
|
|
2737
|
+
*/
|
|
2738
|
+
const zIndex = {
|
|
2739
|
+
0: 0,
|
|
2740
|
+
10: 10,
|
|
2741
|
+
20: 20,
|
|
2742
|
+
30: 30,
|
|
2743
|
+
40: 40,
|
|
2744
|
+
50: 50,
|
|
2745
|
+
auto: 'auto'
|
|
2746
|
+
};
|
|
2747
|
+
|
|
2748
|
+
/**
|
|
2749
|
+
* Utility functions for React Native styles
|
|
2750
|
+
*/
|
|
2751
|
+
/**
|
|
2752
|
+
* Creates an rgba color string from hex color and opacity
|
|
2753
|
+
*
|
|
2754
|
+
* @param hexColor - Hex color string (e.g., '#4C7EFF')
|
|
2755
|
+
* @param alpha - Opacity value between 0 and 1
|
|
2756
|
+
* @returns rgba color string
|
|
2757
|
+
*
|
|
2758
|
+
* @example
|
|
2759
|
+
* ```typescript
|
|
2760
|
+
* rgba('#4C7EFF', 0.5) // 'rgba(76, 126, 255, 0.5)'
|
|
2761
|
+
* rgba('#40BF40', 0.15) // 'rgba(64, 191, 64, 0.15)'
|
|
2762
|
+
* ```
|
|
2763
|
+
*/
|
|
2764
|
+
function rgba(hexColor, alpha) {
|
|
2765
|
+
const hex = hexColor.replace('#', '');
|
|
2766
|
+
const r = parseInt(hex.substring(0, 2), 16);
|
|
2767
|
+
const g = parseInt(hex.substring(2, 4), 16);
|
|
2768
|
+
const b = parseInt(hex.substring(4, 6), 16);
|
|
2769
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
2770
|
+
}
|
|
2771
|
+
/**
|
|
2772
|
+
* Converts hex color to rgba
|
|
2773
|
+
* Alias for rgba() with more explicit naming
|
|
2774
|
+
*
|
|
2775
|
+
* @param hexColor - Hex color string
|
|
2776
|
+
* @param alpha - Opacity value between 0 and 1
|
|
2777
|
+
* @returns rgba color string
|
|
2778
|
+
*/
|
|
2779
|
+
function hexToRgba(hexColor, alpha) {
|
|
2780
|
+
return rgba(hexColor, alpha);
|
|
2781
|
+
}
|
|
2782
|
+
/**
|
|
2783
|
+
* Gets platform-specific shadow styles
|
|
2784
|
+
*
|
|
2785
|
+
* @param size - Shadow size: 'sm' | 'md' | 'lg' | 'xl'
|
|
2786
|
+
* @returns Platform-specific shadow styles
|
|
2787
|
+
*
|
|
2788
|
+
* @example
|
|
2789
|
+
* ```typescript
|
|
2790
|
+
* const styles = StyleSheet.create({
|
|
2791
|
+
* card: {
|
|
2792
|
+
* ...getShadow('md'),
|
|
2793
|
+
* },
|
|
2794
|
+
* });
|
|
2795
|
+
* ```
|
|
2796
|
+
*/
|
|
2797
|
+
function getShadow(size) {
|
|
2798
|
+
if (Platform.OS === 'ios') {
|
|
2799
|
+
return shadows[size].ios;
|
|
2800
|
+
} else if (Platform.OS === 'android') {
|
|
2801
|
+
return shadows[size].android;
|
|
2802
|
+
}
|
|
2803
|
+
// Default to iOS shadow style for other platforms
|
|
2804
|
+
return shadows[size].ios;
|
|
2805
|
+
}
|
|
2806
|
+
|
|
2807
|
+
export { ArrowIcon, AsteriskIcon, Avatar, Badge, BigNumber, BroadcastedIcon, Button, CheckIcon, ChevronIcon, Clipboard, CopyButton, CopyIcon, CrossIcon, DashLogo, ErrorIcon, EyeClosedIcon, EyeOpenIcon, Heading, Icons, Identifier, InfoCircleIcon, Input, NotActive, PlusIcon, PooledIcon, QueuedIcon, SearchIcon, SuccessIcon, Tabs, Text, TopRightArrowIcon, TransactionStatusIcon, ValueCard, borderRadius, borderWidth, cn, colors, getShadow, hexToRgba, opacity, rgba, shadows, spacing, tw, typography, useDebounce, zIndex };
|
|
2808
|
+
//# sourceMappingURL=index.esm.js.map
|