@bloxwap/hig 0.6.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.md +2 -2
  2. package/chart/README.md +13 -2
  3. package/chart/dist/altimeter-burst.d.ts +4 -0
  4. package/chart/dist/altimeter-burst.js +43 -0
  5. package/chart/dist/altimeter-chart.d.ts +52 -0
  6. package/chart/dist/altimeter-chart.js +275 -0
  7. package/chart/dist/altimeter-model.d.ts +43 -0
  8. package/chart/dist/altimeter-model.js +148 -0
  9. package/chart/dist/altimeter-targets.d.ts +33 -0
  10. package/chart/dist/altimeter-targets.js +88 -0
  11. package/chart/dist/bitcoin-price.d.ts +8 -0
  12. package/chart/dist/bitcoin-price.js +41 -0
  13. package/chart/dist/champions-league.d.ts +19 -0
  14. package/chart/dist/champions-league.js +104 -0
  15. package/chart/dist/index.d.ts +6 -0
  16. package/chart/dist/index.js +5 -0
  17. package/chart/dist/outcome-chart.d.ts +37 -0
  18. package/chart/dist/outcome-chart.js +212 -0
  19. package/chart/dist/outcome-model.d.ts +43 -0
  20. package/chart/dist/outcome-model.js +71 -0
  21. package/chart/dist/plus-grid.d.ts +6 -0
  22. package/chart/dist/plus-grid.js +29 -0
  23. package/contracts/README.md +1 -1
  24. package/contracts/dist/avatar.d.ts +68 -0
  25. package/contracts/dist/avatar.js +93 -0
  26. package/contracts/dist/confetti.d.ts +174 -0
  27. package/contracts/dist/confetti.js +138 -0
  28. package/contracts/dist/decimal.d.ts +7 -0
  29. package/contracts/dist/decimal.js +35 -0
  30. package/contracts/dist/index.d.ts +45 -2
  31. package/contracts/dist/index.js +145 -4
  32. package/contracts/dist/invariants.d.ts +17 -0
  33. package/contracts/dist/invariants.js +24 -0
  34. package/contracts/dist/messages.d.ts +62 -2
  35. package/contracts/dist/messages.js +22 -2
  36. package/contracts/dist/number-flow.d.ts +90 -0
  37. package/contracts/dist/number-flow.js +150 -0
  38. package/contracts/dist/qr.d.ts +151 -0
  39. package/contracts/dist/qr.js +581 -0
  40. package/contracts/dist/toast.d.ts +168 -0
  41. package/contracts/dist/toast.js +171 -0
  42. package/feedback/README.md +1 -1
  43. package/feedback/dist/contract.js +1 -1
  44. package/feedback/dist/react.js +2 -4
  45. package/native/README.md +6 -1
  46. package/native/dist/account-block.d.ts +62 -7
  47. package/native/dist/account-block.js +54 -11
  48. package/native/dist/animated-number-model.d.ts +47 -1
  49. package/native/dist/animated-number-model.js +248 -21
  50. package/native/dist/animated-number.d.ts +41 -1
  51. package/native/dist/animated-number.js +165 -17
  52. package/native/dist/announce.d.ts +2 -0
  53. package/native/dist/announce.js +10 -0
  54. package/native/dist/asset-balance-row.d.ts +19 -1
  55. package/native/dist/asset-balance-row.js +24 -8
  56. package/native/dist/assets-block.d.ts +115 -0
  57. package/native/dist/assets-block.js +87 -0
  58. package/native/dist/async-result.d.ts +2 -0
  59. package/native/dist/async-result.js +11 -0
  60. package/native/dist/avatar-frame.d.ts +29 -0
  61. package/native/dist/avatar-frame.js +56 -0
  62. package/native/dist/avatar.d.ts +21 -0
  63. package/native/dist/avatar.js +31 -0
  64. package/native/dist/bar-mark.d.ts +16 -2
  65. package/native/dist/bar-mark.js +23 -7
  66. package/native/dist/bar-pnl.js +7 -5
  67. package/native/dist/blocks.d.ts +13 -14
  68. package/native/dist/blocks.js +10 -6
  69. package/native/dist/brand.js +2 -1
  70. package/native/dist/button.d.ts +7 -2
  71. package/native/dist/button.js +16 -4
  72. package/native/dist/checkbox.js +2 -1
  73. package/native/dist/confetti.d.ts +33 -0
  74. package/native/dist/confetti.js +143 -0
  75. package/native/dist/confirm-block.d.ts +98 -0
  76. package/native/dist/confirm-block.js +48 -0
  77. package/native/dist/data.d.ts +1 -1
  78. package/native/dist/data.js +8 -4
  79. package/native/dist/explainer-block.d.ts +91 -0
  80. package/native/dist/explainer-block.js +34 -0
  81. package/native/dist/field.d.ts +19 -5
  82. package/native/dist/field.js +56 -9
  83. package/native/dist/figure.d.ts +23 -0
  84. package/native/dist/figure.js +10 -0
  85. package/native/dist/gesture-sheet-model.d.ts +50 -0
  86. package/native/dist/gesture-sheet-model.js +105 -0
  87. package/native/dist/gesture-sheet-next.d.ts +82 -0
  88. package/native/dist/gesture-sheet-next.js +315 -0
  89. package/native/dist/gesture-sheet.d.ts +5 -1
  90. package/native/dist/gesture-sheet.js +13 -6
  91. package/native/dist/icons.d.ts +9 -6
  92. package/native/dist/icons.js +25 -24
  93. package/native/dist/language-block.d.ts +14 -1
  94. package/native/dist/language-block.js +11 -4
  95. package/native/dist/list-group.d.ts +44 -8
  96. package/native/dist/list-group.js +84 -13
  97. package/native/dist/manage-position-block.d.ts +35 -2
  98. package/native/dist/manage-position-block.js +41 -11
  99. package/native/dist/market-row.d.ts +46 -0
  100. package/native/dist/market-row.js +41 -0
  101. package/native/dist/navigation.js +5 -3
  102. package/native/dist/notifications-block.d.ts +30 -2
  103. package/native/dist/notifications-block.js +16 -8
  104. package/native/dist/number-format.d.ts +6 -0
  105. package/native/dist/number-format.js +9 -0
  106. package/native/dist/pickers.d.ts +32 -2
  107. package/native/dist/pickers.js +17 -9
  108. package/native/dist/position-block.d.ts +66 -10
  109. package/native/dist/position-block.js +45 -11
  110. package/native/dist/preset-group.d.ts +31 -0
  111. package/native/dist/preset-group.js +39 -0
  112. package/native/dist/preset-picker-block.d.ts +107 -0
  113. package/native/dist/preset-picker-block.js +43 -0
  114. package/native/dist/profile-block.d.ts +38 -5
  115. package/native/dist/profile-block.js +31 -6
  116. package/native/dist/provider.d.ts +14 -5
  117. package/native/dist/provider.js +32 -6
  118. package/native/dist/qr-code.d.ts +33 -0
  119. package/native/dist/qr-code.js +29 -0
  120. package/native/dist/radio-group.d.ts +23 -5
  121. package/native/dist/radio-group.js +40 -12
  122. package/native/dist/recipes.d.ts +6 -0
  123. package/native/dist/recipes.js +6 -0
  124. package/native/dist/reward-block.d.ts +55 -13
  125. package/native/dist/reward-block.js +37 -14
  126. package/native/dist/screen-header.d.ts +59 -0
  127. package/native/dist/screen-header.js +37 -0
  128. package/native/dist/select.js +4 -2
  129. package/native/dist/selection.d.ts +3 -2
  130. package/native/dist/selection.js +1 -0
  131. package/native/dist/setting-header.d.ts +2 -8
  132. package/native/dist/setting-header.js +2 -11
  133. package/native/dist/setting-switch.d.ts +15 -2
  134. package/native/dist/setting-switch.js +11 -4
  135. package/native/dist/signals-block.d.ts +26 -2
  136. package/native/dist/signals-block.js +14 -4
  137. package/native/dist/slider.js +5 -1
  138. package/native/dist/sound-haptics-block.d.ts +29 -2
  139. package/native/dist/sound-haptics-block.js +19 -8
  140. package/native/dist/status.d.ts +47 -14
  141. package/native/dist/status.js +39 -22
  142. package/native/dist/sticky-header.d.ts +28 -0
  143. package/native/dist/sticky-header.js +29 -0
  144. package/native/dist/surface.d.ts +3 -1
  145. package/native/dist/surface.js +2 -1
  146. package/native/dist/swap-amount-card.d.ts +57 -0
  147. package/native/dist/swap-amount-card.js +31 -0
  148. package/native/dist/swap-panel-block.d.ts +11 -4
  149. package/native/dist/swap-panel-block.js +67 -38
  150. package/native/dist/swap-parts.d.ts +5 -10
  151. package/native/dist/swap-parts.js +22 -24
  152. package/native/dist/swap-shared.d.ts +8 -2
  153. package/native/dist/swap-shared.js +10 -6
  154. package/native/dist/swap-views.js +6 -4
  155. package/native/dist/switch-row.d.ts +3 -2
  156. package/native/dist/switch-row.js +5 -3
  157. package/native/dist/switch.d.ts +4 -2
  158. package/native/dist/switch.js +3 -3
  159. package/native/dist/target-block.d.ts +40 -7
  160. package/native/dist/target-block.js +31 -11
  161. package/native/dist/toast.d.ts +47 -0
  162. package/native/dist/toast.js +386 -0
  163. package/native/dist/token-action-block.d.ts +26 -9
  164. package/native/dist/token-action-block.js +21 -8
  165. package/native/dist/trade-history-detail-block.d.ts +26 -1
  166. package/native/dist/trade-history-detail-block.js +17 -9
  167. package/native/dist/trade-history-list-block.d.ts +71 -5
  168. package/native/dist/trade-history-list-block.js +55 -17
  169. package/native/dist/wallet-address-core.d.ts +25 -0
  170. package/native/dist/wallet-address-core.js +34 -0
  171. package/native/dist/wallet-address.d.ts +6 -10
  172. package/native/dist/wallet-address.js +16 -20
  173. package/native-fonts/README.md +1 -1
  174. package/og-fonts/README.md +1 -1
  175. package/package.json +131 -2
  176. package/react/README.md +3 -1
  177. package/react/dist/animated-number-flow.d.ts +72 -0
  178. package/react/dist/animated-number-flow.js +316 -0
  179. package/react/dist/animated-number-model.d.ts +24 -0
  180. package/react/dist/animated-number-model.js +106 -3
  181. package/react/dist/animated-number.d.ts +49 -1
  182. package/react/dist/animated-number.js +146 -11
  183. package/react/dist/asset-balance-row.d.ts +19 -1
  184. package/react/dist/asset-balance-row.js +17 -3
  185. package/react/dist/async-result.d.ts +2 -0
  186. package/react/dist/async-result.js +11 -0
  187. package/react/dist/avatar.d.ts +25 -0
  188. package/react/dist/avatar.js +50 -0
  189. package/react/dist/bar-mark.d.ts +5 -2
  190. package/react/dist/bar-mark.js +5 -3
  191. package/react/dist/blocks/account-block.d.ts +57 -7
  192. package/react/dist/blocks/account-block.js +51 -11
  193. package/react/dist/blocks/assets-block.d.ts +106 -0
  194. package/react/dist/blocks/assets-block.js +135 -0
  195. package/react/dist/blocks/confirm-block.d.ts +91 -0
  196. package/react/dist/blocks/confirm-block.js +31 -0
  197. package/react/dist/blocks/explainer-block.d.ts +80 -0
  198. package/react/dist/blocks/explainer-block.js +20 -0
  199. package/react/dist/blocks/install-command.js +3 -1
  200. package/react/dist/blocks/language-block.d.ts +9 -1
  201. package/react/dist/blocks/language-block.js +8 -6
  202. package/react/dist/blocks/manage-position-block.d.ts +30 -2
  203. package/react/dist/blocks/manage-position-block.js +23 -4
  204. package/react/dist/blocks/market-row.d.ts +20 -9
  205. package/react/dist/blocks/market-row.js +17 -4
  206. package/react/dist/blocks/notifications-block.d.ts +27 -2
  207. package/react/dist/blocks/notifications-block.js +11 -2
  208. package/react/dist/blocks/pickers.d.ts +30 -1
  209. package/react/dist/blocks/pickers.js +32 -10
  210. package/react/dist/blocks/position-block.d.ts +34 -11
  211. package/react/dist/blocks/position-block.js +16 -5
  212. package/react/dist/blocks/preset-picker-block.d.ts +85 -0
  213. package/react/dist/blocks/preset-picker-block.js +19 -0
  214. package/react/dist/blocks/profile-block.d.ts +33 -6
  215. package/react/dist/blocks/profile-block.js +31 -6
  216. package/react/dist/blocks/reward-block.d.ts +65 -21
  217. package/react/dist/blocks/reward-block.js +24 -11
  218. package/react/dist/blocks/screen-header.d.ts +34 -2
  219. package/react/dist/blocks/screen-header.js +17 -6
  220. package/react/dist/blocks/setting-switch.d.ts +14 -1
  221. package/react/dist/blocks/setting-switch.js +11 -4
  222. package/react/dist/blocks/signals-block.d.ts +23 -2
  223. package/react/dist/blocks/signals-block.js +6 -5
  224. package/react/dist/blocks/sound-haptics-block.d.ts +27 -3
  225. package/react/dist/blocks/sound-haptics-block.js +11 -7
  226. package/react/dist/blocks/sticky-header.d.ts +19 -0
  227. package/react/dist/blocks/sticky-header.js +103 -0
  228. package/react/dist/blocks/swap/amount-card.js +2 -1
  229. package/react/dist/blocks/swap/settings.js +4 -3
  230. package/react/dist/blocks/swap/shared.d.ts +29 -23
  231. package/react/dist/blocks/swap/shared.js +36 -32
  232. package/react/dist/blocks/swap-panel-block.d.ts +12 -3
  233. package/react/dist/blocks/swap-panel-block.js +72 -37
  234. package/react/dist/blocks/target-block.d.ts +35 -7
  235. package/react/dist/blocks/target-block.js +26 -12
  236. package/react/dist/blocks/token-action-block.d.ts +21 -8
  237. package/react/dist/blocks/token-action-block.js +9 -6
  238. package/react/dist/blocks/trade-history-detail-block.d.ts +23 -1
  239. package/react/dist/blocks/trade-history-detail-block.js +5 -4
  240. package/react/dist/blocks/trade-history-list-block.d.ts +31 -5
  241. package/react/dist/blocks/trade-history-list-block.js +20 -10
  242. package/react/dist/blocks.d.ts +12 -8
  243. package/react/dist/blocks.js +6 -2
  244. package/react/dist/brand.js +2 -1
  245. package/react/dist/button.d.ts +9 -3
  246. package/react/dist/button.js +12 -5
  247. package/react/dist/confetti.d.ts +27 -0
  248. package/react/dist/confetti.js +240 -0
  249. package/react/dist/data.js +11 -4
  250. package/react/dist/field.d.ts +20 -5
  251. package/react/dist/field.js +30 -8
  252. package/react/dist/figure.d.ts +23 -0
  253. package/react/dist/figure.js +12 -0
  254. package/react/dist/gesture-sheet.d.ts +15 -1
  255. package/react/dist/gesture-sheet.js +53 -8
  256. package/react/dist/list-group.d.ts +41 -8
  257. package/react/dist/list-group.js +49 -13
  258. package/react/dist/navigation.js +11 -3
  259. package/react/dist/overlay.d.ts +28 -3
  260. package/react/dist/overlay.js +29 -3
  261. package/react/dist/preset-group.d.ts +30 -0
  262. package/react/dist/preset-group.js +13 -0
  263. package/react/dist/provider.d.ts +42 -5
  264. package/react/dist/provider.js +84 -10
  265. package/react/dist/qr-code.d.ts +32 -0
  266. package/react/dist/qr-code.js +28 -0
  267. package/react/dist/select.js +10 -3
  268. package/react/dist/selection.d.ts +18 -4
  269. package/react/dist/selection.js +20 -10
  270. package/react/dist/slider.js +5 -1
  271. package/react/dist/status.d.ts +14 -10
  272. package/react/dist/status.js +17 -9
  273. package/react/dist/styles.css +380 -150
  274. package/react/dist/surface.d.ts +5 -1
  275. package/react/dist/surface.js +1 -1
  276. package/react/dist/toast.d.ts +19 -12
  277. package/react/dist/toast.js +29 -7
  278. package/react/dist/wallet-address-core.d.ts +27 -0
  279. package/react/dist/wallet-address-core.js +29 -0
  280. package/react/dist/wallet-address.d.ts +6 -12
  281. package/react/dist/wallet-address.js +5 -16
  282. package/tokens/README.md +2 -2
  283. package/tokens/dist/index.d.ts +16 -0
  284. package/tokens/dist/index.js +16 -0
  285. package/tokens/dist/manifest.json +8 -0
  286. package/tokens/dist/tokens.css +6 -0
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type NativeScrollEvent, type NativeSyntheticEvent, type ScrollViewProps, type ViewStyle } from 'react-native';
2
3
  import type { AssetArtwork } from './asset-balance-row.js';
3
4
  /** The words of the block. They are trading terms, so the host supplies them; HIG ships none. */
4
5
  export interface TradeHistoryListLabels {
@@ -8,21 +9,55 @@ export interface TradeHistoryListLabels {
8
9
  short: string;
9
10
  /** Shown in place of the rows when there are no trades. */
10
11
  empty: string;
12
+ /** A second line under `empty`, in the muted colour: Closed trades appear here. */
13
+ emptyDescription?: string;
11
14
  }
12
15
  /** One closed trade. */
13
16
  export interface TradeHistoryItem {
14
17
  id: string;
15
18
  /** Asset name: Amazon. */
16
19
  name: string;
17
- /** Round artwork: an image URL or a host element. Without it the row shows the first letters of the name. */
20
+ /** Short ticker for the fallback disc when there is no `icon`: BTC. Without it the disc shows the first letters of the name. */
21
+ symbol?: string;
22
+ /** Round artwork: an image URL or a host element. Without it the row shows `symbol` or the first letters of the name. */
18
23
  icon?: AssetArtwork;
19
24
  side: 'long' | 'short';
20
25
  /** 20 reads `20×`. */
21
26
  leverage?: number;
27
+ /** A short muted qualifier after the leverage, read with it: current. Use it when the leverage was not recorded with the trade. */
28
+ leverageNote?: string;
22
29
  /** Net profit and loss in dollars. `null` reads as unknown. */
23
30
  pnl: number | null;
24
31
  /** Host-formatted age or time of the close, shown under the result: `2d`. */
25
32
  time?: string;
33
+ /** Small muted host text before the age, such as the wallet the trade came from: `0x22…22`. */
34
+ tag?: string;
35
+ /** Format of this trade's result, in place of the block's `pnlOptions`, for a host whose decimal ladder depends on the amount. */
36
+ pnlOptions?: Intl.NumberFormatOptions;
37
+ }
38
+ /**
39
+ * What `renderList` receives, shaped for FlatList so `{...list}` spreads onto it: the trades and helpers that draw them exactly
40
+ * as the block does. With `listChrome` it also carries everything around them, so the list holds the whole screen and a sheet
41
+ * that sizes itself to its content measures the list alone.
42
+ */
43
+ export interface TradeHistoryListRender {
44
+ trades: readonly TradeHistoryItem[];
45
+ /** Draws one row; the signature matches FlatList's `renderItem`. */
46
+ renderItem: (info: {
47
+ item: TradeHistoryItem;
48
+ }) => React.ReactElement;
49
+ keyExtractor: (trade: TradeHistoryItem) => string;
50
+ /** The 8dp gap between rows, for `ItemSeparatorComponent`. */
51
+ ItemSeparatorComponent: React.ComponentType;
52
+ /** With `listChrome`: the header (unless it is pinned with `stickyHeader`) and the `notice`, 16dp above the first row. `null` when there is neither. */
53
+ ListHeaderComponent?: React.ReactElement | null;
54
+ /** With `listChrome`: the `footer`, 16dp under the last row. `null` without one. */
55
+ ListFooterComponent?: React.ReactElement | null;
56
+ /** With `listChrome`: the block's 16dp inset around the rows, header and footer. */
57
+ contentContainerStyle?: ViewStyle;
58
+ /** With `stickyHeader`: reports the list's offset so the pinned header fills once rows scroll under it. */
59
+ onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
60
+ scrollEventThrottle?: number;
26
61
  }
27
62
  export interface TradeHistoryListBlockProps {
28
63
  labels: TradeHistoryListLabels;
@@ -34,11 +69,42 @@ export interface TradeHistoryListBlockProps {
34
69
  onBack?: () => void;
35
70
  /** A control on the trailing edge of the header, usually an IconButton. */
36
71
  headerAction?: React.ReactNode;
37
- /** Format of the result. Defaults to signed US dollars at four significant digits: `+$1.412`, `+$17.90`, `-$0.6878`. */
72
+ /** Format of the result. Defaults to signed US dollars at four significant digits: `+$1.412`, `+$17.90`, `-$0.6878`. The provider's `numberFormat` is merged under it. */
38
73
  pnlOptions?: Intl.NumberFormatOptions;
74
+ /** Draws rows of skeletons in place of the trades while the host loads them. */
75
+ loading?: boolean;
76
+ /** Host text that names the skeleton rows for assistive technology: Loading history. Without it they are only marked busy. */
77
+ loadingLabel?: string;
78
+ /** Why the trades could not load, in place of the rows, in the negative colour and announced. */
79
+ error?: string;
80
+ /** Host content under the header, above the rows: a partial-history notice or a mode banner. */
81
+ notice?: React.ReactNode;
82
+ /** Host content under the rows: paging, a spinner for the next page, a note. */
83
+ footer?: React.ReactNode;
84
+ /**
85
+ * Draws the rows through the host's own list, so a long history does not mount every row at once:
86
+ * `renderList={list => <FlatList data={list.trades} {...list} initialNumToRender={10}/>}`. The header, notice and footer stay
87
+ * fixed around the list in the block's inset, and the block fills its parent (`flex: 1`), so place it in a bounded container
88
+ * such as a sheet body, not inside a ScrollView.
89
+ */
90
+ renderList?: (list: TradeHistoryListRender) => React.ReactNode;
91
+ /**
92
+ * With `renderList`: hands the list the header, notice, footer and inset as well (`ListHeaderComponent`, `ListFooterComponent`,
93
+ * `contentContainerStyle`), so they scroll with the rows, a spread FlatList holds the whole screen and a sheet that sizes itself
94
+ * to its content measures the list alone. The block then adds no padding of its own. Spread the whole object.
95
+ */
96
+ listChrome?: boolean;
97
+ /** Keeps the header pinned while the rows scroll, transparent at rest and filled once rows scroll under it. Without `renderList` the block becomes its own scroll view; with it the header stays above the host's list, which reports its offset through `onScroll`. Place it in a bounded container. */
98
+ stickyHeader?: boolean;
99
+ /** Fill behind the pinned header once rows scroll under it. Defaults to the background role; in a sheet pass the sheet's fill. */
100
+ stickyHeaderBackground?: string;
101
+ /** The scroll view used with `stickyHeader` without `renderList`, such as a sheet library's own. */
102
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
39
103
  testID?: string;
40
104
  }
41
105
  /** How a row reads its side: `Short 20×`, or `Short` without leverage. */
42
- export declare const tradeHistorySide: (trade: Pick<TradeHistoryItem, 'side' | 'leverage'>, labels: Pick<TradeHistoryListLabels, 'long' | 'short'>, locale?: string) => string;
43
- /** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the direction colour, and the net result in the result colour over its age. */
44
- export declare function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions, testID }: TradeHistoryListBlockProps): React.JSX.Element;
106
+ export declare const tradeHistorySide: (trade: Pick<TradeHistoryItem, 'side' | 'leverage'> & {
107
+ leverageNote?: string;
108
+ }, labels: Pick<TradeHistoryListLabels, 'long' | 'short'>, locale?: string) => string;
109
+ /** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the market direction colour, and the net result in the market direction colour over its age. */
110
+ export declare function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions, loading, loadingLabel, error, notice, footer, renderList, listChrome, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: TradeHistoryListBlockProps): React.JSX.Element;
@@ -1,29 +1,67 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowUp } from '@bloxwap/icons/native/arrow-up';
3
+ import { ArrowDown } from '@bloxwap/icons/native/arrow-down';
2
4
  import { Image, Pressable, View } from 'react-native';
3
- import { formatNumber } from '@bloxwap/hig/contracts';
4
- import { useColors, useFills, useHIG, useMessages } from './provider.js';
5
+ import { formatNumber } from './number-format.js';
6
+ import { useColors, useFills, useHIG, useNumberLocale, usePresentNumber } from './provider.js';
5
7
  import { Text } from './surface.js';
6
- import { IconButton } from './button.js';
7
8
  import { ChevronIcon } from './icons.js';
9
+ import { ScreenHeader } from './screen-header.js';
10
+ import { StickyHeaderLayout, stickyHeaderFill, useStickyHeaderScroll } from './sticky-header.js';
8
11
  import { AnimatedNumberReadout } from './animated-number.js';
9
12
  const pnlFormat = { style: 'currency', currency: 'USD', signDisplay: 'exceptZero', minimumSignificantDigits: 4, maximumSignificantDigits: 4 };
10
13
  /** How a row reads its side: `Short 20×`, or `Short` without leverage. */
11
- export const tradeHistorySide = (trade, labels, locale) => `${trade.side === 'long' ? labels.long : labels.short}${trade.leverage != null ? ` ${formatNumber(trade.leverage, locale)}×` : ''}`;
14
+ export const tradeHistorySide = (trade, labels, locale) => `${trade.side === 'long' ? labels.long : labels.short}${trade.leverage != null ? ` ${formatNumber(trade.leverage, locale)}×` : ''}${trade.leverageNote ? ` ${trade.leverageNote}` : ''}`;
12
15
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
13
- const avatar = 40;
16
+ const avatar = 40, skeletons = [0, 1, 2, 3], dot = '·';
17
+ const keyOf = (trade) => trade.id;
18
+ function Gap() { return _jsx(View, { style: { height: 8 } }); }
14
19
  /** Points up; a short turns it over. */
15
- function Arrow({ color, down }) { return _jsxs(View, { style: { width: 12, height: 14, alignItems: 'center', transform: down ? [{ rotate: '180deg' }] : undefined }, children: [_jsx(View, { style: { position: 'absolute', top: 1, width: 7, height: 7, borderLeftWidth: 1.75, borderTopWidth: 1.75, borderColor: color, transform: [{ rotate: '45deg' }] } }), _jsx(View, { style: { width: 1.75, height: 14, borderRadius: 1, backgroundColor: color } })] }); }
16
- /** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the direction colour, and the net result in the result colour over its age. */
17
- export function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions = pnlFormat, testID }) {
18
- const colors = useColors(), fills = useFills(), t = useMessages(), { direction, locale } = useHIG();
20
+ function Arrow({ color, down }) { const Symbol = down ? ArrowDown : ArrowUp; return _jsx(Symbol, { size: 16, color: color }); }
21
+ /** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the market direction colour, and the net result in the market direction colour over its age. */
22
+ export function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions = pnlFormat, loading, loadingLabel, error, notice, footer, renderList, listChrome, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
23
+ const colors = useColors(), fills = useFills(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
24
+ const listScroll = useStickyHeaderScroll();
19
25
  const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
20
26
  const row = (pressed) => ({ flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 56, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 28, backgroundColor: pressed ? fills.raised : fills.well });
21
- return _jsxs(View, { testID: testID, style: { direction, padding: 16, gap: 16 }, children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: testID ? `${testID}-back` : undefined, onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: testID ? `${testID}-title` : undefined, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: labels.title }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] }), trades.length === 0 ? _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, style: { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20, color: colors.muted }, children: labels.empty }) :
22
- _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { gap: 8 }, children: trades.map(trade => {
23
- const side = colors[trade.side === 'long' ? 'positive' : 'negative'];
24
- const reading = [trade.name, tradeHistorySide(trade, labels, locale), formatNumber(trade.pnl, locale, pnlOptions), trade.time].filter(Boolean).join(', ');
25
- const content = _jsxs(_Fragment, { children: [_jsx(View, { ...hidden, children: typeof trade.icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: trade.icon }, style: shape }) : _jsx(View, { style: shape, children: trade.icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: trade.name.slice(0, 3) }) }) }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: trade.name }), _jsxs(View, { testID: testID ? `${testID}-${trade.id}-side` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [_jsx(Arrow, { color: side, down: trade.side === 'short' }), trade.leverage != null ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, fontWeight: '600', color: side }, children: `${formatNumber(trade.leverage, locale)}×` }) : null] })] }), _jsxs(View, { ...hidden, style: { alignItems: 'flex-end', justifyContent: 'center' }, children: [_jsx(AnimatedNumberReadout, { value: trade.pnl, options: pnlOptions, tone: trade.pnl == null || trade.pnl === 0 ? 'text' : trade.pnl > 0 ? 'positive' : 'negative', testID: testID ? `${testID}-${trade.id}-pnl` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }), trade.time ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: trade.time }) : null] })] });
26
- return onSelect ? _jsxs(Pressable, { testID: testID ? `${testID}-${trade.id}` : undefined, accessibilityRole: 'button', accessibilityLabel: reading, onPress: () => onSelect(trade), style: ({ pressed }) => row(pressed), children: [content, _jsx(View, { ...hidden, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }, trade.id)
27
- : _jsx(View, { testID: testID ? `${testID}-${trade.id}` : undefined, accessible: true, accessibilityLabel: reading, style: row(false), children: content }, trade.id);
28
- }) })] });
27
+ const meta = { fontSize: 14, lineHeight: 20, color: colors.muted };
28
+ const draw = (trade) => {
29
+ const side = trade.side === 'long' ? colors.up : colors.down, result = trade.pnlOptions ?? pnlOptions;
30
+ const reading = [trade.name, tradeHistorySide(trade, labels, locale), formatNumber(trade.pnl, locale, present(result)), trade.tag, trade.time].filter(Boolean).join(', ');
31
+ const content = _jsxs(_Fragment, { children: [_jsx(View, { ...hidden, children: typeof trade.icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: trade.icon }, style: shape }) : _jsx(View, { style: shape, children: trade.icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: trade.symbol ?? trade.name.slice(0, 3) }) }) }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: trade.name }), _jsxs(View, { testID: testID ? `${testID}-${trade.id}-side` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [_jsx(Arrow, { color: side, down: trade.side === 'short' }), trade.leverage != null ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, fontWeight: '600', color: side }, children: `${formatNumber(trade.leverage, locale)}×` }) : null, trade.leverageNote ? _jsx(Text, { testID: testID ? `${testID}-${trade.id}-leverage-note` : undefined, numberOfLines: 1, style: { ...meta, flexShrink: 1 }, children: trade.leverageNote }) : null] })] }), _jsxs(View, { ...hidden, style: trade.tag ? { alignItems: 'flex-end', justifyContent: 'center', flexShrink: 1 } : { alignItems: 'flex-end', justifyContent: 'center' }, children: [_jsx(AnimatedNumberReadout, { value: trade.pnl, options: result, tone: trade.pnl == null || trade.pnl === 0 ? 'text' : trade.pnl > 0 ? 'up' : 'down', testID: testID ? `${testID}-${trade.id}-pnl` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }), trade.tag ? _jsxs(View, { testID: testID ? `${testID}-${trade.id}-meta` : undefined, style: { direction, flexDirection: 'row', alignItems: 'center', gap: 4, flexShrink: 1 }, children: [_jsx(Text, { numberOfLines: 1, style: { ...meta, flexShrink: 1 }, children: trade.tag }), trade.time ? _jsxs(_Fragment, { children: [_jsx(Text, { style: meta, children: dot }), _jsx(Text, { style: meta, children: trade.time })] }) : null] })
32
+ : trade.time ? _jsx(Text, { style: meta, children: trade.time }) : null] })] });
33
+ return onSelect ? _jsxs(Pressable, { testID: testID ? `${testID}-${trade.id}` : undefined, accessibilityRole: 'button', accessibilityLabel: reading, onPress: () => onSelect(trade), style: ({ pressed }) => row(pressed), children: [content, _jsx(View, { ...hidden, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }, trade.id)
34
+ : _jsx(View, { testID: testID ? `${testID}-${trade.id}` : undefined, accessible: true, accessibilityLabel: reading, style: row(false), children: content }, trade.id);
35
+ };
36
+ // The empty and error lines keep 32 above them and none below: the block's (or the host sheet's) 16 bottom inset is the only space under the text.
37
+ const plain = { paddingTop: 32, paddingBottom: 0, textAlign: 'center', fontSize: 14, lineHeight: 20 };
38
+ const body = loading ? _jsx(View, { testID: testID ? `${testID}-loading` : undefined, accessible: !!loadingLabel, accessibilityLabel: loadingLabel, accessibilityState: { busy: true }, style: { gap: 8 }, children: skeletons.map(index => _jsx(View, { style: { minHeight: 56, borderRadius: 28, backgroundColor: fills.raised } }, index)) })
39
+ : error ? _jsx(Text, { testID: testID ? `${testID}-error` : undefined, accessibilityRole: 'alert', accessibilityLiveRegion: 'polite', style: { ...plain, color: colors.negative }, children: error })
40
+ : trades.length === 0 ? (labels.emptyDescription ? _jsxs(View, { testID: testID ? `${testID}-empty` : undefined, accessible: true, accessibilityLabel: `${labels.empty}, ${labels.emptyDescription}`, style: { paddingTop: 32, gap: 4 }, children: [_jsx(Text, { style: { ...plain, paddingTop: 0, fontWeight: '600', color: colors.text }, children: labels.empty }), _jsx(Text, { style: { ...plain, paddingTop: 0, color: colors.muted }, children: labels.emptyDescription })] }) : _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, style: { ...plain, color: colors.muted }, children: labels.empty }))
41
+ : null;
42
+ const header = _jsx(ScreenHeader, { testID: testID, title: labels.title, onBack: onBack, action: headerAction });
43
+ const noticeView = notice != null && notice !== false ? _jsx(View, { testID: testID ? `${testID}-notice` : undefined, style: { gap: 8 }, children: notice }) : null;
44
+ const footerView = footer != null && footer !== false ? _jsx(View, { testID: testID ? `${testID}-footer` : undefined, style: { gap: 8 }, children: footer }) : null;
45
+ let hosted = null;
46
+ if (!body && renderList) {
47
+ const scroll = stickyHeader ? { onScroll: listScroll.onScroll, scrollEventThrottle: listScroll.scrollEventThrottle } : null;
48
+ const base = { trades, renderItem: ({ item }) => draw(item), keyExtractor: keyOf, ItemSeparatorComponent: Gap, ...scroll };
49
+ // listChrome: the list holds the whole screen, with header and notice above the rows, the footer under them, and the block's inset around both.
50
+ const top = stickyHeader ? noticeView : _jsxs(_Fragment, { children: [header, noticeView] });
51
+ const list = renderList(listChrome ? { ...base,
52
+ ListHeaderComponent: stickyHeader && !noticeView ? null : _jsx(View, { style: { direction, gap: 16, paddingBottom: 16 }, children: top }),
53
+ ListFooterComponent: footerView ? _jsx(View, { style: { direction, paddingTop: 16 }, children: footerView }) : null,
54
+ contentContainerStyle: { padding: 16 } } : base);
55
+ hosted = _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { flex: 1 }, children: list });
56
+ const pinned = stickyHeader ? _jsx(View, { testID: testID ? `${testID}-sticky-header` : undefined, style: [{ paddingHorizontal: 16, paddingTop: 16 }, stickyHeaderFill(listScroll.scrolled, stickyHeaderBackground ?? colors.background)], children: header }) : null;
57
+ if (listChrome)
58
+ return _jsxs(View, { testID: testID, style: { direction, flex: 1 }, children: [pinned, hosted] });
59
+ // Pinned without listChrome: the header fills over the block's own stack, which keeps the notice, the list and the footer as before.
60
+ if (stickyHeader)
61
+ return _jsxs(View, { testID: testID, style: { direction, flex: 1 }, children: [pinned, _jsxs(View, { style: { padding: 16, gap: 16, flex: 1 }, children: [noticeView, hosted, footerView] })] });
62
+ }
63
+ const rows = body ?? hosted ?? _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { gap: 8 }, children: trades.map(draw) });
64
+ if (stickyHeader)
65
+ return _jsxs(StickyHeaderLayout, { testID: testID, headerTestID: testID ? `${testID}-sticky-header` : undefined, header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, bodyStyle: { direction, gap: 16, paddingTop: 16 }, children: [noticeView, rows, footerView] });
66
+ return _jsxs(View, { testID: testID, style: renderList ? { direction, padding: 16, gap: 16, flex: 1 } : { direction, padding: 16, gap: 16 }, children: [header, noticeView, rows, footerView] });
29
67
  }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import { type AddressKind } from './data.js';
3
+ export { VerticalAddress, addressKind, type AddressKind } from './data.js';
4
+ export interface WalletAddressCoreProps {
5
+ address: string;
6
+ kind?: AddressKind;
7
+ /** The QR code, drawn by the host (its own encoder or SVG), laid out in a `size` square. It is read as one image named by the built-in “QR code” label. */
8
+ qr: React.ReactNode;
9
+ /** QR edge in dp; default 196. The address column is exactly as tall. */
10
+ size?: number;
11
+ /** Host clipboard adapter. When set the whole component is one button that copies the address and shows the Tap to copy hint. */
12
+ onCopy?: () => Promise<void> | void;
13
+ /** `false` shows no “Address copied” notice after a copy, for a host that confirms the copy itself. Default `true`. */
14
+ announce?: boolean;
15
+ testID?: string;
16
+ }
17
+ /** @internal The layout both `WalletAddress` entries share. `code` is the QR as drawn, already named for assistive technology. */
18
+ export declare function WalletAddressFrame({ address, kind, code, size, onCopy, announce, testID }: Omit<WalletAddressCoreProps, 'qr'> & {
19
+ code: React.ReactNode;
20
+ }): React.JSX.Element;
21
+ /**
22
+ * `WalletAddress` without the QR encoder: the host passes the code as `qr`, so neither `cuer` nor `react-native-svg` is
23
+ * needed. The address column, the copy button, its hint and the notice are the same as `WalletAddress` from `wallet-address`.
24
+ */
25
+ export declare function WalletAddress({ qr, ...props }: WalletAddressCoreProps): React.JSX.Element;
@@ -0,0 +1,34 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Copy } from '@bloxwap/icons/native/copy';
3
+ import { useAsyncResult } from './async-result.js';
4
+ import { Pressable, View } from 'react-native';
5
+ import { useColors, useMessages } from './provider.js';
6
+ import { Text } from './surface.js';
7
+ import { Toast, useTransientNotice } from './status.js';
8
+ import { VerticalAddress, addressKind } from './data.js';
9
+ export { VerticalAddress, addressKind } from './data.js';
10
+ const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
11
+ /** Two overlapping rounded squares: copy. */
12
+ function CopyIcon({ color }) { return _jsx(Copy, { size: 16, color: color }); }
13
+ /** @internal The layout both `WalletAddress` entries share. `code` is the QR as drawn, already named for assistive technology. */
14
+ export function WalletAddressFrame({ address, kind, code, size = 196, onCopy, announce = true, testID }) {
15
+ const colors = useColors();
16
+ const t = useMessages();
17
+ const { notice, show, dismiss } = useTransientNotice();
18
+ const layout = kind ?? addressKind(address), rows = Math.max(1, Math.ceil(address.length / (layout === 'ethereum' ? 6 : 4)));
19
+ const body = _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 16 }, children: [_jsx(View, { style: { width: size, height: size }, children: code }), _jsx(VerticalAddress, { address: address, kind: layout, rowHeight: size / rows, testID: 'wallet-address-column' })] }), onCopy ? _jsxs(View, { ...hidden, style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, marginTop: 12 }, children: [_jsx(CopyIcon, { color: colors.muted }), _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21 }, children: t.tapToCopy })] }) : null] });
20
+ const beginCopy = useAsyncResult(address);
21
+ const copy = () => { const current = beginCopy(); if (!onCopy)
22
+ return; Promise.resolve().then(onCopy).then(() => { if (current() && announce)
23
+ show(t.addressCopied); }).catch(() => { }); };
24
+ // The toast sits outside the button so its dismiss control is not nested in another control.
25
+ return _jsxs(View, { testID: testID, style: { alignItems: 'center' }, children: [onCopy ? _jsx(Pressable, { accessibilityRole: 'button', accessibilityLabel: `${t.copyAddress}: ${address}`, testID: 'wallet-address-copy', onPress: copy, style: ({ pressed }) => ({ opacity: pressed ? 0.8 : 1 }), children: body }) : _jsx(View, { children: body }), notice ? _jsx(View, { style: { marginTop: 8 }, children: _jsx(Toast, { notices: [notice], onDismiss: dismiss }) }) : null] });
26
+ }
27
+ /**
28
+ * `WalletAddress` without the QR encoder: the host passes the code as `qr`, so neither `cuer` nor `react-native-svg` is
29
+ * needed. The address column, the copy button, its hint and the notice are the same as `WalletAddress` from `wallet-address`.
30
+ */
31
+ export function WalletAddress({ qr, ...props }) {
32
+ const t = useMessages();
33
+ return _jsx(WalletAddressFrame, { ...props, code: _jsx(View, { accessible: true, accessibilityRole: 'image', accessibilityLabel: t.qrCode, testID: 'wallet-address-qr', style: { width: '100%', height: '100%' }, children: qr }) });
34
+ }
@@ -1,18 +1,14 @@
1
1
  import React from 'react';
2
- import { type AddressKind } from './data.js';
2
+ import { type WalletAddressCoreProps } from './wallet-address-core.js';
3
3
  export { VerticalAddress, addressKind, type AddressKind } from './data.js';
4
- export interface WalletAddressProps {
5
- address: string;
6
- kind?: AddressKind;
4
+ export type { WalletAddressCoreProps } from './wallet-address-core.js';
5
+ export interface WalletAddressProps extends Omit<WalletAddressCoreProps, 'qr'> {
7
6
  /** QR payload when it differs from the address, e.g. an EIP-681 or Solana Pay URI. Defaults to the address. */
8
7
  qrValue?: string;
9
8
  /** Image URL shown in the centre of the QR. */
10
9
  arena?: string;
11
- /** QR edge in dp; default 196. */
12
- size?: number;
13
- /** Host clipboard adapter. When set the whole component is one button that copies the address and shows the Tap to copy hint. */
14
- onCopy?: () => Promise<void> | void;
15
- testID?: string;
10
+ /** The host's own QR drawing in place of the cuer-style code; `qrValue` and `arena` are then unused and nothing is encoded. Without `cuer` installed, import `WalletAddress` from `wallet-address-core` instead. */
11
+ qr?: React.ReactNode;
16
12
  }
17
13
  /** The QR's drawing, in module units: three finder origins, one path of round dots for every other dark module, and the centre square left clear for an arena. */
18
14
  export declare function qrGeometry(grid: readonly (readonly boolean[])[], withArena: boolean): {
@@ -34,4 +30,4 @@ export declare function qrGeometry(grid: readonly (readonly boolean[])[], withAr
34
30
  * With `onCopy` the whole component is one button and a Tap to copy hint sits under it. Needs the optional `cuer` and
35
31
  * `react-native-svg` peers; the encoder comes from `cuer/QrCode`, so React DOM is never loaded.
36
32
  */
37
- export declare function WalletAddress({ address, kind, qrValue, arena, size, onCopy, testID }: WalletAddressProps): React.JSX.Element;
33
+ export declare function WalletAddress({ qrValue, arena, qr, ...props }: WalletAddressProps): React.JSX.Element;
@@ -1,12 +1,10 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useMemo } from 'react';
3
- import { Image, Pressable, View } from 'react-native';
3
+ import { Image } from 'react-native';
4
4
  import Svg, { Path, Rect } from 'react-native-svg';
5
5
  import { create } from 'cuer/QrCode';
6
6
  import { useColors, useMessages } from './provider.js';
7
- import { Text } from './surface.js';
8
- import { Toast, useTransientNotice } from './status.js';
9
- import { VerticalAddress, addressKind } from './data.js';
7
+ import { WalletAddress as WalletAddressCore, WalletAddressFrame } from './wallet-address-core.js';
10
8
  export { VerticalAddress, addressKind } from './data.js';
11
9
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
12
10
  /** The QR's drawing, in module units: three finder origins, one path of round dots for every other dark module, and the centre square left clear for an arena. */
@@ -25,26 +23,24 @@ export function qrGeometry(grid, withArena) {
25
23
  }
26
24
  return { edge, finders: [{ x: 0, y: 0 }, { x: far, y: 0 }, { x: 0, y: far }], dots, count, arena: size > 0 ? { origin, size } : null };
27
25
  }
28
- /** Two overlapping rounded squares: copy. */
29
- function CopyIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 16, height: 16 }, children: [_jsx(View, { style: { position: 'absolute', left: 0, top: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } }), _jsx(View, { style: { position: 'absolute', right: 0, bottom: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } })] }); }
26
+ /** The cuer-style code: round dots, rounded finder patterns, no tile, and an optional arena image in the centre. */
27
+ function CuerCode({ value, arena, size }) {
28
+ const colors = useColors();
29
+ const t = useMessages();
30
+ const withArena = !!arena;
31
+ const qr = useMemo(() => qrGeometry(create(value, { errorCorrection: withArena ? 'high' : 'medium' }).grid, withArena), [value, withArena]);
32
+ const unit = size / qr.edge;
33
+ return _jsxs(_Fragment, { children: [_jsxs(Svg, { width: size, height: size, viewBox: `0 0 ${qr.edge} ${qr.edge}`, accessible: true, accessibilityRole: 'image', accessibilityLabel: t.qrCode, testID: 'wallet-address-qr', children: [qr.finders.map((finder, index) => _jsxs(React.Fragment, { children: [_jsx(Rect, { x: finder.x + 0.5, y: finder.y + 0.5, width: 6, height: 6, rx: 1.75, fill: 'none', stroke: colors.text, strokeWidth: 1 }), _jsx(Rect, { x: finder.x + 2, y: finder.y + 2, width: 3, height: 3, rx: 0.75, fill: colors.text })] }, index)), _jsx(Path, { d: qr.dots, fill: colors.text })] }), arena && qr.arena ? _jsx(Image, { ...hidden, source: { uri: arena }, testID: 'wallet-address-arena', style: { position: 'absolute', left: (qr.arena.origin + 0.5) * unit, top: (qr.arena.origin + 0.5) * unit, width: (qr.arena.size - 1) * unit, height: (qr.arena.size - 1) * unit, borderRadius: unit } }) : null] });
34
+ }
30
35
  /**
31
36
  * A wallet address to scan or copy: the QR in the cuer style (round dots, rounded finder patterns, no tile) beside the
32
37
  * address as a monospace column exactly as tall as the code. Ethereum (`0x…`) lays out 6 characters a row and Solana 4.
33
38
  * With `onCopy` the whole component is one button and a Tap to copy hint sits under it. Needs the optional `cuer` and
34
39
  * `react-native-svg` peers; the encoder comes from `cuer/QrCode`, so React DOM is never loaded.
35
40
  */
36
- export function WalletAddress({ address, kind, qrValue, arena, size = 196, onCopy, testID }) {
37
- const colors = useColors();
38
- const t = useMessages();
39
- const { notice, show, dismiss } = useTransientNotice();
40
- const layout = kind ?? addressKind(address), rows = Math.max(1, Math.ceil(address.length / (layout === 'ethereum' ? 6 : 4)));
41
- const value = qrValue ?? address, withArena = !!arena;
42
- const qr = useMemo(() => qrGeometry(create(value, { errorCorrection: withArena ? 'high' : 'medium' }).grid, withArena), [value, withArena]);
43
- const unit = size / qr.edge;
44
- const code = _jsxs(View, { style: { width: size, height: size }, children: [_jsxs(Svg, { width: size, height: size, viewBox: `0 0 ${qr.edge} ${qr.edge}`, accessible: true, accessibilityRole: 'image', accessibilityLabel: t.qrCode, testID: 'wallet-address-qr', children: [qr.finders.map((finder, index) => _jsxs(React.Fragment, { children: [_jsx(Rect, { x: finder.x + 0.5, y: finder.y + 0.5, width: 6, height: 6, rx: 1.75, fill: 'none', stroke: colors.text, strokeWidth: 1 }), _jsx(Rect, { x: finder.x + 2, y: finder.y + 2, width: 3, height: 3, rx: 0.75, fill: colors.text })] }, index)), _jsx(Path, { d: qr.dots, fill: colors.text })] }), arena && qr.arena ? _jsx(Image, { ...hidden, source: { uri: arena }, testID: 'wallet-address-arena', style: { position: 'absolute', left: (qr.arena.origin + 0.5) * unit, top: (qr.arena.origin + 0.5) * unit, width: (qr.arena.size - 1) * unit, height: (qr.arena.size - 1) * unit, borderRadius: unit } }) : null] });
45
- const body = _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 16 }, children: [code, _jsx(VerticalAddress, { address: address, kind: layout, rowHeight: size / rows, testID: 'wallet-address-column' })] }), onCopy ? _jsxs(View, { ...hidden, style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, marginTop: 12 }, children: [_jsx(CopyIcon, { color: colors.muted }), _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21 }, children: t.tapToCopy })] }) : null] });
46
- const copy = () => { if (!onCopy)
47
- return; Promise.resolve().then(onCopy).then(() => show(t.addressCopied)).catch(() => { }); };
48
- // The toast sits outside the button so its dismiss control is not nested in another control.
49
- return _jsxs(View, { testID: testID, style: { alignItems: 'center' }, children: [onCopy ? _jsx(Pressable, { accessibilityRole: 'button', accessibilityLabel: `${t.copyAddress}: ${address}`, testID: 'wallet-address-copy', onPress: copy, style: ({ pressed }) => ({ opacity: pressed ? 0.8 : 1 }), children: body }) : _jsx(View, { children: body }), notice ? _jsx(View, { style: { marginTop: 8 }, children: _jsx(Toast, { notices: [notice], onDismiss: dismiss }) }) : null] });
41
+ export function WalletAddress({ qrValue, arena, qr, ...props }) {
42
+ // As on web, `null` falls back to the cuer code like a missing `qr`.
43
+ if (qr != null)
44
+ return _jsx(WalletAddressCore, { ...props, qr: qr });
45
+ return _jsx(WalletAddressFrame, { ...props, code: _jsx(CuerCode, { value: qrValue ?? props.address, arena: arena, size: props.size ?? 196 }) });
50
46
  }
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/native-fonts
2
2
 
3
- Version 0.6.0, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
3
+ Version 0.8.1, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
4
4
 
5
5
  Web hosts never import this entry: load fonts through `@bloxwap/font` and use `@bloxwap/hig/tokens/css`. Open Graph card renderers (Satori, `next/og`) use the much smaller `@bloxwap/hig/og-fonts` entry instead (#99).
6
6
 
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/og-fonts
2
2
 
3
- Version 0.6.0, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
3
+ Version 0.8.1, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
4
4
 
5
5
  | Face | File | Weight |
6
6
  | --- | --- | --- |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloxwap/hig",
3
- "version": "0.6.0",
3
+ "version": "0.8.1",
4
4
  "description": "Bloxwap Human Interface Guidelines: tokens, contracts, React and React Native components, chart adapter, feedback and fonts in one package.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,11 +36,36 @@
36
36
  "import": "./contracts/dist/announcements.js",
37
37
  "default": "./contracts/dist/announcements.js"
38
38
  },
39
+ "./contracts/number-flow": {
40
+ "types": "./contracts/dist/number-flow.d.ts",
41
+ "import": "./contracts/dist/number-flow.js",
42
+ "default": "./contracts/dist/number-flow.js"
43
+ },
39
44
  "./contracts/messages": {
40
45
  "types": "./contracts/dist/messages.d.ts",
41
46
  "import": "./contracts/dist/messages.js",
42
47
  "default": "./contracts/dist/messages.js"
43
48
  },
49
+ "./contracts/toast": {
50
+ "types": "./contracts/dist/toast.d.ts",
51
+ "import": "./contracts/dist/toast.js",
52
+ "default": "./contracts/dist/toast.js"
53
+ },
54
+ "./contracts/confetti": {
55
+ "types": "./contracts/dist/confetti.d.ts",
56
+ "import": "./contracts/dist/confetti.js",
57
+ "default": "./contracts/dist/confetti.js"
58
+ },
59
+ "./contracts/avatar": {
60
+ "types": "./contracts/dist/avatar.d.ts",
61
+ "import": "./contracts/dist/avatar.js",
62
+ "default": "./contracts/dist/avatar.js"
63
+ },
64
+ "./contracts/qr": {
65
+ "types": "./contracts/dist/qr.d.ts",
66
+ "import": "./contracts/dist/qr.js",
67
+ "default": "./contracts/dist/qr.js"
68
+ },
44
69
  "./native-fonts": {
45
70
  "types": "./native-fonts/dist/index.d.ts",
46
71
  "import": "./native-fonts/dist/index.js",
@@ -140,6 +165,11 @@
140
165
  "import": "./react/dist/status.js",
141
166
  "default": "./react/dist/status.js"
142
167
  },
168
+ "./react/avatar": {
169
+ "types": "./react/dist/avatar.d.ts",
170
+ "import": "./react/dist/avatar.js",
171
+ "default": "./react/dist/avatar.js"
172
+ },
143
173
  "./react/toast": {
144
174
  "types": "./react/dist/toast.d.ts",
145
175
  "import": "./react/dist/toast.js",
@@ -258,6 +288,21 @@
258
288
  "import": "./react/dist/wallet-address.js",
259
289
  "default": "./react/dist/wallet-address.js"
260
290
  },
291
+ "./react/wallet-address-core": {
292
+ "types": "./react/dist/wallet-address-core.d.ts",
293
+ "import": "./react/dist/wallet-address-core.js",
294
+ "default": "./react/dist/wallet-address-core.js"
295
+ },
296
+ "./react/qr-code": {
297
+ "types": "./react/dist/qr-code.d.ts",
298
+ "import": "./react/dist/qr-code.js",
299
+ "default": "./react/dist/qr-code.js"
300
+ },
301
+ "./native/qr-code": {
302
+ "types": "./native/dist/qr-code.d.ts",
303
+ "import": "./native/dist/qr-code.js",
304
+ "default": "./native/dist/qr-code.js"
305
+ },
261
306
  "./react/asset-balance-row": {
262
307
  "types": "./react/dist/asset-balance-row.d.ts",
263
308
  "import": "./react/dist/asset-balance-row.js",
@@ -328,6 +373,56 @@
328
373
  "import": "./react/dist/blocks/profile-block.js",
329
374
  "default": "./react/dist/blocks/profile-block.js"
330
375
  },
376
+ "./react/blocks/confirm-block": {
377
+ "types": "./react/dist/blocks/confirm-block.d.ts",
378
+ "import": "./react/dist/blocks/confirm-block.js",
379
+ "default": "./react/dist/blocks/confirm-block.js"
380
+ },
381
+ "./native/confirm-block": {
382
+ "types": "./native/dist/confirm-block.d.ts",
383
+ "import": "./native/dist/confirm-block.js",
384
+ "default": "./native/dist/confirm-block.js"
385
+ },
386
+ "./react/blocks/preset-picker-block": {
387
+ "types": "./react/dist/blocks/preset-picker-block.d.ts",
388
+ "import": "./react/dist/blocks/preset-picker-block.js",
389
+ "default": "./react/dist/blocks/preset-picker-block.js"
390
+ },
391
+ "./native/preset-picker-block": {
392
+ "types": "./native/dist/preset-picker-block.d.ts",
393
+ "import": "./native/dist/preset-picker-block.js",
394
+ "default": "./native/dist/preset-picker-block.js"
395
+ },
396
+ "./react/blocks/explainer-block": {
397
+ "types": "./react/dist/blocks/explainer-block.d.ts",
398
+ "import": "./react/dist/blocks/explainer-block.js",
399
+ "default": "./react/dist/blocks/explainer-block.js"
400
+ },
401
+ "./native/explainer-block": {
402
+ "types": "./native/dist/explainer-block.d.ts",
403
+ "import": "./native/dist/explainer-block.js",
404
+ "default": "./native/dist/explainer-block.js"
405
+ },
406
+ "./react/confetti": {
407
+ "types": "./react/dist/confetti.d.ts",
408
+ "import": "./react/dist/confetti.js",
409
+ "default": "./react/dist/confetti.js"
410
+ },
411
+ "./native/confetti": {
412
+ "types": "./native/dist/confetti.d.ts",
413
+ "import": "./native/dist/confetti.js",
414
+ "default": "./native/dist/confetti.js"
415
+ },
416
+ "./react/blocks/assets-block": {
417
+ "types": "./react/dist/blocks/assets-block.d.ts",
418
+ "import": "./react/dist/blocks/assets-block.js",
419
+ "default": "./react/dist/blocks/assets-block.js"
420
+ },
421
+ "./react/blocks/screen-header": {
422
+ "types": "./react/dist/blocks/screen-header.d.ts",
423
+ "import": "./react/dist/blocks/screen-header.js",
424
+ "default": "./react/dist/blocks/screen-header.js"
425
+ },
331
426
  "./react/bar-mark": {
332
427
  "types": "./react/dist/bar-mark.d.ts",
333
428
  "import": "./react/dist/bar-mark.js",
@@ -358,6 +453,11 @@
358
453
  "import": "./native/dist/wallet-address.js",
359
454
  "default": "./native/dist/wallet-address.js"
360
455
  },
456
+ "./native/wallet-address-core": {
457
+ "types": "./native/dist/wallet-address-core.d.ts",
458
+ "import": "./native/dist/wallet-address-core.js",
459
+ "default": "./native/dist/wallet-address-core.js"
460
+ },
361
461
  "./native/asset-balance-row": {
362
462
  "types": "./native/dist/asset-balance-row.d.ts",
363
463
  "import": "./native/dist/asset-balance-row.js",
@@ -428,6 +528,16 @@
428
528
  "import": "./native/dist/profile-block.js",
429
529
  "default": "./native/dist/profile-block.js"
430
530
  },
531
+ "./native/assets-block": {
532
+ "types": "./native/dist/assets-block.d.ts",
533
+ "import": "./native/dist/assets-block.js",
534
+ "default": "./native/dist/assets-block.js"
535
+ },
536
+ "./native/screen-header": {
537
+ "types": "./native/dist/screen-header.d.ts",
538
+ "import": "./native/dist/screen-header.js",
539
+ "default": "./native/dist/screen-header.js"
540
+ },
431
541
  "./native/bar-mark": {
432
542
  "types": "./native/dist/bar-mark.d.ts",
433
543
  "import": "./native/dist/bar-mark.js",
@@ -493,6 +603,11 @@
493
603
  "import": "./native/dist/status.js",
494
604
  "default": "./native/dist/status.js"
495
605
  },
606
+ "./native/avatar": {
607
+ "types": "./native/dist/avatar.d.ts",
608
+ "import": "./native/dist/avatar.js",
609
+ "default": "./native/dist/avatar.js"
610
+ },
496
611
  "./native/data": {
497
612
  "types": "./native/dist/data.d.ts",
498
613
  "import": "./native/dist/data.js",
@@ -548,11 +663,21 @@
548
663
  "import": "./native/dist/gesture-sheet.js",
549
664
  "default": "./native/dist/gesture-sheet.js"
550
665
  },
666
+ "./native/gesture-sheet-next": {
667
+ "types": "./native/dist/gesture-sheet-next.d.ts",
668
+ "import": "./native/dist/gesture-sheet-next.js",
669
+ "default": "./native/dist/gesture-sheet-next.js"
670
+ },
551
671
  "./native/animated-number": {
552
672
  "types": "./native/dist/animated-number.d.ts",
553
673
  "import": "./native/dist/animated-number.js",
554
674
  "default": "./native/dist/animated-number.js"
555
675
  },
676
+ "./native/toast": {
677
+ "types": "./native/dist/toast.d.ts",
678
+ "import": "./native/dist/toast.js",
679
+ "default": "./native/dist/toast.js"
680
+ },
556
681
  "./package.json": "./package.json"
557
682
  },
558
683
  "files": [
@@ -608,7 +733,8 @@
608
733
  "@gorhom/bottom-sheet": "^5.2.14",
609
734
  "react-native-reanimated": "^4.1.1",
610
735
  "react-native-worklets": "^0.5.1 || ^0.7.4 || ^0.13.0",
611
- "react-native-gesture-handler": "^2.28.0 || ^3.3.0"
736
+ "react-native-gesture-handler": "^2.28.0 || ^3.3.0",
737
+ "@bloxwap/icons": "^0.1.0"
612
738
  },
613
739
  "peerDependenciesMeta": {
614
740
  "react": {
@@ -673,6 +799,9 @@
673
799
  },
674
800
  "react-native-gesture-handler": {
675
801
  "optional": true
802
+ },
803
+ "@bloxwap/icons": {
804
+ "optional": true
676
805
  }
677
806
  },
678
807
  "repository": {
package/react/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @bloxwap/hig/react
2
2
 
3
- Version 0.6.0, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
3
+ Version 0.8.1, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
4
+
5
+ UI symbols come from `@bloxwap/icons` (install `@bloxwap/icons@^0.1.0`). The web entry renders inline SVG and imports individual icon modules.
4
6
 
5
7
  Set a brand accent with `<HIGProvider primaryColor='#ff0000'>` from
6
8
  `@bloxwap/hig/react/provider`. It accepts opaque sRGB hex (`#RGB` or `#RRGGBB`),