@reown/appkit-ui-react-native 0.0.0-feat-smart-account-20241017180406 → 0.0.0-feat-swaps-20241203153101

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.
Files changed (221) hide show
  1. package/lib/commonjs/assets/svg/RecycleHorizontal.js +21 -0
  2. package/lib/commonjs/assets/svg/RecycleHorizontal.js.map +1 -0
  3. package/lib/commonjs/assets/visual/Profile.js +2 -2
  4. package/lib/commonjs/assets/visual/Profile.js.map +1 -1
  5. package/lib/commonjs/components/wui-card/index.js +1 -1
  6. package/lib/commonjs/components/wui-card/styles.js +1 -1
  7. package/lib/commonjs/components/wui-card/styles.js.map +1 -1
  8. package/lib/commonjs/components/wui-icon/index.js +2 -0
  9. package/lib/commonjs/components/wui-icon/index.js.map +1 -1
  10. package/lib/commonjs/components/wui-pressable/index.js +68 -0
  11. package/lib/commonjs/components/wui-pressable/index.js.map +1 -0
  12. package/lib/commonjs/components/wui-shimmer/index.js +5 -1
  13. package/lib/commonjs/components/wui-shimmer/index.js.map +1 -1
  14. package/lib/commonjs/composites/wui-account-button/styles.js +2 -2
  15. package/lib/commonjs/composites/wui-account-button/styles.js.map +1 -1
  16. package/lib/commonjs/composites/wui-account-pill/index.js +5 -11
  17. package/lib/commonjs/composites/wui-account-pill/index.js.map +1 -1
  18. package/lib/commonjs/composites/wui-account-pill/styles.js +5 -1
  19. package/lib/commonjs/composites/wui-account-pill/styles.js.map +1 -1
  20. package/lib/commonjs/composites/wui-button/index.js +2 -1
  21. package/lib/commonjs/composites/wui-button/index.js.map +1 -1
  22. package/lib/commonjs/composites/wui-button/styles.js +4 -4
  23. package/lib/commonjs/composites/wui-button/styles.js.map +1 -1
  24. package/lib/commonjs/composites/wui-chip/styles.js +2 -2
  25. package/lib/commonjs/composites/wui-chip/styles.js.map +1 -1
  26. package/lib/commonjs/composites/wui-connect-button/styles.js +1 -1
  27. package/lib/commonjs/composites/wui-connect-button/styles.js.map +1 -1
  28. package/lib/commonjs/composites/wui-icon-box/index.js +17 -1
  29. package/lib/commonjs/composites/wui-icon-box/index.js.map +1 -1
  30. package/lib/commonjs/composites/wui-input-text/index.js +2 -1
  31. package/lib/commonjs/composites/wui-input-text/index.js.map +1 -1
  32. package/lib/commonjs/composites/wui-input-text/styles.js +1 -1
  33. package/lib/commonjs/composites/wui-input-text/styles.js.map +1 -1
  34. package/lib/commonjs/composites/wui-list-item-loader/index.js +34 -0
  35. package/lib/commonjs/composites/wui-list-item-loader/index.js.map +1 -0
  36. package/lib/commonjs/composites/wui-list-item-loader/styles.js +18 -0
  37. package/lib/commonjs/composites/wui-list-item-loader/styles.js.map +1 -0
  38. package/lib/commonjs/composites/wui-list-token/index.js +29 -9
  39. package/lib/commonjs/composites/wui-list-token/index.js.map +1 -1
  40. package/lib/commonjs/composites/wui-list-token/styles.js +3 -0
  41. package/lib/commonjs/composites/wui-list-token/styles.js.map +1 -1
  42. package/lib/commonjs/composites/wui-list-wallet/index.js +1 -1
  43. package/lib/commonjs/composites/wui-list-wallet/index.js.map +1 -1
  44. package/lib/commonjs/composites/wui-network-button/styles.js +1 -1
  45. package/lib/commonjs/composites/wui-network-button/styles.js.map +1 -1
  46. package/lib/commonjs/composites/wui-qr-code/index.js +5 -2
  47. package/lib/commonjs/composites/wui-qr-code/index.js.map +1 -1
  48. package/lib/commonjs/composites/wui-snackbar/index.js +4 -1
  49. package/lib/commonjs/composites/wui-snackbar/index.js.map +1 -1
  50. package/lib/commonjs/composites/wui-snackbar/styles.js +1 -1
  51. package/lib/commonjs/composites/wui-snackbar/styles.js.map +1 -1
  52. package/lib/commonjs/composites/wui-tabs/styles.js +1 -1
  53. package/lib/commonjs/composites/wui-tabs/styles.js.map +1 -1
  54. package/lib/commonjs/composites/wui-toggle/index.js +65 -0
  55. package/lib/commonjs/composites/wui-toggle/index.js.map +1 -0
  56. package/lib/commonjs/composites/wui-toggle/styles.js +30 -0
  57. package/lib/commonjs/composites/wui-toggle/styles.js.map +1 -0
  58. package/lib/commonjs/composites/wui-token-button/index.js +21 -11
  59. package/lib/commonjs/composites/wui-token-button/index.js.map +1 -1
  60. package/lib/commonjs/composites/wui-token-button/styles.js +4 -0
  61. package/lib/commonjs/composites/wui-token-button/styles.js.map +1 -1
  62. package/lib/commonjs/composites/wui-wallet-image/styles.js +1 -1
  63. package/lib/commonjs/composites/wui-wallet-image/styles.js.map +1 -1
  64. package/lib/commonjs/index.js +27 -0
  65. package/lib/commonjs/index.js.map +1 -1
  66. package/lib/commonjs/layout/wui-flex/index.js +1 -0
  67. package/lib/commonjs/layout/wui-flex/index.js.map +1 -1
  68. package/lib/commonjs/utils/ThemeUtil.js +2 -1
  69. package/lib/commonjs/utils/ThemeUtil.js.map +1 -1
  70. package/lib/module/assets/svg/RecycleHorizontal.js +13 -0
  71. package/lib/module/assets/svg/RecycleHorizontal.js.map +1 -0
  72. package/lib/module/assets/visual/Profile.js +2 -2
  73. package/lib/module/assets/visual/Profile.js.map +1 -1
  74. package/lib/module/components/wui-card/index.js +1 -1
  75. package/lib/module/components/wui-card/styles.js +1 -1
  76. package/lib/module/components/wui-card/styles.js.map +1 -1
  77. package/lib/module/components/wui-icon/index.js +2 -0
  78. package/lib/module/components/wui-icon/index.js.map +1 -1
  79. package/lib/module/components/wui-pressable/index.js +62 -0
  80. package/lib/module/components/wui-pressable/index.js.map +1 -0
  81. package/lib/module/components/wui-shimmer/index.js +6 -2
  82. package/lib/module/components/wui-shimmer/index.js.map +1 -1
  83. package/lib/module/composites/wui-account-button/styles.js +2 -2
  84. package/lib/module/composites/wui-account-button/styles.js.map +1 -1
  85. package/lib/module/composites/wui-account-pill/index.js +5 -11
  86. package/lib/module/composites/wui-account-pill/index.js.map +1 -1
  87. package/lib/module/composites/wui-account-pill/styles.js +5 -1
  88. package/lib/module/composites/wui-account-pill/styles.js.map +1 -1
  89. package/lib/module/composites/wui-button/index.js +2 -1
  90. package/lib/module/composites/wui-button/index.js.map +1 -1
  91. package/lib/module/composites/wui-button/styles.js +4 -4
  92. package/lib/module/composites/wui-button/styles.js.map +1 -1
  93. package/lib/module/composites/wui-chip/styles.js +2 -2
  94. package/lib/module/composites/wui-chip/styles.js.map +1 -1
  95. package/lib/module/composites/wui-connect-button/styles.js +1 -1
  96. package/lib/module/composites/wui-connect-button/styles.js.map +1 -1
  97. package/lib/module/composites/wui-icon-box/index.js +17 -1
  98. package/lib/module/composites/wui-icon-box/index.js.map +1 -1
  99. package/lib/module/composites/wui-input-text/index.js +2 -1
  100. package/lib/module/composites/wui-input-text/index.js.map +1 -1
  101. package/lib/module/composites/wui-input-text/styles.js +1 -1
  102. package/lib/module/composites/wui-input-text/styles.js.map +1 -1
  103. package/lib/module/composites/wui-list-item-loader/index.js +27 -0
  104. package/lib/module/composites/wui-list-item-loader/index.js.map +1 -0
  105. package/lib/module/composites/wui-list-item-loader/styles.js +12 -0
  106. package/lib/module/composites/wui-list-item-loader/styles.js.map +1 -0
  107. package/lib/module/composites/wui-list-token/index.js +27 -8
  108. package/lib/module/composites/wui-list-token/index.js.map +1 -1
  109. package/lib/module/composites/wui-list-token/styles.js +3 -0
  110. package/lib/module/composites/wui-list-token/styles.js.map +1 -1
  111. package/lib/module/composites/wui-list-wallet/index.js +1 -1
  112. package/lib/module/composites/wui-list-wallet/index.js.map +1 -1
  113. package/lib/module/composites/wui-network-button/styles.js +1 -1
  114. package/lib/module/composites/wui-network-button/styles.js.map +1 -1
  115. package/lib/module/composites/wui-qr-code/index.js +5 -2
  116. package/lib/module/composites/wui-qr-code/index.js.map +1 -1
  117. package/lib/module/composites/wui-snackbar/index.js +4 -1
  118. package/lib/module/composites/wui-snackbar/index.js.map +1 -1
  119. package/lib/module/composites/wui-snackbar/styles.js +1 -1
  120. package/lib/module/composites/wui-snackbar/styles.js.map +1 -1
  121. package/lib/module/composites/wui-tabs/styles.js +1 -1
  122. package/lib/module/composites/wui-tabs/styles.js.map +1 -1
  123. package/lib/module/composites/wui-toggle/index.js +58 -0
  124. package/lib/module/composites/wui-toggle/index.js.map +1 -0
  125. package/lib/module/composites/wui-toggle/styles.js +24 -0
  126. package/lib/module/composites/wui-toggle/styles.js.map +1 -0
  127. package/lib/module/composites/wui-token-button/index.js +21 -11
  128. package/lib/module/composites/wui-token-button/index.js.map +1 -1
  129. package/lib/module/composites/wui-token-button/styles.js +4 -0
  130. package/lib/module/composites/wui-token-button/styles.js.map +1 -1
  131. package/lib/module/composites/wui-wallet-image/styles.js +1 -1
  132. package/lib/module/composites/wui-wallet-image/styles.js.map +1 -1
  133. package/lib/module/index.js +4 -1
  134. package/lib/module/index.js.map +1 -1
  135. package/lib/module/layout/wui-flex/index.js +1 -0
  136. package/lib/module/layout/wui-flex/index.js.map +1 -1
  137. package/lib/module/layout/wui-separator/index.js.map +1 -1
  138. package/lib/module/utils/ThemeUtil.js +2 -1
  139. package/lib/module/utils/ThemeUtil.js.map +1 -1
  140. package/lib/typescript/assets/svg/RecycleHorizontal.d.ts +4 -0
  141. package/lib/typescript/assets/svg/RecycleHorizontal.d.ts.map +1 -0
  142. package/lib/typescript/components/wui-icon/index.d.ts +1 -1
  143. package/lib/typescript/components/wui-icon/index.d.ts.map +1 -1
  144. package/lib/typescript/components/wui-pressable/index.d.ts +17 -0
  145. package/lib/typescript/components/wui-pressable/index.d.ts.map +1 -0
  146. package/lib/typescript/components/wui-shimmer/index.d.ts.map +1 -1
  147. package/lib/typescript/composites/wui-account-pill/index.d.ts +1 -2
  148. package/lib/typescript/composites/wui-account-pill/index.d.ts.map +1 -1
  149. package/lib/typescript/composites/wui-account-pill/styles.d.ts +4 -0
  150. package/lib/typescript/composites/wui-account-pill/styles.d.ts.map +1 -1
  151. package/lib/typescript/composites/wui-icon-box/index.d.ts +1 -1
  152. package/lib/typescript/composites/wui-icon-box/index.d.ts.map +1 -1
  153. package/lib/typescript/composites/wui-input-text/index.d.ts +3 -1
  154. package/lib/typescript/composites/wui-input-text/index.d.ts.map +1 -1
  155. package/lib/typescript/composites/wui-list-item-loader/index.d.ts +6 -0
  156. package/lib/typescript/composites/wui-list-item-loader/index.d.ts.map +1 -0
  157. package/lib/typescript/composites/wui-list-item-loader/styles.d.ts +11 -0
  158. package/lib/typescript/composites/wui-list-item-loader/styles.d.ts.map +1 -0
  159. package/lib/typescript/composites/wui-list-token/index.d.ts +4 -1
  160. package/lib/typescript/composites/wui-list-token/index.d.ts.map +1 -1
  161. package/lib/typescript/composites/wui-list-token/styles.d.ts +3 -0
  162. package/lib/typescript/composites/wui-list-token/styles.d.ts.map +1 -1
  163. package/lib/typescript/composites/wui-list-wallet/index.d.ts.map +1 -1
  164. package/lib/typescript/composites/wui-qr-code/index.d.ts.map +1 -1
  165. package/lib/typescript/composites/wui-snackbar/index.d.ts +1 -1
  166. package/lib/typescript/composites/wui-snackbar/index.d.ts.map +1 -1
  167. package/lib/typescript/composites/wui-toggle/index.d.ts +11 -0
  168. package/lib/typescript/composites/wui-toggle/index.d.ts.map +1 -0
  169. package/lib/typescript/composites/wui-toggle/styles.d.ts +23 -0
  170. package/lib/typescript/composites/wui-toggle/styles.d.ts.map +1 -0
  171. package/lib/typescript/composites/wui-token-button/index.d.ts +7 -3
  172. package/lib/typescript/composites/wui-token-button/index.d.ts.map +1 -1
  173. package/lib/typescript/composites/wui-token-button/styles.d.ts +4 -0
  174. package/lib/typescript/composites/wui-token-button/styles.d.ts.map +1 -1
  175. package/lib/typescript/index.d.ts +4 -1
  176. package/lib/typescript/index.d.ts.map +1 -1
  177. package/lib/typescript/layout/wui-flex/index.d.ts +2 -1
  178. package/lib/typescript/layout/wui-flex/index.d.ts.map +1 -1
  179. package/lib/typescript/layout/wui-separator/index.d.ts.map +1 -1
  180. package/lib/typescript/utils/ThemeUtil.d.ts +1 -0
  181. package/lib/typescript/utils/ThemeUtil.d.ts.map +1 -1
  182. package/lib/typescript/utils/TypesUtil.d.ts +2 -2
  183. package/lib/typescript/utils/TypesUtil.d.ts.map +1 -1
  184. package/package.json +1 -1
  185. package/src/assets/svg/RecycleHorizontal.tsx +12 -0
  186. package/src/assets/visual/Profile.tsx +2 -2
  187. package/src/components/wui-card/index.tsx +1 -1
  188. package/src/components/wui-card/styles.ts +1 -1
  189. package/src/components/wui-icon/index.tsx +3 -1
  190. package/src/components/wui-pressable/index.tsx +92 -0
  191. package/src/components/wui-shimmer/index.tsx +9 -2
  192. package/src/composites/wui-account-button/styles.ts +2 -2
  193. package/src/composites/wui-account-pill/index.tsx +2 -10
  194. package/src/composites/wui-account-pill/styles.ts +5 -1
  195. package/src/composites/wui-button/index.tsx +1 -1
  196. package/src/composites/wui-button/styles.ts +4 -4
  197. package/src/composites/wui-chip/styles.ts +2 -2
  198. package/src/composites/wui-connect-button/styles.ts +1 -1
  199. package/src/composites/wui-icon-box/index.tsx +18 -2
  200. package/src/composites/wui-input-text/index.tsx +10 -2
  201. package/src/composites/wui-input-text/styles.ts +1 -1
  202. package/src/composites/wui-list-item-loader/index.tsx +29 -0
  203. package/src/composites/wui-list-item-loader/styles.ts +12 -0
  204. package/src/composites/wui-list-token/index.tsx +31 -8
  205. package/src/composites/wui-list-token/styles.ts +3 -0
  206. package/src/composites/wui-list-wallet/index.tsx +2 -2
  207. package/src/composites/wui-network-button/styles.ts +1 -1
  208. package/src/composites/wui-qr-code/index.tsx +4 -2
  209. package/src/composites/wui-snackbar/index.tsx +7 -2
  210. package/src/composites/wui-snackbar/styles.ts +1 -1
  211. package/src/composites/wui-tabs/styles.ts +1 -1
  212. package/src/composites/wui-toggle/index.tsx +81 -0
  213. package/src/composites/wui-toggle/styles.ts +24 -0
  214. package/src/composites/wui-token-button/index.tsx +37 -8
  215. package/src/composites/wui-token-button/styles.ts +4 -0
  216. package/src/composites/wui-wallet-image/styles.ts +1 -1
  217. package/src/index.ts +4 -1
  218. package/src/layout/wui-flex/index.tsx +7 -3
  219. package/src/layout/wui-separator/index.tsx +1 -1
  220. package/src/utils/ThemeUtil.ts +2 -1
  221. package/src/utils/TypesUtil.ts +2 -0
@@ -1,12 +1,14 @@
1
- import { Pressable } from 'react-native';
2
1
  import { Icon } from '../../components/wui-icon';
3
2
  import { Image } from '../../components/wui-image';
4
3
  import { Text } from '../../components/wui-text';
4
+ import { Pressable } from '../../components/wui-pressable';
5
5
  import { useTheme } from '../../hooks/useTheme';
6
6
  import { FlexView } from '../../layout/wui-flex';
7
7
  import { UiUtil } from '../../utils/UiUtil';
8
8
  import styles from './styles';
9
9
 
10
+ export const ListTokenTotalHeight = 64;
11
+
10
12
  export interface ListTokenProps {
11
13
  imageSrc: string;
12
14
  networkSrc?: string;
@@ -15,6 +17,8 @@ export interface ListTokenProps {
15
17
  amount?: string;
16
18
  currency: string;
17
19
  onPress?: () => void;
20
+ disabled?: boolean;
21
+ pressable?: boolean;
18
22
  }
19
23
 
20
24
  export function ListToken({
@@ -24,17 +28,25 @@ export function ListToken({
24
28
  value,
25
29
  amount,
26
30
  currency,
27
- onPress
31
+ onPress,
32
+ disabled,
33
+ pressable = true
28
34
  }: ListTokenProps) {
29
35
  const Theme = useTheme();
30
36
 
31
37
  return (
32
- <Pressable onPress={onPress}>
38
+ <Pressable
39
+ onPress={onPress}
40
+ disabled={disabled || !pressable}
41
+ style={styles.pressable}
42
+ backgroundColor="transparent"
43
+ >
33
44
  <FlexView
34
45
  flexDirection="row"
35
46
  justifyContent="space-between"
36
47
  alignItems="center"
37
- padding={['2xs', 'm', '2xs', 'xs']}
48
+ padding={['0', 'm', '0', 'xs']}
49
+ style={{ height: ListTokenTotalHeight }}
38
50
  >
39
51
  <FlexView flexDirection="row" alignItems="center">
40
52
  {imageSrc ? (
@@ -66,15 +78,26 @@ export function ListToken({
66
78
  )}
67
79
  </FlexView>
68
80
  <FlexView padding={['0', 's', '0', 's']}>
69
- <Text color="fg-100" variant="paragraph-500">
70
- {name}
81
+ <Text color={disabled ? 'fg-200' : 'fg-100'} variant="paragraph-500">
82
+ {UiUtil.getTruncateString({
83
+ string: name,
84
+ charsStart: 15,
85
+ charsEnd: 0,
86
+ truncate: 'end'
87
+ })}
71
88
  </Text>
72
89
  <Text variant="small-400" color="fg-200">
73
- {UiUtil.formatNumberToLocalString(amount, 4)} {currency}
90
+ {UiUtil.formatNumberToLocalString(amount, 4)}{' '}
91
+ {UiUtil.getTruncateString({
92
+ string: currency,
93
+ charsStart: 8,
94
+ charsEnd: 0,
95
+ truncate: 'end'
96
+ })}
74
97
  </Text>
75
98
  </FlexView>
76
99
  </FlexView>
77
- <Text color="fg-100" variant="paragraph-500">
100
+ <Text color={disabled ? 'fg-200' : 'fg-100'} variant="paragraph-500">
78
101
  ${value?.toFixed(2) ?? '0.00'}
79
102
  </Text>
80
103
  </FlexView>
@@ -2,6 +2,9 @@ import { StyleSheet } from 'react-native';
2
2
  import { BorderRadius, WalletImageSize } from '../../utils/ThemeUtil';
3
3
 
4
4
  export default StyleSheet.create({
5
+ pressable: {
6
+ borderRadius: BorderRadius.s
7
+ },
5
8
  image: {
6
9
  height: WalletImageSize.sm,
7
10
  width: WalletImageSize.sm,
@@ -1,4 +1,4 @@
1
- import { Animated, Pressable, View, type StyleProp, type ViewStyle } from 'react-native';
1
+ import { Animated, Pressable, type StyleProp, type ViewStyle, View } from 'react-native';
2
2
  import { Text } from '../../components/wui-text';
3
3
  import useAnimatedValue from '../../hooks/useAnimatedValue';
4
4
  import { useTheme } from '../../hooks/useTheme';
@@ -6,9 +6,9 @@ import type { IconType, TagType } from '../../utils/TypesUtil';
6
6
  import { Tag } from '../wui-tag';
7
7
  import { WalletImage } from '../wui-wallet-image';
8
8
  import { Icon } from '../../components/wui-icon';
9
+ import { IconBox } from '../wui-icon-box';
9
10
 
10
11
  import styles from './styles';
11
- import { IconBox } from '../wui-icon-box';
12
12
 
13
13
  const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
14
14
 
@@ -7,7 +7,7 @@ export default StyleSheet.create({
7
7
  height: 40,
8
8
  alignItems: 'center',
9
9
  justifyContent: 'center',
10
- borderWidth: 1,
10
+ borderWidth: StyleSheet.hairlineWidth,
11
11
  borderRadius: BorderRadius.full,
12
12
  paddingHorizontal: Spacing['2xs']
13
13
  },
@@ -21,6 +21,8 @@ export interface QrCodeProps {
21
21
  style?: StyleProp<ViewStyle>;
22
22
  }
23
23
 
24
+ const LABEL_HEIGHT = 18;
25
+
24
26
  export function QrCode({ size, uri, imageSrc, testID, arenaClear, icon, style }: QrCodeProps) {
25
27
  const Theme = LightTheme;
26
28
  const containerPadding = Spacing.l;
@@ -75,7 +77,7 @@ export function QrCode({ size, uri, imageSrc, testID, arenaClear, icon, style }:
75
77
  </Svg>
76
78
  {logoTemplate()}
77
79
  </FlexView>
78
- <Text variant="small-500" color="fg-150" style={styles.label}>
80
+ <Text variant="small-500" color="fg-150" style={[styles.label, { height: LABEL_HEIGHT }]}>
79
81
  UX by{' '}
80
82
  <Text variant="small-500" color="inverse-000">
81
83
  Reown
@@ -83,6 +85,6 @@ export function QrCode({ size, uri, imageSrc, testID, arenaClear, icon, style }:
83
85
  </Text>
84
86
  </View>
85
87
  ) : (
86
- <Shimmer width={size} height={size} borderRadius={BorderRadius.l} />
88
+ <Shimmer width={size} height={size + LABEL_HEIGHT} borderRadius={BorderRadius.l} />
87
89
  );
88
90
  }
@@ -4,11 +4,12 @@ import { useTheme } from '../../hooks/useTheme';
4
4
  import type { ColorType, IconType } from '../../utils/TypesUtil';
5
5
  import { IconBox } from '../wui-icon-box';
6
6
  import styles from './styles';
7
+ import { LoadingSpinner } from '../../components/wui-loading-spinner';
7
8
 
8
9
  export interface SnackbarProps {
9
10
  message: string;
10
11
  iconColor: ColorType;
11
- icon: IconType;
12
+ icon: IconType | 'loading';
12
13
  style?: StyleProp<ViewStyle>;
13
14
  }
14
15
 
@@ -24,7 +25,11 @@ export function Snackbar({ message, iconColor, icon, style }: SnackbarProps) {
24
25
  style
25
26
  ]}
26
27
  >
27
- <IconBox icon={icon} iconColor={iconColor} size="sm" background />
28
+ {icon === 'loading' ? (
29
+ <LoadingSpinner size="md" />
30
+ ) : (
31
+ <IconBox icon={icon} iconColor={iconColor} size="sm" background />
32
+ )}
28
33
  <Text variant="paragraph-500" color="fg-100" style={styles.text}>
29
34
  {message}
30
35
  </Text>
@@ -7,7 +7,7 @@ export default StyleSheet.create({
7
7
  flexDirection: 'row',
8
8
  paddingHorizontal: 8,
9
9
  borderRadius: BorderRadius.full,
10
- borderWidth: 1,
10
+ borderWidth: StyleSheet.hairlineWidth,
11
11
  alignItems: 'center'
12
12
  },
13
13
  text: {
@@ -22,7 +22,7 @@ export default StyleSheet.create({
22
22
  activeMark: {
23
23
  position: 'absolute',
24
24
  height: 28,
25
- borderWidth: 1,
25
+ borderWidth: StyleSheet.hairlineWidth,
26
26
  borderRadius: BorderRadius['3xl'],
27
27
  margin: Spacing['3xs']
28
28
  }
@@ -0,0 +1,81 @@
1
+ import { useState, useRef } from 'react';
2
+ import {
3
+ Animated,
4
+ type LayoutChangeEvent,
5
+ type StyleProp,
6
+ type ViewStyle,
7
+ Pressable
8
+ } from 'react-native';
9
+
10
+ import { IconBox } from '../wui-icon-box';
11
+ import { FlexView } from '../../layout/wui-flex';
12
+ import { Text } from '../../components/wui-text';
13
+ import styles from './styles';
14
+
15
+ export interface ToggleProps {
16
+ children?: React.ReactNode;
17
+ title?: string | React.ReactNode;
18
+ style?: StyleProp<ViewStyle>;
19
+ initialOpen?: boolean;
20
+ canClose?: boolean;
21
+ }
22
+
23
+ export function Toggle({
24
+ children,
25
+ style,
26
+ title = 'Details',
27
+ initialOpen = false,
28
+ canClose = true
29
+ }: ToggleProps) {
30
+ const [isOpen, setIsOpen] = useState(initialOpen);
31
+ const animatedHeight = useRef(new Animated.Value(0)).current;
32
+ const contentHeight = useRef(0);
33
+ const hasInitialized = useRef(false);
34
+
35
+ const toggleDetails = () => {
36
+ if (canClose) {
37
+ const toValue = isOpen ? 0 : contentHeight.current;
38
+
39
+ Animated.spring(animatedHeight, {
40
+ toValue,
41
+ useNativeDriver: false,
42
+ bounciness: 0
43
+ }).start();
44
+
45
+ setIsOpen(!isOpen);
46
+ }
47
+ };
48
+
49
+ const measureContent = (event: LayoutChangeEvent) => {
50
+ const height = event.nativeEvent.layout.height;
51
+ contentHeight.current = height;
52
+
53
+ if (!hasInitialized.current && initialOpen) {
54
+ hasInitialized.current = true;
55
+ animatedHeight.setValue(height);
56
+ }
57
+ };
58
+
59
+ return (
60
+ <FlexView style={[styles.container, style]}>
61
+ <Pressable onPress={toggleDetails} style={styles.header}>
62
+ {typeof title === 'string' ? (
63
+ <Text variant="small-400" color="fg-100">
64
+ {title}
65
+ </Text>
66
+ ) : (
67
+ title
68
+ )}
69
+ {canClose && (
70
+ <IconBox icon={isOpen ? 'chevronTop' : 'chevronBottom'} size="sm" iconColor="fg-200" />
71
+ )}
72
+ </Pressable>
73
+
74
+ <Animated.View style={[styles.contentWrapper, { height: animatedHeight }]}>
75
+ <FlexView style={styles.content} onLayout={measureContent}>
76
+ {children}
77
+ </FlexView>
78
+ </Animated.View>
79
+ </FlexView>
80
+ );
81
+ }
@@ -0,0 +1,24 @@
1
+ import { StyleSheet } from 'react-native';
2
+ import { Spacing } from '../../utils/ThemeUtil';
3
+
4
+ export default StyleSheet.create({
5
+ container: {
6
+ overflow: 'hidden'
7
+ },
8
+ header: {
9
+ flexDirection: 'row',
10
+ alignItems: 'center',
11
+ justifyContent: 'space-between',
12
+ paddingVertical: Spacing.s,
13
+ paddingHorizontal: Spacing.l
14
+ },
15
+ content: {
16
+ paddingHorizontal: Spacing.l,
17
+ paddingBottom: Spacing.l,
18
+ position: 'absolute',
19
+ width: '100%'
20
+ },
21
+ contentWrapper: {
22
+ overflow: 'hidden'
23
+ }
24
+ });
@@ -1,4 +1,4 @@
1
- import type { Balance } from '@reown/appkit-common-react-native';
1
+ 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';
@@ -6,13 +6,30 @@ import styles from './styles';
6
6
 
7
7
  export interface TokenButtonProps {
8
8
  onPress?: () => void;
9
- token?: Balance;
9
+ imageUrl?: string;
10
+ text?: string;
11
+ inverse?: boolean;
12
+ style?: StyleProp<ViewStyle>;
13
+ disabled?: boolean;
10
14
  }
11
15
 
12
- export function TokenButton({ token, onPress }: TokenButtonProps) {
13
- if (!token) {
16
+ export function TokenButton({
17
+ imageUrl,
18
+ text,
19
+ inverse,
20
+ onPress,
21
+ style,
22
+ disabled = false
23
+ }: TokenButtonProps) {
24
+ if (!text) {
14
25
  return (
15
- <Button variant="accent" style={styles.selectButton} size="sm" onPress={onPress}>
26
+ <Button
27
+ variant="accent"
28
+ style={[styles.selectButton, style]}
29
+ size="sm"
30
+ onPress={onPress}
31
+ disabled={disabled}
32
+ >
16
33
  <Text variant="small-600" color="accent-100">
17
34
  Select token
18
35
  </Text>
@@ -20,10 +37,22 @@ export function TokenButton({ token, onPress }: TokenButtonProps) {
20
37
  );
21
38
  }
22
39
 
40
+ const content = [
41
+ imageUrl && (
42
+ <Image key="image" source={imageUrl} style={[styles.image, inverse && styles.imageInverse]} />
43
+ ),
44
+ <Text key="text">{text}</Text>
45
+ ];
46
+
23
47
  return (
24
- <Button variant="shade" style={styles.container} size="sm" onPress={onPress}>
25
- {token?.iconUrl && <Image source={token?.iconUrl} style={styles.image} />}
26
- {token?.symbol && <Text>{token.symbol}</Text>}
48
+ <Button
49
+ variant="shade"
50
+ style={[styles.container, style]}
51
+ size="sm"
52
+ onPress={onPress}
53
+ disabled={disabled}
54
+ >
55
+ {inverse ? content.reverse() : content}
27
56
  </Button>
28
57
  );
29
58
  }
@@ -14,5 +14,9 @@ export default StyleSheet.create({
14
14
  height: 24,
15
15
  borderRadius: BorderRadius.full,
16
16
  marginRight: Spacing['2xs']
17
+ },
18
+ imageInverse: {
19
+ marginRight: 0,
20
+ marginLeft: Spacing['2xs']
17
21
  }
18
22
  });
@@ -32,7 +32,7 @@ export default StyleSheet.create({
32
32
  borderRadius: BorderRadius.m
33
33
  },
34
34
  border: {
35
- borderWidth: 1,
35
+ borderWidth: StyleSheet.hairlineWidth,
36
36
  position: 'absolute'
37
37
  }
38
38
  });
package/src/index.ts CHANGED
@@ -40,8 +40,9 @@ export { InputNumeric, type InputNumericProps } from './composites/wui-input-num
40
40
  export { InputText, type InputTextProps } from './composites/wui-input-text';
41
41
  export { Link, type LinkProps } from './composites/wui-link';
42
42
  export { ListItem, type ListItemProps } from './composites/wui-list-item';
43
+ export { ListItemLoader, type ListItemLoaderProps } from './composites/wui-list-item-loader';
43
44
  export { ListSocial, type ListSocialProps } from './composites/wui-list-social';
44
- export { ListToken, type ListTokenProps } from './composites/wui-list-token';
45
+ export { ListToken, ListTokenTotalHeight, type ListTokenProps } from './composites/wui-list-token';
45
46
  export { ListTransaction, type ListTransactionProps } from './composites/wui-list-transaction';
46
47
  export { ListWallet, type ListWalletProps } from './composites/wui-list-wallet';
47
48
  export { Logo, type LogoProps } from './composites/wui-logo';
@@ -49,12 +50,14 @@ export { LogoSelect, type LogoSelectProps } from './composites/wui-logo-select';
49
50
  export { NetworkButton, type NetworkButtonProps } from './composites/wui-network-button';
50
51
  export { NetworkImage, type NetworkImageProps } from './composites/wui-network-image';
51
52
  export { Otp, type OtpProps } from './composites/wui-otp';
53
+ export { Pressable, type PressableProps } from './components/wui-pressable';
52
54
  export { Promo, type PromoProps } from './composites/wui-promo';
53
55
  export { QrCode, type QrCodeProps } from './composites/wui-qr-code';
54
56
  export { SearchBar, type SearchBarProps } from './composites/wui-search-bar';
55
57
  export { Snackbar, type SnackbarProps } from './composites/wui-snackbar';
56
58
  export { Tabs, type TabsProps } from './composites/wui-tabs';
57
59
  export { Tag, type TagProps } from './composites/wui-tag';
60
+ export { Toggle, type ToggleProps } from './composites/wui-toggle';
58
61
  export { TokenButton, type TokenButtonProps } from './composites/wui-token-button';
59
62
  export { Tooltip, type TooltipProps } from './composites/wui-tooltip';
60
63
  export { WalletImage, type WalletImageProps } from './composites/wui-wallet-image';
@@ -1,4 +1,4 @@
1
- import { View, type StyleProp, type ViewStyle } from 'react-native';
1
+ import { type LayoutChangeEvent, type StyleProp, type ViewStyle, View } from 'react-native';
2
2
 
3
3
  import type {
4
4
  FlexAlignType,
@@ -9,11 +9,11 @@ import type {
9
9
  FlexWrapType,
10
10
  SpacingType
11
11
  } from '../../utils/TypesUtil';
12
-
13
12
  import { UiUtil } from '../../utils/UiUtil';
14
13
 
15
14
  export interface FlexViewProps {
16
15
  children?: React.ReactNode;
16
+ onLayout?: (event: LayoutChangeEvent) => void;
17
17
  flexDirection?: FlexDirectionType;
18
18
  flexWrap?: FlexWrapType;
19
19
  flexGrow?: FlexGrowType;
@@ -45,5 +45,9 @@ export function FlexView(props: FlexViewProps) {
45
45
  marginLeft: props.margin && UiUtil.getSpacingStyles(props.margin, 3)
46
46
  };
47
47
 
48
- return <View style={[styles, props.style]}>{props.children}</View>;
48
+ return (
49
+ <View onLayout={props.onLayout} style={[styles, props.style]}>
50
+ {props.children}
51
+ </View>
52
+ );
49
53
  }
@@ -1,4 +1,4 @@
1
- import { View, type StyleProp, type ViewStyle } from 'react-native';
1
+ 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';
@@ -164,7 +164,8 @@ export const IconSize = {
164
164
  xs: 12,
165
165
  sm: 14,
166
166
  md: 16,
167
- lg: 20
167
+ lg: 20,
168
+ xl: 24
168
169
  };
169
170
 
170
171
  export const SpinnerSize = {
@@ -112,6 +112,7 @@ export type ColorType =
112
112
  | 'gray-glass-020'
113
113
  | 'gray-glass-010'
114
114
  | 'gray-glass-005'
115
+ | 'gray-glass-002'
115
116
  | 'inverse-000'
116
117
  | 'inverse-100'
117
118
  | 'success-100'
@@ -174,6 +175,7 @@ export type IconType =
174
175
  | 'off'
175
176
  | 'paperplane'
176
177
  | 'qrCode'
178
+ | 'recycleHorizontal'
177
179
  | 'refresh'
178
180
  | 'search'
179
181
  | 'swapHorizontal'