@reown/appkit-ui-react-native 1.2.3 → 2.0.0-alpha.0
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/lib/commonjs/assets/svg/Card.js +21 -0
- package/lib/commonjs/assets/svg/Card.js.map +1 -0
- package/lib/commonjs/assets/svg/Clock.js +3 -3
- package/lib/commonjs/assets/svg/Clock.js.map +1 -1
- package/lib/commonjs/assets/svg/CurrencyDollar.js +21 -0
- package/lib/commonjs/assets/svg/CurrencyDollar.js.map +1 -0
- package/lib/commonjs/assets/svg/Settings.js +21 -0
- package/lib/commonjs/assets/svg/Settings.js.map +1 -0
- package/lib/commonjs/components/wui-icon/index.js +6 -0
- package/lib/commonjs/components/wui-icon/index.js.map +1 -1
- package/lib/commonjs/components/wui-pressable/index.js +5 -2
- package/lib/commonjs/components/wui-pressable/index.js.map +1 -1
- package/lib/commonjs/composites/wui-button/index.js +3 -1
- package/lib/commonjs/composites/wui-button/index.js.map +1 -1
- package/lib/commonjs/composites/wui-button/styles.js +1 -1
- package/lib/commonjs/composites/wui-double-image-loader/index.js +57 -0
- package/lib/commonjs/composites/wui-double-image-loader/index.js.map +1 -0
- package/lib/commonjs/composites/wui-double-image-loader/index.native.js +94 -0
- package/lib/commonjs/composites/wui-double-image-loader/index.native.js.map +1 -0
- package/lib/commonjs/composites/wui-double-image-loader/styles.js +31 -0
- package/lib/commonjs/composites/wui-double-image-loader/styles.js.map +1 -0
- package/lib/commonjs/composites/wui-icon-box/index.js +4 -2
- package/lib/commonjs/composites/wui-icon-box/index.js.map +1 -1
- package/lib/commonjs/composites/wui-list-item/index.js +8 -5
- package/lib/commonjs/composites/wui-list-item/index.js.map +1 -1
- package/lib/commonjs/composites/wui-list-social/styles.js +1 -1
- package/lib/commonjs/composites/wui-list-social/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-network-button/styles.js +1 -2
- package/lib/commonjs/composites/wui-network-button/styles.js.map +1 -1
- package/lib/commonjs/composites/wui-numeric-keyboard/index.js +54 -0
- package/lib/commonjs/composites/wui-numeric-keyboard/index.js.map +1 -0
- package/lib/commonjs/composites/wui-search-bar/index.js +8 -4
- package/lib/commonjs/composites/wui-search-bar/index.js.map +1 -1
- package/lib/commonjs/composites/wui-tag/index.js +3 -2
- package/lib/commonjs/composites/wui-tag/index.js.map +1 -1
- package/lib/commonjs/composites/wui-toggle/index.js +3 -2
- package/lib/commonjs/composites/wui-toggle/index.js.map +1 -1
- package/lib/commonjs/composites/wui-token-button/index.js +32 -10
- package/lib/commonjs/composites/wui-token-button/index.js.map +1 -1
- package/lib/commonjs/composites/wui-token-button/styles.js +14 -1
- package/lib/commonjs/composites/wui-token-button/styles.js.map +1 -1
- package/lib/commonjs/index.js +14 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/layout/wui-flex/index.js +2 -1
- package/lib/commonjs/layout/wui-flex/index.js.map +1 -1
- package/lib/commonjs/layout/wui-separator/index.js +5 -4
- package/lib/commonjs/layout/wui-separator/index.js.map +1 -1
- package/lib/module/assets/svg/Card.js +13 -0
- package/lib/module/assets/svg/Card.js.map +1 -0
- package/lib/module/assets/svg/Clock.js +3 -3
- package/lib/module/assets/svg/Clock.js.map +1 -1
- package/lib/module/assets/svg/CurrencyDollar.js +13 -0
- package/lib/module/assets/svg/CurrencyDollar.js.map +1 -0
- package/lib/module/assets/svg/Settings.js +13 -0
- package/lib/module/assets/svg/Settings.js.map +1 -0
- package/lib/module/components/wui-icon/index.js +6 -0
- package/lib/module/components/wui-icon/index.js.map +1 -1
- package/lib/module/components/wui-pressable/index.js +5 -2
- package/lib/module/components/wui-pressable/index.js.map +1 -1
- package/lib/module/composites/wui-button/index.js +3 -1
- package/lib/module/composites/wui-button/index.js.map +1 -1
- package/lib/module/composites/wui-button/styles.js +1 -1
- package/lib/module/composites/wui-double-image-loader/index.js +50 -0
- package/lib/module/composites/wui-double-image-loader/index.js.map +1 -0
- package/lib/module/composites/wui-double-image-loader/index.native.js +87 -0
- package/lib/module/composites/wui-double-image-loader/index.native.js.map +1 -0
- package/lib/module/composites/wui-double-image-loader/styles.js +25 -0
- package/lib/module/composites/wui-double-image-loader/styles.js.map +1 -0
- package/lib/module/composites/wui-icon-box/index.js +4 -2
- package/lib/module/composites/wui-icon-box/index.js.map +1 -1
- package/lib/module/composites/wui-list-item/index.js +8 -5
- package/lib/module/composites/wui-list-item/index.js.map +1 -1
- package/lib/module/composites/wui-list-social/styles.js +1 -1
- package/lib/module/composites/wui-list-social/styles.js.map +1 -1
- package/lib/module/composites/wui-network-button/styles.js +1 -2
- package/lib/module/composites/wui-network-button/styles.js.map +1 -1
- package/lib/module/composites/wui-numeric-keyboard/index.js +48 -0
- package/lib/module/composites/wui-numeric-keyboard/index.js.map +1 -0
- package/lib/module/composites/wui-search-bar/index.js +8 -4
- package/lib/module/composites/wui-search-bar/index.js.map +1 -1
- package/lib/module/composites/wui-tag/index.js +3 -2
- package/lib/module/composites/wui-tag/index.js.map +1 -1
- package/lib/module/composites/wui-toggle/index.js +3 -2
- package/lib/module/composites/wui-toggle/index.js.map +1 -1
- package/lib/module/composites/wui-token-button/index.js +29 -7
- package/lib/module/composites/wui-token-button/index.js.map +1 -1
- package/lib/module/composites/wui-token-button/styles.js +14 -1
- package/lib/module/composites/wui-token-button/styles.js.map +1 -1
- package/lib/module/index.js +2 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/layout/wui-flex/index.js +2 -1
- package/lib/module/layout/wui-flex/index.js.map +1 -1
- package/lib/module/layout/wui-separator/index.js +5 -4
- package/lib/module/layout/wui-separator/index.js.map +1 -1
- package/lib/typescript/assets/svg/Card.d.ts +4 -0
- package/lib/typescript/assets/svg/Card.d.ts.map +1 -0
- package/lib/typescript/assets/svg/CurrencyDollar.d.ts +4 -0
- package/lib/typescript/assets/svg/CurrencyDollar.d.ts.map +1 -0
- package/lib/typescript/assets/svg/Settings.d.ts +4 -0
- package/lib/typescript/assets/svg/Settings.d.ts.map +1 -0
- package/lib/typescript/components/wui-icon/index.d.ts.map +1 -1
- package/lib/typescript/components/wui-pressable/index.d.ts +2 -1
- package/lib/typescript/components/wui-pressable/index.d.ts.map +1 -1
- package/lib/typescript/components/wui-shimmer/index.d.ts +2 -2
- package/lib/typescript/components/wui-shimmer/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-button/index.d.ts +2 -1
- package/lib/typescript/composites/wui-button/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-double-image-loader/index.d.ts +16 -0
- package/lib/typescript/composites/wui-double-image-loader/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-double-image-loader/index.native.d.ts +16 -0
- package/lib/typescript/composites/wui-double-image-loader/index.native.d.ts.map +1 -0
- package/lib/typescript/composites/wui-double-image-loader/styles.d.ts +24 -0
- package/lib/typescript/composites/wui-double-image-loader/styles.d.ts.map +1 -0
- package/lib/typescript/composites/wui-icon-box/index.d.ts +2 -1
- package/lib/typescript/composites/wui-icon-box/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-list-item/index.d.ts +5 -2
- package/lib/typescript/composites/wui-list-item/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-network-button/styles.d.ts +0 -1
- package/lib/typescript/composites/wui-network-button/styles.d.ts.map +1 -1
- package/lib/typescript/composites/wui-numeric-keyboard/index.d.ts +5 -0
- package/lib/typescript/composites/wui-numeric-keyboard/index.d.ts.map +1 -0
- package/lib/typescript/composites/wui-search-bar/index.d.ts +3 -2
- package/lib/typescript/composites/wui-search-bar/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-tag/index.d.ts +3 -2
- package/lib/typescript/composites/wui-tag/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-toggle/index.d.ts +8 -1
- package/lib/typescript/composites/wui-toggle/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-token-button/index.d.ts +6 -1
- package/lib/typescript/composites/wui-token-button/index.d.ts.map +1 -1
- package/lib/typescript/composites/wui-token-button/styles.d.ts +13 -0
- package/lib/typescript/composites/wui-token-button/styles.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +3 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/layout/wui-flex/index.d.ts +1 -0
- package/lib/typescript/layout/wui-flex/index.d.ts.map +1 -1
- package/lib/typescript/layout/wui-separator/index.d.ts +3 -1
- package/lib/typescript/layout/wui-separator/index.d.ts.map +1 -1
- package/lib/typescript/utils/TypesUtil.d.ts +1 -1
- package/lib/typescript/utils/TypesUtil.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/assets/svg/Card.tsx +13 -0
- package/src/assets/svg/Clock.tsx +2 -2
- package/src/assets/svg/CurrencyDollar.tsx +12 -0
- package/src/assets/svg/Settings.tsx +12 -0
- package/src/components/wui-icon/index.tsx +6 -0
- package/src/components/wui-pressable/index.tsx +10 -1
- package/src/components/wui-shimmer/index.tsx +2 -2
- package/src/composites/wui-button/index.tsx +3 -0
- package/src/composites/wui-button/styles.ts +1 -1
- package/src/composites/wui-double-image-loader/index.native.tsx +119 -0
- package/src/composites/wui-double-image-loader/index.tsx +74 -0
- package/src/composites/wui-double-image-loader/styles.ts +25 -0
- package/src/composites/wui-icon-box/index.tsx +4 -1
- package/src/composites/wui-list-item/index.tsx +31 -6
- package/src/composites/wui-list-social/styles.ts +1 -1
- package/src/composites/wui-network-button/styles.ts +1 -2
- package/src/composites/wui-numeric-keyboard/index.tsx +64 -0
- package/src/composites/wui-search-bar/index.tsx +30 -25
- package/src/composites/wui-tag/index.tsx +4 -3
- package/src/composites/wui-toggle/index.tsx +10 -2
- package/src/composites/wui-token-button/index.tsx +26 -3
- package/src/composites/wui-token-button/styles.ts +14 -1
- package/src/index.ts +4 -1
- package/src/layout/wui-flex/index.tsx +2 -1
- package/src/layout/wui-separator/index.tsx +6 -8
- package/src/utils/TypesUtil.ts +3 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
import { BorderRadius } from '../../utils/ThemeUtil';
|
|
3
|
+
|
|
4
|
+
export default StyleSheet.create({
|
|
5
|
+
rightImage: {
|
|
6
|
+
height: 64,
|
|
7
|
+
width: 64,
|
|
8
|
+
borderRadius: BorderRadius.full
|
|
9
|
+
},
|
|
10
|
+
itemBorder: {
|
|
11
|
+
width: 74,
|
|
12
|
+
height: 74,
|
|
13
|
+
alignItems: 'center',
|
|
14
|
+
justifyContent: 'center'
|
|
15
|
+
},
|
|
16
|
+
leftItemBorder: {
|
|
17
|
+
borderRadius: BorderRadius.full,
|
|
18
|
+
zIndex: 2
|
|
19
|
+
},
|
|
20
|
+
rightItemBorder: {
|
|
21
|
+
borderRadius: 22,
|
|
22
|
+
width: 72,
|
|
23
|
+
height: 72
|
|
24
|
+
}
|
|
25
|
+
});
|
|
@@ -16,6 +16,7 @@ export interface IconBoxProps {
|
|
|
16
16
|
borderColor?: ThemeKeys;
|
|
17
17
|
borderSize?: number;
|
|
18
18
|
style?: StyleProp<ViewStyle>;
|
|
19
|
+
testID?: string;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
export function IconBox({
|
|
@@ -28,7 +29,8 @@ export function IconBox({
|
|
|
28
29
|
border,
|
|
29
30
|
borderColor,
|
|
30
31
|
borderSize = 4,
|
|
31
|
-
style
|
|
32
|
+
style,
|
|
33
|
+
testID
|
|
32
34
|
}: IconBoxProps) {
|
|
33
35
|
const Theme = useTheme();
|
|
34
36
|
let _iconSize: SizeType;
|
|
@@ -97,6 +99,7 @@ export function IconBox({
|
|
|
97
99
|
border && { borderColor: Theme[borderColor || 'bg-125'], borderWidth: borderSize / 2 },
|
|
98
100
|
style
|
|
99
101
|
]}
|
|
102
|
+
testID={testID}
|
|
100
103
|
>
|
|
101
104
|
<Icon size={iconSize || _iconSize} color={iconColor} name={icon} />
|
|
102
105
|
</View>
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Pressable,
|
|
5
|
+
Animated,
|
|
6
|
+
type StyleProp,
|
|
7
|
+
type ViewStyle,
|
|
8
|
+
type ImageStyle
|
|
9
|
+
} from 'react-native';
|
|
3
10
|
import { Icon } from '../../components/wui-icon';
|
|
4
11
|
import { Image } from '../../components/wui-image';
|
|
5
12
|
import { LoadingSpinner } from '../../components/wui-loading-spinner';
|
|
@@ -16,8 +23,11 @@ export interface ListItemProps {
|
|
|
16
23
|
iconColor?: ColorType;
|
|
17
24
|
iconBackgroundColor?: ColorType;
|
|
18
25
|
iconBorderColor?: ColorType;
|
|
26
|
+
backgroundColor?: ColorType;
|
|
19
27
|
imageSrc?: string;
|
|
20
28
|
imageHeaders?: Record<string, string>;
|
|
29
|
+
imageStyle?: StyleProp<ImageStyle>;
|
|
30
|
+
imageContainerStyle?: StyleProp<ViewStyle>;
|
|
21
31
|
chevron?: boolean;
|
|
22
32
|
disabled?: boolean;
|
|
23
33
|
loading?: boolean;
|
|
@@ -33,6 +43,8 @@ export function ListItem({
|
|
|
33
43
|
icon,
|
|
34
44
|
imageSrc,
|
|
35
45
|
imageHeaders,
|
|
46
|
+
imageStyle,
|
|
47
|
+
imageContainerStyle,
|
|
36
48
|
iconColor = 'fg-200',
|
|
37
49
|
iconBackgroundColor,
|
|
38
50
|
iconBorderColor = 'gray-glass-005',
|
|
@@ -42,28 +54,41 @@ export function ListItem({
|
|
|
42
54
|
onPress,
|
|
43
55
|
style,
|
|
44
56
|
contentStyle,
|
|
45
|
-
testID
|
|
57
|
+
testID,
|
|
58
|
+
backgroundColor = 'gray-glass-002'
|
|
46
59
|
}: ListItemProps) {
|
|
47
60
|
const Theme = useTheme();
|
|
48
61
|
const { animatedValue, setStartValue, setEndValue } = useAnimatedValue(
|
|
49
|
-
Theme[
|
|
62
|
+
Theme[backgroundColor],
|
|
50
63
|
Theme['gray-glass-010']
|
|
51
64
|
);
|
|
52
65
|
|
|
53
66
|
function visualTemplate() {
|
|
54
67
|
if (imageSrc) {
|
|
55
68
|
return (
|
|
56
|
-
<View
|
|
69
|
+
<View
|
|
70
|
+
style={[
|
|
71
|
+
styles.imageContainer,
|
|
72
|
+
{ borderColor: Theme['gray-glass-005'] },
|
|
73
|
+
imageContainerStyle
|
|
74
|
+
]}
|
|
75
|
+
>
|
|
57
76
|
<Image
|
|
58
77
|
source={imageSrc}
|
|
59
78
|
headers={imageHeaders}
|
|
60
|
-
style={[styles.image, (disabled || loading) && styles.disabledImage]}
|
|
79
|
+
style={[styles.image, (disabled || loading) && styles.disabledImage, imageStyle]}
|
|
61
80
|
/>
|
|
62
81
|
</View>
|
|
63
82
|
);
|
|
64
83
|
} else if (icon) {
|
|
65
84
|
return (
|
|
66
|
-
<View
|
|
85
|
+
<View
|
|
86
|
+
style={[
|
|
87
|
+
styles.imageContainer,
|
|
88
|
+
{ borderColor: Theme[iconBorderColor] },
|
|
89
|
+
imageContainerStyle
|
|
90
|
+
]}
|
|
91
|
+
>
|
|
67
92
|
<IconBox
|
|
68
93
|
icon={icon}
|
|
69
94
|
iconColor={iconColor}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { TouchableOpacity, StyleSheet } from 'react-native';
|
|
2
|
+
import { Text } from '../../components/wui-text';
|
|
3
|
+
import { FlexView } from '../../layout/wui-flex';
|
|
4
|
+
import { useTheme } from '../../hooks/useTheme';
|
|
5
|
+
|
|
6
|
+
export interface NumericKeyboardProps {
|
|
7
|
+
onKeyPress: (value: string) => void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export function NumericKeyboard({ onKeyPress }: NumericKeyboardProps) {
|
|
11
|
+
const Theme = useTheme();
|
|
12
|
+
const keys = [
|
|
13
|
+
['1', '2', '3'],
|
|
14
|
+
['4', '5', '6'],
|
|
15
|
+
['7', '8', '9'],
|
|
16
|
+
[',', '0', 'erase']
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
const handlePress = (key: string) => {
|
|
20
|
+
onKeyPress(key);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<FlexView>
|
|
25
|
+
{keys.map((row, rowIndex) => (
|
|
26
|
+
<FlexView
|
|
27
|
+
key={`row-${rowIndex}`}
|
|
28
|
+
flexDirection="row"
|
|
29
|
+
justifyContent="space-around"
|
|
30
|
+
style={styles.row}
|
|
31
|
+
>
|
|
32
|
+
{row.map(key => (
|
|
33
|
+
<TouchableOpacity key={key} style={styles.key} onPress={() => handlePress(key)}>
|
|
34
|
+
{key === 'erase' ? (
|
|
35
|
+
<Text testID="key-erase" style={[styles.keyText, { color: Theme['fg-100'] }]}>
|
|
36
|
+
←
|
|
37
|
+
</Text>
|
|
38
|
+
) : (
|
|
39
|
+
<Text testID={`key-${key}`} style={[styles.keyText, { color: Theme['fg-100'] }]}>
|
|
40
|
+
{key}
|
|
41
|
+
</Text>
|
|
42
|
+
)}
|
|
43
|
+
</TouchableOpacity>
|
|
44
|
+
))}
|
|
45
|
+
</FlexView>
|
|
46
|
+
))}
|
|
47
|
+
</FlexView>
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const styles = StyleSheet.create({
|
|
52
|
+
row: {
|
|
53
|
+
marginBottom: 10
|
|
54
|
+
},
|
|
55
|
+
key: {
|
|
56
|
+
width: 70,
|
|
57
|
+
height: 50,
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
alignItems: 'center'
|
|
60
|
+
},
|
|
61
|
+
keyText: {
|
|
62
|
+
fontSize: 26
|
|
63
|
+
}
|
|
64
|
+
});
|
|
@@ -1,22 +1,25 @@
|
|
|
1
1
|
import { useRef, useState } from 'react';
|
|
2
|
-
import { TextInput, type TextInputProps } from 'react-native';
|
|
2
|
+
import { TextInput, type StyleProp, type TextInputProps, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { InputElement } from '../wui-input-element';
|
|
5
5
|
import { InputText } from '../wui-input-text';
|
|
6
6
|
import { Spacing } from '../../utils/ThemeUtil';
|
|
7
|
+
import { FlexView } from '../../layout/wui-flex';
|
|
7
8
|
|
|
8
9
|
export interface SearchBarProps {
|
|
9
10
|
placeholder?: string;
|
|
10
11
|
onSubmitEditing?: TextInputProps['onSubmitEditing'];
|
|
11
12
|
onChangeText?: TextInputProps['onChangeText'];
|
|
12
13
|
inputStyle?: TextInputProps['style'];
|
|
14
|
+
style?: StyleProp<ViewStyle>;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
export function SearchBar({
|
|
16
|
-
placeholder = 'Search
|
|
18
|
+
placeholder = 'Search',
|
|
17
19
|
onSubmitEditing,
|
|
18
20
|
onChangeText,
|
|
19
|
-
inputStyle
|
|
21
|
+
inputStyle,
|
|
22
|
+
style
|
|
20
23
|
}: SearchBarProps) {
|
|
21
24
|
const [showClear, setShowClear] = useState(false);
|
|
22
25
|
const inputRef = useRef<TextInput>(null);
|
|
@@ -27,27 +30,29 @@ export function SearchBar({
|
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
return (
|
|
30
|
-
<
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
33
|
+
<FlexView style={style}>
|
|
34
|
+
<InputText
|
|
35
|
+
ref={inputRef}
|
|
36
|
+
placeholder={placeholder}
|
|
37
|
+
onChangeText={handleChangeText}
|
|
38
|
+
onSubmitEditing={onSubmitEditing}
|
|
39
|
+
icon="search"
|
|
40
|
+
inputStyle={inputStyle}
|
|
41
|
+
returnKeyType="search"
|
|
42
|
+
disableFullscreenUI
|
|
43
|
+
>
|
|
44
|
+
{showClear && (
|
|
45
|
+
<InputElement
|
|
46
|
+
icon="close"
|
|
47
|
+
style={{ marginRight: Spacing['4xs'] }}
|
|
48
|
+
onPress={() => {
|
|
49
|
+
inputRef.current?.clear();
|
|
50
|
+
inputRef.current?.focus();
|
|
51
|
+
handleChangeText('');
|
|
52
|
+
}}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
55
|
+
</InputText>
|
|
56
|
+
</FlexView>
|
|
52
57
|
);
|
|
53
58
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { type StyleProp, View, type ViewStyle } from 'react-native';
|
|
2
|
+
import { type StyleProp, type TextStyle, View, type ViewStyle } from 'react-native';
|
|
3
3
|
|
|
4
4
|
import { Text } from '../../components/wui-text';
|
|
5
5
|
import { useTheme } from '../../hooks/useTheme';
|
|
@@ -11,9 +11,10 @@ export interface TagProps {
|
|
|
11
11
|
variant?: TagType;
|
|
12
12
|
disabled?: boolean;
|
|
13
13
|
style?: StyleProp<ViewStyle>;
|
|
14
|
+
textStyle?: StyleProp<TextStyle>;
|
|
14
15
|
}
|
|
15
16
|
|
|
16
|
-
export function Tag({ variant = 'main', children, style, disabled }: TagProps) {
|
|
17
|
+
export function Tag({ variant = 'main', children, style, disabled, textStyle }: TagProps) {
|
|
17
18
|
const Theme = useTheme();
|
|
18
19
|
const colors = getThemedColors(disabled ? undefined : variant);
|
|
19
20
|
|
|
@@ -21,7 +22,7 @@ export function Tag({ variant = 'main', children, style, disabled }: TagProps) {
|
|
|
21
22
|
<View
|
|
22
23
|
style={[styles.container, { backgroundColor: Theme[colors.background as ThemeKeys] }, style]}
|
|
23
24
|
>
|
|
24
|
-
<Text style={styles.text} variant="micro-700" color={colors.text as ColorType}>
|
|
25
|
+
<Text style={[styles.text, textStyle]} variant="micro-700" color={colors.text as ColorType}>
|
|
25
26
|
{children}
|
|
26
27
|
</Text>
|
|
27
28
|
</View>
|
|
@@ -13,11 +13,18 @@ import { Text } from '../../components/wui-text';
|
|
|
13
13
|
import styles from './styles';
|
|
14
14
|
|
|
15
15
|
export interface ToggleProps {
|
|
16
|
+
/** Content to be displayed inside the toggle when expanded */
|
|
16
17
|
children?: React.ReactNode;
|
|
18
|
+
/** Title displayed in the toggle header. Can be a string or a custom React component */
|
|
17
19
|
title?: string | React.ReactNode;
|
|
20
|
+
/** Custom styles for the toggle container */
|
|
18
21
|
style?: StyleProp<ViewStyle>;
|
|
22
|
+
/** Whether the toggle should be open when first rendered */
|
|
19
23
|
initialOpen?: boolean;
|
|
24
|
+
/** Whether the toggle can be closed after being opened. If false, toggle will remain open once expanded */
|
|
20
25
|
canClose?: boolean;
|
|
26
|
+
/** Custom styles for the content container inside the toggle */
|
|
27
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
export function Toggle({
|
|
@@ -25,7 +32,8 @@ export function Toggle({
|
|
|
25
32
|
style,
|
|
26
33
|
title = 'Details',
|
|
27
34
|
initialOpen = false,
|
|
28
|
-
canClose = true
|
|
35
|
+
canClose = true,
|
|
36
|
+
contentContainerStyle
|
|
29
37
|
}: ToggleProps) {
|
|
30
38
|
const [isOpen, setIsOpen] = useState(initialOpen);
|
|
31
39
|
const animatedHeight = useRef(new Animated.Value(0)).current;
|
|
@@ -72,7 +80,7 @@ export function Toggle({
|
|
|
72
80
|
</Pressable>
|
|
73
81
|
|
|
74
82
|
<Animated.View style={[styles.contentWrapper, { height: animatedHeight }]}>
|
|
75
|
-
<FlexView style={styles.content} onLayout={measureContent}>
|
|
83
|
+
<FlexView style={[styles.content, contentContainerStyle]} onLayout={measureContent}>
|
|
76
84
|
{children}
|
|
77
85
|
</FlexView>
|
|
78
86
|
</Animated.View>
|
|
@@ -2,7 +2,11 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
2
2
|
import { Image } from '../../components/wui-image';
|
|
3
3
|
import { Text } from '../../components/wui-text';
|
|
4
4
|
import { Button } from '../wui-button';
|
|
5
|
+
import { Icon } from '../../components/wui-icon';
|
|
5
6
|
import styles from './styles';
|
|
7
|
+
import { useTheme } from '../../context/ThemeContext';
|
|
8
|
+
import { View } from 'react-native';
|
|
9
|
+
import React from 'react';
|
|
6
10
|
|
|
7
11
|
export interface TokenButtonProps {
|
|
8
12
|
onPress?: () => void;
|
|
@@ -11,6 +15,10 @@ export interface TokenButtonProps {
|
|
|
11
15
|
inverse?: boolean;
|
|
12
16
|
style?: StyleProp<ViewStyle>;
|
|
13
17
|
disabled?: boolean;
|
|
18
|
+
placeholder?: string;
|
|
19
|
+
chevron?: boolean;
|
|
20
|
+
renderClip?: React.ReactNode;
|
|
21
|
+
testID?: string;
|
|
14
22
|
}
|
|
15
23
|
|
|
16
24
|
export function TokenButton({
|
|
@@ -19,8 +27,14 @@ export function TokenButton({
|
|
|
19
27
|
inverse,
|
|
20
28
|
onPress,
|
|
21
29
|
style,
|
|
22
|
-
disabled = false
|
|
30
|
+
disabled = false,
|
|
31
|
+
placeholder = 'Select token',
|
|
32
|
+
chevron,
|
|
33
|
+
renderClip,
|
|
34
|
+
testID
|
|
23
35
|
}: TokenButtonProps) {
|
|
36
|
+
const Theme = useTheme();
|
|
37
|
+
|
|
24
38
|
if (!text) {
|
|
25
39
|
return (
|
|
26
40
|
<Button
|
|
@@ -31,7 +45,7 @@ export function TokenButton({
|
|
|
31
45
|
disabled={disabled}
|
|
32
46
|
>
|
|
33
47
|
<Text variant="small-600" color="accent-100">
|
|
34
|
-
|
|
48
|
+
{placeholder}
|
|
35
49
|
</Text>
|
|
36
50
|
</Button>
|
|
37
51
|
);
|
|
@@ -39,7 +53,14 @@ export function TokenButton({
|
|
|
39
53
|
|
|
40
54
|
const content = [
|
|
41
55
|
imageUrl && (
|
|
42
|
-
<
|
|
56
|
+
<View key="image-container" style={[styles.imageContainer, inverse && styles.imageInverse]}>
|
|
57
|
+
<Image
|
|
58
|
+
key="image"
|
|
59
|
+
source={imageUrl}
|
|
60
|
+
style={[styles.image, { backgroundColor: Theme['fg-100'] }]}
|
|
61
|
+
/>
|
|
62
|
+
{renderClip && <View style={styles.clipContainer}>{renderClip}</View>}
|
|
63
|
+
</View>
|
|
43
64
|
),
|
|
44
65
|
<Text key="text">{text}</Text>
|
|
45
66
|
];
|
|
@@ -51,8 +72,10 @@ export function TokenButton({
|
|
|
51
72
|
size="sm"
|
|
52
73
|
onPress={onPress}
|
|
53
74
|
disabled={disabled}
|
|
75
|
+
testID={testID}
|
|
54
76
|
>
|
|
55
77
|
{inverse ? content.reverse() : content}
|
|
78
|
+
{chevron && <Icon name="chevronBottom" size="xxs" color="fg-150" style={styles.chevron} />}
|
|
56
79
|
</Button>
|
|
57
80
|
);
|
|
58
81
|
}
|
|
@@ -9,14 +9,27 @@ export default StyleSheet.create({
|
|
|
9
9
|
container: {
|
|
10
10
|
height: 40
|
|
11
11
|
},
|
|
12
|
+
imageContainer: {
|
|
13
|
+
position: 'relative',
|
|
14
|
+
marginRight: Spacing['2xs']
|
|
15
|
+
},
|
|
12
16
|
image: {
|
|
13
17
|
width: 24,
|
|
14
18
|
height: 24,
|
|
15
19
|
borderRadius: BorderRadius.full,
|
|
16
|
-
marginRight:
|
|
20
|
+
marginRight: 0
|
|
17
21
|
},
|
|
18
22
|
imageInverse: {
|
|
19
23
|
marginRight: 0,
|
|
20
24
|
marginLeft: Spacing['2xs']
|
|
25
|
+
},
|
|
26
|
+
clipContainer: {
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
right: -4,
|
|
29
|
+
bottom: -4,
|
|
30
|
+
zIndex: 1
|
|
31
|
+
},
|
|
32
|
+
chevron: {
|
|
33
|
+
marginLeft: Spacing['2xs']
|
|
21
34
|
}
|
|
22
35
|
});
|
package/src/index.ts
CHANGED
|
@@ -32,6 +32,7 @@ export {
|
|
|
32
32
|
type CompatibleNetworkProps
|
|
33
33
|
} from './composites/wui-compatible-network';
|
|
34
34
|
export { ConnectButton, type ConnectButtonProps } from './composites/wui-connect-button';
|
|
35
|
+
export { DoubleImageLoader } from './composites/wui-double-image-loader';
|
|
35
36
|
export { EmailInput, type EmailInputProps } from './composites/wui-email-input';
|
|
36
37
|
export { IconBox, type IconBoxProps } from './composites/wui-icon-box';
|
|
37
38
|
export { IconLink, type IconLinkProps } from './composites/wui-icon-link';
|
|
@@ -49,6 +50,7 @@ export { Logo, type LogoProps } from './composites/wui-logo';
|
|
|
49
50
|
export { LogoSelect, type LogoSelectProps } from './composites/wui-logo-select';
|
|
50
51
|
export { NetworkButton, type NetworkButtonProps } from './composites/wui-network-button';
|
|
51
52
|
export { NetworkImage, type NetworkImageProps } from './composites/wui-network-image';
|
|
53
|
+
export { NumericKeyboard, type NumericKeyboardProps } from './composites/wui-numeric-keyboard';
|
|
52
54
|
export { Otp, type OtpProps } from './composites/wui-otp';
|
|
53
55
|
export { Pressable, type PressableProps } from './components/wui-pressable';
|
|
54
56
|
export { Promo, type PromoProps } from './composites/wui-promo';
|
|
@@ -78,7 +80,8 @@ export type {
|
|
|
78
80
|
SizeType,
|
|
79
81
|
TagType,
|
|
80
82
|
TextType,
|
|
81
|
-
VisualType
|
|
83
|
+
VisualType,
|
|
84
|
+
TransactionType
|
|
82
85
|
} from './utils/TypesUtil';
|
|
83
86
|
export { UiUtil } from './utils/UiUtil';
|
|
84
87
|
export { TransactionUtil } from './utils/TransactionUtil';
|
|
@@ -24,6 +24,7 @@ export interface FlexViewProps {
|
|
|
24
24
|
padding?: SpacingType | SpacingType[];
|
|
25
25
|
margin?: SpacingType | SpacingType[];
|
|
26
26
|
style?: StyleProp<ViewStyle>;
|
|
27
|
+
testID?: string;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
export function FlexView(props: FlexViewProps) {
|
|
@@ -46,7 +47,7 @@ export function FlexView(props: FlexViewProps) {
|
|
|
46
47
|
};
|
|
47
48
|
|
|
48
49
|
return (
|
|
49
|
-
<View onLayout={props.onLayout} style={[styles, props.style]}>
|
|
50
|
+
<View onLayout={props.onLayout} style={[styles, props.style]} testID={props.testID}>
|
|
50
51
|
{props.children}
|
|
51
52
|
</View>
|
|
52
53
|
);
|
|
@@ -2,31 +2,29 @@ import { type StyleProp, type ViewStyle, View } from 'react-native';
|
|
|
2
2
|
import { Text } from '../../components/wui-text';
|
|
3
3
|
import { FlexView } from '../../layout/wui-flex';
|
|
4
4
|
import { useTheme } from '../../hooks/useTheme';
|
|
5
|
+
import type { ColorType } from '../../utils/TypesUtil';
|
|
5
6
|
import styles from './styles';
|
|
6
7
|
|
|
7
8
|
export interface SeparatorProps {
|
|
8
9
|
text?: string;
|
|
10
|
+
color?: ColorType;
|
|
9
11
|
style?: StyleProp<ViewStyle>;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
export function Separator({ text, style }: SeparatorProps) {
|
|
14
|
+
export function Separator({ text, style, color = 'gray-glass-005' }: SeparatorProps) {
|
|
13
15
|
const Theme = useTheme();
|
|
14
16
|
|
|
15
17
|
if (!text) {
|
|
16
|
-
return <View style={[styles.single, { backgroundColor: Theme[
|
|
18
|
+
return <View style={[styles.single, { backgroundColor: Theme[color] }, style]} />;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
return (
|
|
20
22
|
<FlexView flexDirection="row" alignItems="center" style={style}>
|
|
21
|
-
<View
|
|
22
|
-
style={[styles.divider, styles.marginRight, { backgroundColor: Theme['gray-glass-005'] }]}
|
|
23
|
-
/>
|
|
23
|
+
<View style={[styles.divider, styles.marginRight, { backgroundColor: Theme[color] }]} />
|
|
24
24
|
<Text variant="small-500" color="fg-300">
|
|
25
25
|
{text}
|
|
26
26
|
</Text>
|
|
27
|
-
<View
|
|
28
|
-
style={[styles.divider, styles.marginLeft, { backgroundColor: Theme['gray-glass-005'] }]}
|
|
29
|
-
/>
|
|
27
|
+
<View style={[styles.divider, styles.marginLeft, { backgroundColor: Theme[color] }]} />
|
|
30
28
|
</FlexView>
|
|
31
29
|
);
|
|
32
30
|
}
|
package/src/utils/TypesUtil.ts
CHANGED
|
@@ -140,6 +140,7 @@ export type IconType =
|
|
|
140
140
|
| 'arrowRight'
|
|
141
141
|
| 'arrowTop'
|
|
142
142
|
| 'browser'
|
|
143
|
+
| 'card'
|
|
143
144
|
| 'checkmark'
|
|
144
145
|
| 'chevronBottom'
|
|
145
146
|
| 'chevronLeft'
|
|
@@ -153,6 +154,7 @@ export type IconType =
|
|
|
153
154
|
| 'copy'
|
|
154
155
|
| 'copySmall'
|
|
155
156
|
| 'cursor'
|
|
157
|
+
| 'currencyDollar'
|
|
156
158
|
| 'desktop'
|
|
157
159
|
| 'disconnect'
|
|
158
160
|
| 'discord'
|
|
@@ -178,6 +180,7 @@ export type IconType =
|
|
|
178
180
|
| 'recycleHorizontal'
|
|
179
181
|
| 'refresh'
|
|
180
182
|
| 'search'
|
|
183
|
+
| 'settings'
|
|
181
184
|
| 'swapHorizontal'
|
|
182
185
|
| 'swapVertical'
|
|
183
186
|
| 'telegram'
|