@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,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowDown } from '@bloxwap/icons/native/arrow-down';
3
+ import { ArrowUpDown } from '@bloxwap/icons/native/arrow-up-down';
4
+ import { ChevronDown } from '@bloxwap/icons/native/chevron-down';
5
+ import { Delete } from '@bloxwap/icons/native/delete';
6
+ import { Lock } from '@bloxwap/icons/native/lock';
7
+ import { LogOut } from '@bloxwap/icons/native/log-out';
8
+ import { Menu } from '@bloxwap/icons/native/menu';
9
+ import { RotateCcw } from '@bloxwap/icons/native/rotate-ccw';
10
+ import { ScanLine } from '@bloxwap/icons/native/scan-line';
11
+ import { Wallet } from '@bloxwap/icons/native/wallet';
2
12
  import { createContext } from 'react';
3
13
  import { Image, Pressable, View } from 'react-native';
4
14
  import { useColors, useFills, useHIG, useMessages } from './provider.js';
@@ -8,29 +18,17 @@ import { ChevronIcon } from './icons.js';
8
18
  import { AnimatedNumberReadout } from './animated-number.js';
9
19
  /** What a host surface supplies to the swap views: a sheet passes its backend's list so drags hand off to the sheet, and turns off the panel's own height animation. */
10
20
  export const SwapHostContext = createContext({});
11
- // Outline symbols drawn from plain views, like ./icons: decorative, so the control that holds them carries the name.
12
21
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', pointerEvents: 'none' };
13
- const stroke = 1.75;
14
22
  const centre = { alignItems: 'center', justifyContent: 'center' };
15
- const crossAngles = ['45deg', '-45deg'];
16
- function Arrow({ color, down, height }) { return _jsxs(View, { style: { width: 7, height, alignItems: 'center', transform: down ? [{ rotate: '180deg' }] : undefined }, children: [_jsx(View, { style: { position: 'absolute', top: 1, width: 5, height: 5, borderLeftWidth: stroke, borderTopWidth: stroke, borderColor: color, transform: [{ rotate: '45deg' }] } }), _jsx(View, { style: { width: stroke, height, borderRadius: stroke, backgroundColor: color } })] }); }
17
- /** One arrow, top to bottom: a one-way panel. */
18
- export function DownIcon({ color, size = 16 }) { return _jsx(View, { ...hidden, style: { width: size, height: size, ...centre }, children: _jsx(Arrow, { color: color, down: true, height: size - 3 }) }); }
19
- /** Two opposed arrows: exchange the pair, or switch the denomination. */
20
- export function FlipIcon({ color, size = 16 }) { return _jsxs(View, { ...hidden, style: { width: size, height: size, flexDirection: 'row', gap: 1, ...centre }, children: [_jsx(Arrow, { color: color, down: true, height: size - 3 }), _jsx(Arrow, { color: color, height: size - 3 })] }); }
21
- export function MenuIcon({ color }) { return _jsx(View, { ...hidden, style: { width: 20, height: 20, gap: 3.5, ...centre }, children: [0, 1, 2].map(index => _jsx(View, { style: { width: 14, height: stroke, borderRadius: stroke, backgroundColor: color } }, index)) }); }
22
- /** An open ring with an arrowhead at its gap. */
23
- export function ResetIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 20, height: 20, ...centre }, children: [_jsx(View, { style: { width: 14, height: 14, borderRadius: 7, borderWidth: stroke, borderColor: color, borderTopColor: 'transparent', transform: [{ rotate: '-45deg' }] } }), _jsx(View, { style: { position: 'absolute', left: 2, top: 3, width: 5, height: 5, borderLeftWidth: stroke, borderBottomWidth: stroke, borderColor: color } })] }); }
24
- /** Keypad delete: a key outline holding an x. */
25
- export function DeleteIcon({ color }) { return _jsx(View, { ...hidden, style: { width: 26, height: 18, borderRadius: 5, borderWidth: stroke, borderColor: color, ...centre }, children: crossAngles.map(angle => _jsx(View, { style: { position: 'absolute', width: 9, height: stroke, borderRadius: stroke, backgroundColor: color, transform: [{ rotate: angle }] } }, angle)) }); }
26
- /** Four viewfinder corners. */
27
- export function ScanIcon({ color }) { const corner = (style) => _jsx(View, { style: [{ position: 'absolute', width: 6, height: 6, borderColor: color }, style] }); return _jsxs(View, { ...hidden, style: { width: 18, height: 18 }, children: [corner({ left: 0, top: 0, borderLeftWidth: stroke, borderTopWidth: stroke, borderTopLeftRadius: 3 }), corner({ right: 0, top: 0, borderRightWidth: stroke, borderTopWidth: stroke, borderTopRightRadius: 3 }), corner({ left: 0, bottom: 0, borderLeftWidth: stroke, borderBottomWidth: stroke, borderBottomLeftRadius: 3 }), corner({ right: 0, bottom: 0, borderRightWidth: stroke, borderBottomWidth: stroke, borderBottomRightRadius: 3 }), _jsx(View, { style: { position: 'absolute', left: 0, right: 0, top: 8, height: stroke, borderRadius: stroke, backgroundColor: color } })] }); }
28
- /** A wallet: a rounded body with a clasp on the trailing edge. */
29
- export function WalletIcon({ color }) { return _jsx(View, { ...hidden, style: { width: 20, height: 20, ...centre }, children: _jsx(View, { style: { width: 16, height: 12, borderRadius: 3, borderWidth: stroke, borderColor: color, alignItems: 'flex-end', justifyContent: 'center' }, children: _jsx(View, { style: { width: 5, height: 4, borderTopLeftRadius: 2, borderBottomLeftRadius: 2, borderWidth: stroke, borderRightWidth: 0, borderColor: color, marginEnd: -stroke } }) }) }); }
30
- /** A padlock: a shackle over a body. */
31
- export function LockIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 16, height: 16, alignItems: 'center', justifyContent: 'flex-end' }, children: [_jsx(View, { style: { width: 8, height: 7, borderTopLeftRadius: 4, borderTopRightRadius: 4, borderWidth: stroke, borderBottomWidth: 0, borderColor: color } }), _jsx(View, { style: { width: 12, height: 8, borderRadius: 2, borderWidth: stroke, borderColor: color } })] }); }
32
- /** A doorway with an arrow leaving it. */
33
- export function LeaveIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 20, height: 20, flexDirection: 'row', alignItems: 'center' }, children: [_jsx(View, { style: { width: 8, height: 14, borderWidth: stroke, borderRightWidth: 0, borderColor: color, borderTopLeftRadius: 3, borderBottomLeftRadius: 3 } }), _jsx(View, { style: { width: 9, height: stroke, borderRadius: stroke, backgroundColor: color, marginStart: -2 } }), _jsx(View, { style: { width: 5, height: 5, borderRightWidth: stroke, borderTopWidth: stroke, borderColor: color, marginStart: -5, transform: [{ rotate: '45deg' }] } })] }); }
23
+ export function DownIcon({ color, size = 16 }) { return _jsx(ArrowDown, { size: size, color: color }); }
24
+ export function FlipIcon({ color, size = 16 }) { return _jsx(ArrowUpDown, { size: size, color: color }); }
25
+ export function MenuIcon({ color }) { return _jsx(Menu, { size: 20, color: color }); }
26
+ export function ResetIcon({ color }) { return _jsx(RotateCcw, { size: 20, color: color }); }
27
+ export function DeleteIcon({ color }) { return _jsx(Delete, { size: 24, color: color }); }
28
+ export function ScanIcon({ color }) { return _jsx(ScanLine, { size: 18, color: color }); }
29
+ export function WalletIcon({ color }) { return _jsx(Wallet, { size: 20, color: color }); }
30
+ export function LockIcon({ color }) { return _jsx(Lock, { size: 16, color: color }); }
31
+ export function LeaveIcon({ color }) { return _jsx(LogOut, { size: 20, color: color }); }
34
32
  /** Circular artwork from a URL or the host's own element, or the symbol's first letters when the host has none. */
35
33
  export function TokenArt({ uri, symbol, size, ring }) {
36
34
  const colors = useColors();
@@ -42,10 +40,10 @@ export function TokenArt({ uri, symbol, size, ring }) {
42
40
  /** Token artwork with its chain badge. */
43
41
  export function TokenIcon({ token, size = 44 }) { const colors = useColors(); return _jsxs(View, { ...hidden, style: { width: size, height: size }, children: [_jsx(TokenArt, { uri: token.icon, symbol: token.symbol, size: size }), token.chainIcon ? _jsx(View, { style: { position: 'absolute', end: 0, bottom: 0 }, children: _jsx(TokenArt, { uri: token.chainIcon, size: 18, ring: colors.overlay }) }) : null] }); }
44
42
  /** Small capsule action that sits on a card: Max, Test, the slippage setting and the denomination switch. 32dp tall with a 44dp target. */
45
- export function SwapCapsule({ children, onPress, label, testID }) {
43
+ export function SwapCapsule({ children, onPress, label, testID, disabled = false, hitSlop = { top: 6, bottom: 6 }, ref }) {
46
44
  const fills = useFills();
47
45
  const { direction } = useHIG();
48
- return _jsx(Pressable, { accessibilityRole: 'button', accessibilityLabel: label, testID: testID, onPress: onPress, hitSlop: { top: 6, bottom: 6 }, style: ({ pressed }) => ({ direction, flexDirection: 'row', alignItems: 'center', gap: 6, minHeight: 32, paddingVertical: 4, paddingHorizontal: 12, borderRadius: 9999, backgroundColor: pressed ? fills.raised : fills.well }), children: children });
46
+ return _jsx(Pressable, { disabled: disabled, accessibilityState: { disabled }, ref: ref, accessibilityRole: 'button', accessibilityLabel: label, testID: testID, onPress: onPress, hitSlop: hitSlop, style: ({ pressed }) => ({ direction, flexDirection: 'row', alignItems: 'center', gap: 6, minHeight: 32, paddingVertical: 4, paddingHorizontal: 12, borderRadius: 9999, backgroundColor: pressed ? fills.raised : fills.well }), children: children });
49
47
  }
50
48
  const keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '0', 'back'];
51
49
  /** Numeric keypad: a 3 by 4 grid of 56dp keys. Emits `0`–`9`, `.` or `back`. */
@@ -62,7 +60,7 @@ export function SwapHeader({ title, onBack }) {
62
60
  return _jsxs(View, { testID: 'swap-header', style: { flexDirection: 'row', alignItems: 'center', gap: 4, minHeight: 44, paddingStart: onBack ? 0 : 4 }, children: [onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: 'swap-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null, _jsx(Heading, { style: { fontWeight: '700', flexShrink: 1 }, children: title })] });
63
61
  }
64
62
  /** A small chevron: down marks a side that can be changed, trailing marks a card that opens something. Mirrors in RTL. */
65
- export function SmallChevron({ color, trailing }) { const { direction } = useHIG(); return _jsx(View, { ...hidden, style: { width: 16, height: 16, ...centre, transform: trailing ? [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] : undefined }, children: _jsx(View, { style: { width: 7, height: 7, borderRightWidth: stroke, borderBottomWidth: stroke, borderColor: color, transform: [{ translateY: -1.5 }, { rotate: '45deg' }] } }) }); }
63
+ export function SmallChevron({ color, trailing }) { const { direction } = useHIG(); return _jsx(ChevronDown, { size: 16, color: color, style: { transform: trailing ? [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] : undefined } }); }
66
64
  /** A pushed view inside the panel: Back and the view title, then the body. There is no close control; Back pops. */
67
65
  export function SwapSubview({ title, onBack, testID, children }) {
68
66
  return _jsxs(View, { testID: testID, style: { gap: 16 }, children: [_jsx(SwapHeader, { title: title, onBack: onBack }), children] });
@@ -6,6 +6,8 @@ export interface SwapFigure {
6
6
  options?: Intl.NumberFormatOptions;
7
7
  prefix?: string;
8
8
  suffix?: string;
9
+ /** Host-formatted text for `value`, drawn and read in place of Intl's and still moving place by place. Never parsed back. */
10
+ formattedValue?: string;
9
11
  }
10
12
  export interface SwapToken {
11
13
  /** Unique per asset and chain, for example `${chainId}-${address}`. */
@@ -18,7 +20,7 @@ export interface SwapToken {
18
20
  /** Artwork: an image URL, or the host's own element (an SVG component, say), which fills the disc. A missing token icon falls back to the symbol's first letters. */
19
21
  icon?: SwapArtwork;
20
22
  chainIcon?: SwapArtwork;
21
- /** Most decimal places a token amount may be typed with, for example 6 for USDC. Unlimited when omitted. Dollars always stop at two. */
23
+ /** Most decimal places a token amount may be typed with, for example 6 for USDC. Up to 100 when omitted; explicit precision must be an integer from 0 to 100. Dollars always stop at two. */
22
24
  decimals?: number;
23
25
  /** Holdings in token units, when the host knows them. Enables Max, Test and the balance check. */
24
26
  balance?: number | null;
@@ -28,6 +30,10 @@ export interface SwapToken {
28
30
  caption?: string | SwapFigure;
29
31
  /** Extra text matched by the picker search, such as the contract address. */
30
32
  keywords?: string;
33
+ /** Picker rows: host text after the balance figure, such as ` HYPE`. */
34
+ unitsSuffix?: string;
35
+ /** Picker rows: the second line under the name in place of the chain, for a list that is not about chains. The search still matches the chain. */
36
+ detail?: string;
31
37
  }
32
38
  /** An image URL, or an element the host draws. */
33
39
  export type SwapArtwork = string | React.ReactElement;
@@ -58,7 +64,7 @@ export declare const trimNumber: (value: number, digits?: number) => string;
58
64
  /** Keeps digits and one decimal point, and strips leading zeros; never returns an empty string. */
59
65
  export declare function sanitizeAmount(raw: string): string;
60
66
  /** Token units shown in the active denomination. Dollars floor to the cent so Max never resolves to more than the balance. */
61
- export declare function unitsToEntry(units: number, mode: SwapDenomination, price: number): string;
67
+ export declare function unitsToEntry(units: number | string, mode: SwapDenomination, price: number): string;
62
68
  /** Applies one keypad key (`0`–`9`, `.`, `back`) to an amount string. Dollars stop at two decimals. */
63
69
  export declare function applyAmountKey(current: string, key: string, mode: SwapDenomination, decimals?: number): string;
64
70
  /** Case-insensitive substring or in-order subsequence match. */
@@ -1,10 +1,13 @@
1
+ import { decimal, decimalMultiply, decimalDivide } from '@bloxwap/hig/contracts';
1
2
  /** Where Back leads: slippage and fees return to settings, everything else to the main form. */
2
3
  export const swapParentView = (view) => view === 'slippage' || view === 'fees' ? 'settings' : 'main';
3
4
  export const slippagePresets = [0.001, 0.005, 0.01];
4
5
  export function swapAction(from, to) {
5
- if (!from || !to || from.symbol === to.symbol)
6
+ if (!from || !to)
6
7
  return 'send';
7
- return from.chainId === to.chainId ? 'swap' : 'bridge';
8
+ if (String(from.chainId) !== String(to.chainId))
9
+ return 'bridge';
10
+ return from.id === to.id ? 'send' : 'swap';
8
11
  }
9
12
  /** A clean numeric string: no trailing zeros, at most `digits` decimals. */
10
13
  export const trimNumber = (value, digits = 8) => String(Number((Number.isFinite(value) ? value : 0).toFixed(digits)));
@@ -20,8 +23,8 @@ export function sanitizeAmount(raw) {
20
23
  /** Token units shown in the active denomination. Dollars floor to the cent so Max never resolves to more than the balance. */
21
24
  export function unitsToEntry(units, mode, price) {
22
25
  if (mode === 'token')
23
- return trimNumber(units);
24
- return price > 0 ? String(Math.floor(units * price * 100) / 100) : '0';
26
+ return decimal(units);
27
+ return price > 0 ? decimalMultiply(units, price, 2) : '0';
25
28
  }
26
29
  /** Applies one keypad key (`0`–`9`, `.`, `back`) to an amount string. Dollars stop at two decimals. */
27
30
  export function applyAmountKey(current, key, mode, decimals) {
@@ -52,9 +55,10 @@ export const formatPercent = (fraction) => `${Number((fraction * 100).toFixed(4)
52
55
  /** A small trial amount: 1% of holdings, capped at about one dollar's worth. */
53
56
  export function testAmount(token) {
54
57
  const balance = token.balance ?? 0, price = token.price ?? 0;
55
- if (!(balance > 0))
58
+ if (!(balance > 0) || !Number.isFinite(balance))
56
59
  return 0;
57
- return Number(Math.min(balance * 0.01, price > 0 ? 1 / price : balance * 0.01).toFixed(8));
60
+ const fraction = decimalDivide(balance, 100, token.decimals ?? 18);
61
+ return Number(decimal(price > 0 ? Math.min(Number(fraction), Number(decimalDivide(1, price, token.decimals ?? 18))) : fraction, token.decimals ?? 18));
58
62
  }
59
63
  export const shortAddress = (address) => address.length <= 12 ? address : `${address.slice(0, 6)}…${address.slice(-4)}`;
60
64
  /** A stable flat colour for a wallet address, so the same wallet always looks the same. */
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { Pressable, View } from 'react-native';
4
- import { formatNumber } from '@bloxwap/hig/contracts';
5
- import { useColors, useFills, useHIG, useMessages } from './provider.js';
4
+ import { formatNumber } from './number-format.js';
5
+ import { useColors, useFills, useHIG, useMessages, useNumberLocale, usePresentNumber } from './provider.js';
6
6
  import { Text } from './surface.js';
7
7
  import { Field, Input } from './field.js';
8
8
  import { SegmentedControl } from './radio-group.js';
@@ -21,11 +21,13 @@ export function SwapPicker({ side, onBack, selected, onSelect, wallet, onConnect
21
21
  }
22
22
  /** The settings views. Slippage and the fee breakdown push from the settings list, and Back returns to it. */
23
23
  export function SwapSettings({ view, onViewChange, onBack, denomination, onDenominationChange, slippage, onSlippageChange, fee, fees, quoteLoading, children }) {
24
- const { locale, direction } = useHIG();
24
+ const { direction } = useHIG();
25
+ const locale = useNumberLocale();
25
26
  const colors = useColors();
26
27
  const fills = useFills();
27
28
  const t = useMessages();
28
- const usd = (value) => formatNumber(value, locale, { style: 'currency', currency: 'USD' });
29
+ const present = usePresentNumber();
30
+ const usd = (value) => formatNumber(value, locale, present({ style: 'currency', currency: 'USD' }));
29
31
  const [custom, setCustom] = useState(null);
30
32
  const title = view === 'slippage' ? t.swapSlippageTitle : view === 'fees' ? t.swapFees : t.swapSettings;
31
33
  const feeText = quoteLoading ? '…' : fee != null ? usd(fee) : '—';
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import { type PressableProps } from 'react-native';
2
+ import { View, type PressableProps } from 'react-native';
3
3
  import type { CheckedProps } from './selection-types.js';
4
4
  /** One named switch around a host's noninteractive label, description and track. */
5
5
  export interface SwitchRowProps extends CheckedProps, Omit<PressableProps, 'children' | 'onPress' | 'disabled' | 'role' | 'accessibilityRole' | 'accessibilityLabel' | 'accessibilityLabelledBy' | 'aria-label' | 'aria-labelledby' | 'aria-checked' | 'aria-disabled'> {
6
6
  /** Custom anatomy is decorative. `label` names the switch and `accessibilityHint` describes it. */ children: React.ReactNode;
7
7
  }
8
- export declare function SwitchRow({ label, checked, defaultChecked, disabled, onCheckedChange, children, style, accessibilityState, ...props }: SwitchRowProps): React.JSX.Element;
8
+ /** The ref reaches the row's Pressable. */
9
+ export declare const SwitchRow: React.ForwardRefExoticComponent<SwitchRowProps & React.RefAttributes<React.ComponentRef<typeof View>>>;
@@ -1,7 +1,9 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
2
3
  import { Platform, Pressable, View } from 'react-native';
3
4
  import { useControllable, useHIG } from './provider.js';
4
- export function SwitchRow({ label, checked, defaultChecked = false, disabled, onCheckedChange, children, style, accessibilityState, ...props }) {
5
+ /** The ref reaches the row's Pressable. */
6
+ export const SwitchRow = /* @__PURE__ */ forwardRef(function SwitchRow({ label, checked, defaultChecked = false, disabled, onCheckedChange, children, style, accessibilityState, ...props }, ref) {
5
7
  const env = useHIG(), [current, set] = useControllable(checked, defaultChecked, onCheckedChange);
6
8
  const toggle = () => { if (!disabled)
7
9
  set(!current); };
@@ -14,5 +16,5 @@ export function SwitchRow({ label, checked, defaultChecked = false, disabled, on
14
16
  toggle();
15
17
  }
16
18
  } } : {};
17
- return _jsx(Pressable, { ...props, ...webKeys, accessible: true, accessibilityRole: 'switch', accessibilityLabel: label, accessibilityState: { ...accessibilityState, checked: current, disabled: !!disabled }, "aria-checked": current, "aria-busy": accessibilityState?.busy, disabled: disabled, onPress: toggle, style: state => [{ direction: env.direction, minHeight: 48, flexDirection: 'row' }, typeof style === 'function' ? style(state) : style], children: _jsx(View, { pointerEvents: 'none', accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', "aria-hidden": true, style: { flex: 1 }, children: children }) });
18
- }
19
+ return _jsx(Pressable, { ...props, ...webKeys, ref: ref, accessible: true, accessibilityRole: 'switch', accessibilityLabel: label, accessibilityState: { ...accessibilityState, checked: current, disabled: !!disabled }, "aria-checked": current, "aria-busy": accessibilityState?.busy, disabled: disabled, onPress: toggle, style: state => [{ direction: env.direction, minHeight: 48, flexDirection: 'row' }, typeof style === 'function' ? style(state) : style], children: _jsx(View, { pointerEvents: 'none', accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', "aria-hidden": true, style: { flex: 1 }, children: children }) });
20
+ });
@@ -3,8 +3,10 @@ import type { CheckedProps } from './selection-types.js';
3
3
  import { type AccentRole } from './roles.js';
4
4
  export type { AccentRole } from './roles.js';
5
5
  export interface SwitchProps extends CheckedProps {
6
- tone?: AccentRole;
6
+ tone?: AccentRole; /** Draws the track alone: `label` still names the switch but is not shown, for a switch whose row already shows its name (such as a ListRow `trailing` control). */
7
+ hideLabel?: boolean;
8
+ testID?: string;
7
9
  }
8
10
  /** The off track is the dark `border` grey, so it reads as off on the page and on a card. On iOS/Android the whole labeled row is one 48dp switch target; the platform track is a hidden visual indicator. */
9
- export declare function Switch({ label, checked, defaultChecked, disabled, tone, onCheckedChange }: SwitchProps): React.JSX.Element;
11
+ export declare function Switch({ label, checked, defaultChecked, disabled, tone, hideLabel, testID, onCheckedChange }: SwitchProps): React.JSX.Element;
10
12
  export { SwitchRow, type SwitchRowProps } from './switch-row.js';
@@ -7,7 +7,7 @@ import { roleColor } from './roles.js';
7
7
  /** react-native-web passes CSS transitions through style. */
8
8
  const webEase = { transitionProperty: 'transform, background-color', transitionDuration: '150ms' };
9
9
  /** The off track is the dark `border` grey, so it reads as off on the page and on a card. On iOS/Android the whole labeled row is one 48dp switch target; the platform track is a hidden visual indicator. */
10
- export function Switch({ label, checked, defaultChecked = false, disabled, tone, onCheckedChange }) {
10
+ export function Switch({ label, checked, defaultChecked = false, disabled, tone, hideLabel, testID, onCheckedChange }) {
11
11
  const env = useHIG();
12
12
  const colors = useColors();
13
13
  const fills = useFills();
@@ -20,11 +20,11 @@ export function Switch({ label, checked, defaultChecked = false, disabled, tone,
20
20
  // otherwise paints the thumb with the app theme accent, Material teal, so it takes `text`). react-native-web's own Switch draws a
21
21
  // Material thumb wider than its track in that off-palette teal and would nest a second control, so web draws the 40×24 capsule of
22
22
  // @bloxwap/hig/react: an 18dp thumb inset 3dp that slides and eases over 150ms. RN Web presses on Enter; Space is handled here.
23
- return _jsxs(Pressable, { accessibilityRole: 'switch', accessibilityLabel: label, accessibilityState: { checked: current, disabled: !!disabled }, "aria-checked": current, "aria-disabled": !!disabled, disabled: disabled, onPress: toggle, ...(web ? { onKeyDown: (event) => { if (event.key === ' ') {
23
+ return _jsxs(Pressable, { testID: testID, accessibilityRole: 'switch', accessibilityLabel: label, accessibilityState: { checked: current, disabled: !!disabled }, "aria-checked": current, "aria-disabled": !!disabled, disabled: disabled, onPress: toggle, ...(web ? { onKeyDown: (event) => { if (event.key === ' ') {
24
24
  event.preventDefault();
25
25
  if (!event.repeat)
26
26
  toggle();
27
- } } } : null), style: { direction: env.direction, minHeight: 48, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: tokens.space.md, opacity: web && disabled ? 0.5 : 1 }, children: [_jsx(Text, { children: label }), _jsx(View, { pointerEvents: 'none', accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', "aria-hidden": web || undefined, style: web ? [{ width: 40, height: 24, borderRadius: 12, padding: 3, backgroundColor: track[current ? 'true' : 'false'] }, webEase] : undefined, children: web ? _jsx(View, { style: [{ width: 18, height: 18, borderRadius: 9, backgroundColor: current ? colors.onAction : colors.text, transform: [{ translateX: (current ? 16 : 0) * (env.direction === 'rtl' ? -1 : 1) }] }, webEase] }) : _jsx(RNSwitch, { value: current, disabled: disabled, onValueChange: next => { if (!disabled)
27
+ } } } : null), style: { direction: env.direction, minHeight: 48, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: tokens.space.md, opacity: web && disabled ? 0.5 : 1 }, children: [hideLabel ? null : _jsx(Text, { children: label }), _jsx(View, { pointerEvents: 'none', accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', "aria-hidden": web || undefined, style: web ? [{ width: 40, height: 24, borderRadius: 12, padding: 3, backgroundColor: track[current ? 'true' : 'false'] }, webEase] : undefined, children: web ? _jsx(View, { style: [{ width: 18, height: 18, borderRadius: 9, backgroundColor: current ? colors.onAction : colors.text, transform: [{ translateX: (current ? 16 : 0) * (env.direction === 'rtl' ? -1 : 1) }] }, webEase] }) : _jsx(RNSwitch, { value: current, disabled: disabled, onValueChange: next => { if (!disabled)
28
28
  set(next); }, trackColor: track, thumbColor: Platform.OS === 'android' ? colors.text : undefined, ios_backgroundColor: fills.raised }) })] });
29
29
  }
30
30
  export { SwitchRow } from './switch-row.js';
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type ScrollViewProps } from 'react-native';
2
3
  /** What the target does: close in profit, or cap the loss. */
3
4
  export type TargetKind = 'take-profit' | 'stop-loss';
4
5
  /** How the target is expressed: profit or loss in dollars, a price, or a share of the position. */
@@ -23,6 +24,8 @@ export interface TargetBlockLabels {
23
24
  custom: string;
24
25
  /** Accessible name of the info button that shows `note`: How this order fills. Without it the note is always shown. */
25
26
  info?: string;
27
+ /** Accessible name of the quick choices, not drawn: Quick targets. Defaults to `title`. */
28
+ presets?: string;
26
29
  }
27
30
  export interface TargetBlockProps {
28
31
  kind: TargetKind;
@@ -37,16 +40,18 @@ export interface TargetBlockProps {
37
40
  /** Price the order triggers at. Defaults to `value` when the unit is `price`; otherwise unknown until the host supplies it. */
38
41
  trigger?: number | null;
39
42
  unit: TargetUnit;
40
- /** Units offered, in order. Defaults to all three; one unit hides the control. */
41
- units?: readonly TargetUnit[];
43
+ /** Units offered, in order. Defaults to all three; one unit hides the control. `{unit, disabled}` shows a unit that cannot be chosen now, dimmed. */
44
+ units?: readonly (TargetUnit | TargetUnitOption)[];
42
45
  onUnitChange?: (unit: TargetUnit) => void;
43
46
  /** The target in the current unit: signed dollars (2, -0.5), a price, or a signed fraction (0.05 reads +5%). `null` reads as unknown and disables the confirming action. */
44
47
  value: number | null;
45
48
  onValueChange?: (value: number) => void;
46
- /** Quick choices in the current unit. The one equal to `value` is shown selected. */
47
- presets?: readonly number[];
49
+ /** Quick choices in the current unit. The one equal to `value` is shown selected. `{value, disabled}` shows a choice that cannot be taken now, dimmed. */
50
+ presets?: readonly (number | TargetPreset)[];
48
51
  /** Shows the Custom row; the host opens its own entry. */
49
52
  onCustom?: () => void;
53
+ /** The value the host's own entry set, in the current unit. The Custom row then shows it on its trailing edge and reads as selected, and no quick choice does. Has no effect without `onCustom`; null keeps the row a toggle that reads as not selected. */
54
+ customValue?: number | null;
50
55
  /** Format of prices. Defaults to US dollars. */
51
56
  priceOptions?: Intl.NumberFormatOptions;
52
57
  /** Set true to draw the prices inside a card: a surface fill, padding and radius. By default the title row, bar and readouts sit directly on the screen. */
@@ -59,11 +64,39 @@ export interface TargetBlockProps {
59
64
  onCancel?: () => void;
60
65
  /** Shows Back on the leading edge of the header. */
61
66
  onBack?: () => void;
62
- /** A control on the trailing edge of the header, usually an IconButton. It takes the place of the info button, and the note is then always shown. */
67
+ /** A control on the trailing edge of the header, usually an IconButton. It takes the place of the info button, and the note is then always shown, unless `headerActionBesideInfo` is set. */
63
68
  headerAction?: React.ReactNode;
69
+ /** Set true to keep the info button when `headerAction` is given: the info button comes first and `headerAction` sits on the trailing edge. */
70
+ headerActionBesideInfo?: boolean;
71
+ /** Sets `nativeID` on the title, so a sheet around the pane can name itself with `accessibilityLabelledBy` (Android). */
72
+ headingId?: string;
73
+ /** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container. */
74
+ stickyHeader?: boolean;
75
+ /** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill. */
76
+ stickyHeaderBackground?: string;
77
+ /** The scroll view used with `stickyHeader`, such as a sheet library's own. */
78
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
64
79
  testID?: string;
65
80
  }
66
- /** Number format of a target in a unit. Dollars and percents carry their sign; `short` drops the cents of a whole dollar amount, for a preset. */
81
+ /** A quick choice that can be shown dimmed. */
82
+ export interface TargetPreset {
83
+ value: number;
84
+ disabled?: boolean;
85
+ }
86
+ /** A unit that can be shown dimmed. */
87
+ export interface TargetUnitOption {
88
+ unit: TargetUnit;
89
+ disabled?: boolean;
90
+ }
91
+ /** The quick choices as `{value, disabled}`, whichever form the host gave. */
92
+ export declare function targetPresets(presets: readonly (number | TargetPreset)[]): TargetPreset[];
93
+ /** The units as `{unit, disabled}`, whichever form the host gave. */
94
+ export declare function targetUnits(units: readonly (TargetUnit | TargetUnitOption)[]): TargetUnitOption[];
95
+ /**
96
+ * Number format of a target in a unit. Dollars and percents carry their sign. `short` is a preset's value: a whole dollar amount
97
+ * or a whole price drops its fraction digits (`+$10`, `$63,000`), whatever fraction digits `priceOptions` fix, so a preset reads
98
+ * the same on web and native; a price formatted by significant digits keeps `priceOptions`.
99
+ */
67
100
  export declare function targetFormat(unit: TargetUnit, priceOptions?: Intl.NumberFormatOptions, short?: number): Intl.NumberFormatOptions;
68
101
  /**
69
102
  * Where each known price sits on the bar, as a fraction of its width from the low-price edge, the prices in price order, and
@@ -80,4 +113,4 @@ export declare function targetLayout({ entry, trigger }: {
80
113
  to: number;
81
114
  };
82
115
  /** A take profit or a stop loss on one position as a screen: the target as the headline figure, a price card whose bar shows how far the price is from the trigger, the unit, the host's quick choices, and the confirming action. The bar is decorative; each price reads its label and value. */
83
- export declare function TargetBlock({ kind, labels, position, orderType, note, entry, trigger, unit, units, onUnitChange, value, onValueChange, presets, onCustom, priceOptions, surface, onSubmit, submitDisabled, busy, onCancel, onBack, headerAction, testID }: TargetBlockProps): React.JSX.Element;
116
+ export declare function TargetBlock({ kind, labels, position, orderType, note, entry, trigger, unit, units, onUnitChange, value, onValueChange, presets, onCustom, customValue, priceOptions, surface, onSubmit, submitDisabled, busy, onCancel, onBack, headerAction, headerActionBesideInfo, headingId, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: TargetBlockProps): React.JSX.Element;
@@ -1,25 +1,37 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useState } from 'react';
3
3
  import { Pressable, View } from 'react-native';
4
- import { formatNumber } from '@bloxwap/hig/contracts';
5
- import { useColors, useFills, useHIG, useMessages } from './provider.js';
4
+ import { formatNumber } from './number-format.js';
5
+ import { useColors, useFills, useHIG, useMessages, useNumberLocale, usePresentNumber } from './provider.js';
6
+ import { StickyHeaderLayout } from './sticky-header.js';
6
7
  import { Surface, Text } from './surface.js';
8
+ import { barFillOpacity } from './bar-mark.js';
7
9
  import { Button, IconButton } from './button.js';
8
10
  import { SegmentedControl } from './radio-group.js';
11
+ import { PresetGroup } from './preset-group.js';
9
12
  import { ChevronIcon, SeverityIcon } from './icons.js';
10
13
  import { AnimatedNumberReadout } from './animated-number.js';
11
14
  import { formatNumberReadout } from './animated-number-model.js';
15
+ /** The quick choices as `{value, disabled}`, whichever form the host gave. */
16
+ export function targetPresets(presets) { return presets.map(preset => typeof preset === 'number' ? { value: preset } : preset); }
17
+ /** The units as `{unit, disabled}`, whichever form the host gave. */
18
+ export function targetUnits(units) { return units.map(unit => typeof unit === 'string' ? { unit } : unit); }
12
19
  const usd = { style: 'currency', currency: 'USD' };
13
20
  const allUnits = ['dollar', 'price', 'percent'];
14
21
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
15
22
  const known = (value) => value != null && Number.isFinite(value);
16
- /** Number format of a target in a unit. Dollars and percents carry their sign; `short` drops the cents of a whole dollar amount, for a preset. */
23
+ /**
24
+ * Number format of a target in a unit. Dollars and percents carry their sign. `short` is a preset's value: a whole dollar amount
25
+ * or a whole price drops its fraction digits (`+$10`, `$63,000`), whatever fraction digits `priceOptions` fix, so a preset reads
26
+ * the same on web and native; a price formatted by significant digits keeps `priceOptions`.
27
+ */
17
28
  export function targetFormat(unit, priceOptions = usd, short) {
29
+ const whole = short !== undefined && Number.isInteger(short);
18
30
  if (unit === 'price')
19
- return priceOptions;
31
+ return whole && priceOptions.minimumSignificantDigits === undefined && priceOptions.maximumSignificantDigits === undefined ? { ...priceOptions, minimumFractionDigits: 0, maximumFractionDigits: 0 } : priceOptions;
20
32
  if (unit === 'percent')
21
33
  return { style: 'percent', maximumFractionDigits: 2, signDisplay: 'exceptZero' };
22
- return { ...usd, signDisplay: 'exceptZero', ...(short !== undefined && Number.isInteger(short) ? { maximumFractionDigits: 0 } : null) };
34
+ return { ...usd, signDisplay: 'exceptZero', ...(whole ? { maximumFractionDigits: 0 } : null) };
23
35
  }
24
36
  /**
25
37
  * Where each known price sits on the bar, as a fraction of its width from the low-price edge, the prices in price order, and
@@ -45,17 +57,25 @@ export function targetLayout({ entry, trigger }) {
45
57
  return start === undefined || end === undefined ? { positions, order, from: 0.5, to: 0.5 } : { positions, order, from: Math.min(start, end), to: Math.max(start, end) };
46
58
  }
47
59
  /** A take profit or a stop loss on one position as a screen: the target as the headline figure, a price card whose bar shows how far the price is from the trigger, the unit, the host's quick choices, and the confirming action. The bar is decorative; each price reads its label and value. */
48
- export function TargetBlock({ kind, labels, position, orderType, note, entry, trigger, unit, units = allUnits, onUnitChange, value, onValueChange, presets = [], onCustom, priceOptions = usd, surface = false, onSubmit, submitDisabled, busy, onCancel, onBack, headerAction, testID }) {
60
+ export function TargetBlock({ kind, labels, position, orderType, note, entry, trigger, unit, units = allUnits, onUnitChange, value, onValueChange, presets = [], onCustom, customValue, priceOptions = usd, surface = false, onSubmit, submitDisabled, busy, onCancel, onBack, headerAction, headerActionBesideInfo, headingId, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
49
61
  const PriceCard = surface ? Surface : View;
50
- const colors = useColors(), fills = useFills(), t = useMessages(), { direction, locale } = useHIG();
62
+ const colors = useColors(), fills = useFills(), t = useMessages(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
51
63
  const [open, setOpen] = useState(false);
52
- const info = note && labels.info && !headerAction ? labels.info : undefined;
64
+ const info = note && labels.info && (!headerAction || headerActionBesideInfo) ? labels.info : undefined;
65
+ // With the info button beside a host control, both header sides widen together so the title stays centred.
66
+ const pair = !!info && headerAction != null, side = pair ? 92 : 44;
67
+ const custom = onCustom && known(customValue) ? customValue : null, customText = custom === null ? null : formatNumber(custom, locale, present(targetFormat(unit, priceOptions)));
53
68
  const target = trigger !== undefined ? trigger : unit === 'price' ? value : null;
54
69
  const { positions, order, from, to } = targetLayout({ entry, trigger: target });
55
70
  const prices = { entry, trigger: target };
56
- const stop = kind === 'stop-loss', tone = stop ? colors.negative : colors.positive, intent = stop ? 'destructive' : 'primary';
71
+ const stop = kind === 'stop-loss', tone = stop ? colors.negative : colors.positive, intent = stop ? 'destructive' : 'primary', onFill = stop ? colors.background : colors.onAction;
57
72
  const triggerLeads = (positions.trigger ?? 0) < (positions.entry ?? 0);
58
73
  const align = (index) => order.length > 1 && index === order.length - 1 ? 'flex-end' : order.length === 3 && index === 1 ? 'center' : 'flex-start';
59
74
  const part = (grow) => ({ flexGrow: grow, flexShrink: 1, flexBasis: 0, backgroundColor: fills.raised });
60
- return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsxs(View, { testID: 'target-header', 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: 'target-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'target-title', 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: info ? _jsx(IconButton, { intent: 'ghost', label: info, suppressFeedback: true, testID: 'target-info', accessibilityState: { expanded: open }, onPress: () => setOpen(!open), children: _jsx(SeverityIcon, { kind: 'info', color: colors.text }) }) : headerAction })] }), _jsx(View, { style: { alignItems: 'center', marginTop: 16 }, children: _jsx(AnimatedNumberReadout, { testID: 'target-amount', value: value, options: targetFormat(unit, priceOptions), style: { fontSize: 44, lineHeight: 50, fontWeight: '700', letterSpacing: -0.9, textAlign: 'center' } }) }), note && !info ? _jsx(Text, { testID: 'target-note', style: { color: colors.muted, fontSize: 14, lineHeight: 21, textAlign: 'center', marginTop: 16 }, children: note }) : null, _jsxs(PriceCard, { testID: 'target-prices', style: { gap: 12, marginTop: 16, minWidth: 0 }, children: [position || orderType ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [position ? _jsx(Text, { testID: 'target-position', accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: position }) : _jsx(View, {}), orderType ? _jsx(Text, { testID: 'target-order-type', style: { color: colors.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: orderType }) : null] }) : null, _jsxs(View, { ...hidden, testID: 'target-bar', style: { flexDirection: 'row', height: 24, borderRadius: 8, overflow: 'hidden' }, children: [_jsx(View, { style: part(from) }), to > from ? _jsx(View, { testID: 'target-move', style: { flexGrow: to - from, flexShrink: 1, flexBasis: 0, minWidth: 6, backgroundColor: tone, borderStartWidth: 3, borderEndWidth: 3, borderStartColor: triggerLeads ? tone : colors.text, borderEndColor: triggerLeads ? colors.text : tone } }) : null, _jsx(View, { style: part(1 - to) })] }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'space-between', gap: 12 }, children: order.map((price, index) => _jsxs(View, { accessible: true, accessibilityLabel: `${labels[price]}, ${formatNumberReadout(prices[price], locale, priceOptions).text}`, testID: `target-${price}`, style: { alignItems: align(index), flexShrink: 1, minWidth: 0 }, children: [_jsx(View, { ...hidden, children: _jsx(AnimatedNumberReadout, { value: prices[price], options: priceOptions, tone: price === 'trigger' ? (stop ? 'negative' : 'positive') : 'text', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { color: colors.muted, fontSize: 12, lineHeight: 16 }, children: labels[price] })] }, price)) })] }), units.length > 1 ? _jsx(View, { testID: 'target-units', style: { marginTop: 16 }, children: _jsx(SegmentedControl, { label: labels.unit, options: units.map(option => ({ value: option, label: labels.units[option] })), value: unit, onValueChange: next => onUnitChange?.(next) }) }) : null, onCustom ? _jsxs(Pressable, { testID: 'target-custom', accessibilityRole: 'button', onPress: onCustom, style: ({ pressed }) => ({ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 48, paddingHorizontal: 16, borderRadius: 9999, backgroundColor: pressed ? fills.raised : fills.well, marginTop: 16 }), children: [_jsx(Text, { numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: labels.custom }), _jsx(View, { ...hidden, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }) : null, presets.length > 0 ? _jsx(View, { testID: 'target-presets', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: presets.map(preset => _jsx(Button, { testID: `target-preset-${preset}`, intent: preset === value ? intent : 'secondary', accessibilityState: { selected: preset === value }, onPress: () => onValueChange?.(preset), style: { flex: 1, alignSelf: 'auto', paddingHorizontal: 8 }, children: formatNumber(preset, locale, targetFormat(unit, priceOptions, preset)) }, preset)) }) : null, info && open ? _jsx(Pressable, { testID: 'target-popover-dismiss', ...hidden, onPress: () => setOpen(false), style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, zIndex: 1 } }) : null, info && open ? _jsx(View, { testID: 'target-popover', accessibilityLiveRegion: 'polite', style: { position: 'absolute', top: 64, ...(direction === 'rtl' ? { left: 16 } : { right: 16 }), maxWidth: 280, zIndex: 2, padding: 12, borderRadius: 14, backgroundColor: colors.nested }, children: _jsx(Text, { testID: 'target-note', style: { color: colors.text, fontSize: 14, lineHeight: 21 }, children: note }) }) : null, _jsxs(View, { testID: 'target-actions', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: [onCancel ? _jsx(Button, { testID: 'target-cancel', intent: 'secondary', onPress: onCancel, style: { flex: 1, alignSelf: 'auto' }, children: labels.cancel ?? t.cancel }) : null, _jsx(Button, { testID: 'target-submit', intent: intent, disabled: submitDisabled ?? value === null, busy: busy, onPress: onSubmit, style: { flex: 1, alignSelf: 'auto' }, children: labels.submit })] })] });
75
+ const sticky = !!stickyHeader;
76
+ const header = _jsxs(View, { testID: 'target-header', style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: side, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: 'target-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'target-title', nativeID: headingId, 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: side, alignItems: 'flex-end' }, children: info ? (() => { const button = _jsx(IconButton, { intent: 'ghost', label: info, suppressFeedback: true, testID: 'target-info', accessibilityState: { expanded: open }, onPress: () => setOpen(!open), children: _jsx(SeverityIcon, { kind: 'info', color: colors.text }) }); return pair ? _jsxs(View, { testID: 'target-header-actions', style: { direction, flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [button, headerAction] }) : button; })() : headerAction })] });
77
+ const body = _jsxs(_Fragment, { children: [_jsx(View, { style: { alignItems: 'center', marginTop: 16 }, children: _jsx(AnimatedNumberReadout, { testID: 'target-amount', value: value, options: targetFormat(unit, priceOptions), style: { fontSize: 44, lineHeight: 50, fontWeight: '700', letterSpacing: -0.9, textAlign: 'center' } }) }), note && !info ? _jsx(Text, { testID: 'target-note', style: { color: colors.muted, fontSize: 14, lineHeight: 21, textAlign: 'center', marginTop: 16 }, children: note }) : null, _jsxs(PriceCard, { testID: 'target-prices', style: { gap: 12, marginTop: 16, minWidth: 0 }, children: [position || orderType ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [position ? _jsx(Text, { testID: 'target-position', accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: position }) : _jsx(View, {}), orderType ? _jsx(Text, { testID: 'target-order-type', style: { color: colors.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: orderType }) : null] }) : null, _jsxs(View, { ...hidden, testID: 'target-bar', style: { flexDirection: 'row', height: 24, borderRadius: 8, overflow: 'hidden' }, children: [_jsx(View, { style: part(from) }), to > from ? _jsx(View, { testID: 'target-move', style: { flexGrow: to - from, flexShrink: 1, flexBasis: 0, minWidth: 6, borderStartWidth: 3, borderEndWidth: 3, borderStartColor: triggerLeads ? tone : colors.text, borderEndColor: triggerLeads ? colors.text : tone }, children: _jsx(View, { testID: 'target-fill', style: { flex: 1, backgroundColor: tone, opacity: barFillOpacity } }) }) : null, _jsx(View, { style: part(1 - to) })] }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'space-between', gap: 12 }, children: order.map((price, index) => _jsxs(View, { accessible: true, accessibilityLabel: `${labels[price]}, ${formatNumberReadout(prices[price], locale, present(priceOptions)).text}`, testID: `target-${price}`, style: { alignItems: align(index), flexShrink: 1, minWidth: 0 }, children: [_jsx(View, { ...hidden, children: _jsx(AnimatedNumberReadout, { value: prices[price], options: priceOptions, tone: price === 'trigger' ? (stop ? 'negative' : 'positive') : 'text', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { color: colors.muted, fontSize: 12, lineHeight: 16 }, children: labels[price] })] }, price)) })] }), units.length > 1 ? _jsx(View, { testID: 'target-units', style: { marginTop: 16 }, children: _jsx(SegmentedControl, { label: labels.unit, options: targetUnits(units).map(option => ({ value: option.unit, label: labels.units[option.unit], disabled: option.disabled })), value: unit, onValueChange: next => onUnitChange?.(next) }) }) : null, onCustom && customText === null ? _jsxs(Pressable, { testID: 'target-custom', accessibilityRole: 'button', accessibilityState: customValue !== undefined ? { selected: false } : undefined, onPress: onCustom, style: ({ pressed }) => ({ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 48, paddingHorizontal: 16, borderRadius: 9999, backgroundColor: pressed ? fills.raised : fills.well, marginTop: 16 }), children: [_jsx(Text, { numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: labels.custom }), _jsx(View, { ...hidden, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }) : null, onCustom && customText !== null ? _jsxs(Pressable, { testID: 'target-custom', accessibilityRole: 'button', accessibilityLabel: `${labels.custom}, ${customText}`, accessibilityState: { selected: true }, onPress: onCustom, style: ({ pressed }) => ({ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 48, paddingHorizontal: 16, borderRadius: 9999, backgroundColor: stop ? colors.negative : colors.action, opacity: pressed ? 0.9 : 1, marginTop: 16 }), children: [_jsx(Text, { ...hidden, numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '600', color: onFill }, children: labels.custom }), _jsxs(View, { ...hidden, style: { direction, flexDirection: 'row', alignItems: 'center', gap: 6, flexShrink: 1 }, children: [_jsx(Text, { testID: 'target-custom-value', numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '500', color: onFill }, children: customText }), _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: onFill }) })] })] }) : null, presets.length > 0 ? _jsx(PresetGroup, { testID: 'target-presets', label: labels.presets ?? labels.title, selectedIntent: intent, options: targetPresets(presets).map(({ value: preset, disabled }) => ({ value: preset, disabled, testID: `target-preset-${preset}`, label: formatNumber(preset, locale, present(targetFormat(unit, priceOptions, preset))) })), value: custom === null ? value : null, onValueChange: next => onValueChange?.(next), style: { marginTop: 16 } }) : null, info && open ? _jsx(Pressable, { testID: 'target-popover-dismiss', ...hidden, onPress: () => setOpen(false), style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, zIndex: 1 } }) : null, info && open ? _jsx(View, { testID: 'target-popover', accessibilityLiveRegion: 'polite', style: { position: 'absolute', top: sticky ? 4 : 64, ...(direction === 'rtl' ? { left: 16 } : { right: 16 }), maxWidth: 280, zIndex: 2, padding: 12, borderRadius: 14, backgroundColor: colors.nested }, children: _jsx(Text, { testID: 'target-note', style: { color: colors.text, fontSize: 14, lineHeight: 21 }, children: note }) }) : null, _jsxs(View, { testID: 'target-actions', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: [onCancel ? _jsx(Button, { testID: 'target-cancel', intent: 'secondary', onPress: onCancel, style: { flex: 1, alignSelf: 'auto' }, children: labels.cancel ?? t.cancel }) : null, _jsx(Button, { testID: 'target-submit', intent: intent, disabled: !!submitDisabled || !known(value) || (unit === 'price' && value <= 0), busy: busy, onPress: onSubmit, style: { flex: 1, alignSelf: 'auto' }, children: labels.submit })] })] });
78
+ if (sticky)
79
+ return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'target-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
80
+ return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
61
81
  }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import { type ToastBaseOptions, type ToastCall, type ToastId, type ToastPosition, type ToastSwipeDirection } from '@bloxwap/hig/contracts/toast';
3
+ export type { ToastBaseOptions, ToastCall, ToastId, ToastPosition, ToastSeverity, ToastSwipeDirection } from '@bloxwap/hig/contracts/toast';
4
+ export interface ToastOptions extends ToastBaseOptions {
5
+ action?: React.ReactNode;
6
+ }
7
+ export interface ToasterProps {
8
+ /** The corner or edge the stack hangs from. Default `bottom-center`, as on web. `left` and `right` are the physical sides in either direction, as in Sonner; only the capsule's content mirrors under right-to-left. */
9
+ position?: ToastPosition;
10
+ /** Draws the visible notices one after another instead of as a collapsed stack. Default `false`. A finger resting on a notice for 200ms expands the stack until it lifts, and a running screen reader keeps it expanded so every notice can be reached. */
11
+ expand?: boolean;
12
+ /** Notices drawn at once; older ones wait behind them and their time does not run. Default 3; anything below 1 or not a number shows one. */
13
+ visibleToasts?: number;
14
+ /** Points between notices when expanded, and how far each notice behind the front peeks out when collapsed. Default 14. */
15
+ gap?: number;
16
+ /** Points between the stack and the screen edges, added to the safe-area insets: one number for every edge, or an object naming edges, the others keeping the default. Default 16 on a window narrower than 600 points and 24 otherwise. `left` and `right` are the physical sides, like `position`. */
17
+ offset?: number | {
18
+ top?: number;
19
+ right?: number;
20
+ bottom?: number;
21
+ left?: number;
22
+ };
23
+ /** Milliseconds a notice stays when `toast()` names no `duration`. Default 4000, which also stands in for a value that is not a positive number. */
24
+ duration?: number;
25
+ /** Directions a swipe dismisses in. Default: towards the edges the stack sits against (`bottom-center` → down; `top-right` → up and right). */
26
+ swipeDirections?: readonly ToastSwipeDirection[];
27
+ /** Prefix of the test IDs: `<testID>` on the layer and `<testID>-toast` on each notice. */
28
+ testID?: string;
29
+ }
30
+ /** Dismisses one notice by id, or every notice when the id is omitted. */
31
+ export declare function dismissToast(id?: ToastId): void;
32
+ /**
33
+ * Raises a transient HIG capsule on the mounted `Toaster` and returns its id. Callable from anywhere. `toast.success`,
34
+ * `toast.error`, `toast.warning` and `toast.info` set the severity; `toast.dismiss` is `dismissToast`. The same call,
35
+ * options and names work in `@bloxwap/hig/react/toast`.
36
+ */
37
+ export declare const toast: ToastCall<ToastOptions>;
38
+ /**
39
+ * The host for transient HIG notices on native. Mount it once, last inside the root view, within HIGProvider,
40
+ * GestureHandlerRootView and SafeAreaProvider; `toast()` then works from anywhere. It draws the same capsule as `Toast`,
41
+ * stacked the way Sonner stacks on web: the newest in front, up to three visible, each leaving after its time, by its
42
+ * close control or by a swipe. A touch holds every notice's time and so does the app going to the background.
43
+ *
44
+ * Reanimated moves the notices and Gesture Handler reads the finger, both on the UI thread; only transforms and opacity
45
+ * change while anything moves. With no notice showing it renders nothing.
46
+ */
47
+ export declare function Toaster({ position, expand, visibleToasts, gap, offset, duration, swipeDirections, testID }: ToasterProps): React.JSX.Element | null;