@bloxwap/hig 0.7.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (272) 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 +29 -2
  31. package/contracts/dist/index.js +123 -4
  32. package/contracts/dist/invariants.d.ts +17 -0
  33. package/contracts/dist/invariants.js +24 -0
  34. package/contracts/dist/login.d.ts +34 -0
  35. package/contracts/dist/login.js +43 -0
  36. package/contracts/dist/messages.d.ts +57 -3
  37. package/contracts/dist/messages.js +20 -2
  38. package/contracts/dist/number-flow.d.ts +90 -0
  39. package/contracts/dist/number-flow.js +150 -0
  40. package/contracts/dist/qr.d.ts +151 -0
  41. package/contracts/dist/qr.js +581 -0
  42. package/contracts/dist/toast.d.ts +168 -0
  43. package/contracts/dist/toast.js +171 -0
  44. package/feedback/README.md +1 -1
  45. package/feedback/dist/contract.js +1 -1
  46. package/feedback/dist/react.js +2 -4
  47. package/native/README.md +6 -1
  48. package/native/dist/account-block.d.ts +10 -1
  49. package/native/dist/account-block.js +17 -7
  50. package/native/dist/animated-number-model.d.ts +41 -1
  51. package/native/dist/animated-number-model.js +201 -23
  52. package/native/dist/animated-number.d.ts +39 -1
  53. package/native/dist/animated-number.js +164 -17
  54. package/native/dist/announce.d.ts +2 -0
  55. package/native/dist/announce.js +10 -0
  56. package/native/dist/asset-balance-row.d.ts +3 -1
  57. package/native/dist/asset-balance-row.js +15 -4
  58. package/native/dist/assets-block.d.ts +115 -0
  59. package/native/dist/assets-block.js +87 -0
  60. package/native/dist/async-result.d.ts +2 -0
  61. package/native/dist/async-result.js +11 -0
  62. package/native/dist/avatar-frame.d.ts +29 -0
  63. package/native/dist/avatar-frame.js +56 -0
  64. package/native/dist/avatar.d.ts +21 -0
  65. package/native/dist/avatar.js +31 -0
  66. package/native/dist/bar-mark.d.ts +2 -0
  67. package/native/dist/bar-mark.js +4 -2
  68. package/native/dist/bar-pnl.js +2 -1
  69. package/native/dist/blocks.d.ts +9 -2
  70. package/native/dist/blocks.js +8 -1
  71. package/native/dist/brand.js +2 -1
  72. package/native/dist/button.d.ts +7 -2
  73. package/native/dist/button.js +13 -3
  74. package/native/dist/checkbox.js +2 -1
  75. package/native/dist/confetti.d.ts +33 -0
  76. package/native/dist/confetti.js +143 -0
  77. package/native/dist/confirm-block.d.ts +98 -0
  78. package/native/dist/confirm-block.js +48 -0
  79. package/native/dist/data.d.ts +1 -1
  80. package/native/dist/data.js +5 -1
  81. package/native/dist/deposit-block.d.ts +19 -0
  82. package/native/dist/deposit-block.js +17 -0
  83. package/native/dist/explainer-block.d.ts +91 -0
  84. package/native/dist/explainer-block.js +34 -0
  85. package/native/dist/field.d.ts +5 -1
  86. package/native/dist/field.js +27 -6
  87. package/native/dist/gesture-sheet-model.d.ts +50 -0
  88. package/native/dist/gesture-sheet-model.js +105 -0
  89. package/native/dist/gesture-sheet-next.d.ts +82 -0
  90. package/native/dist/gesture-sheet-next.js +315 -0
  91. package/native/dist/gesture-sheet.d.ts +5 -1
  92. package/native/dist/gesture-sheet.js +13 -6
  93. package/native/dist/icons.d.ts +9 -6
  94. package/native/dist/icons.js +25 -24
  95. package/native/dist/language-block.d.ts +10 -1
  96. package/native/dist/language-block.js +11 -4
  97. package/native/dist/list-group.d.ts +3 -1
  98. package/native/dist/list-group.js +26 -13
  99. package/native/dist/login-block.d.ts +4 -0
  100. package/native/dist/login-block.js +22 -0
  101. package/native/dist/manage-position-block.d.ts +8 -1
  102. package/native/dist/manage-position-block.js +7 -2
  103. package/native/dist/market-row.js +19 -8
  104. package/native/dist/navigation.js +5 -3
  105. package/native/dist/number-format.d.ts +6 -0
  106. package/native/dist/number-format.js +9 -0
  107. package/native/dist/pickers.d.ts +8 -0
  108. package/native/dist/pickers.js +3 -3
  109. package/native/dist/position-block.d.ts +5 -5
  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 +10 -1
  115. package/native/dist/profile-block.js +8 -3
  116. package/native/dist/provider.d.ts +5 -2
  117. package/native/dist/provider.js +27 -5
  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 +19 -7
  121. package/native/dist/radio-group.js +39 -10
  122. package/native/dist/reward-block.d.ts +10 -7
  123. package/native/dist/reward-block.js +9 -4
  124. package/native/dist/screen-header.d.ts +13 -3
  125. package/native/dist/screen-header.js +12 -4
  126. package/native/dist/select.js +4 -2
  127. package/native/dist/selection.d.ts +2 -1
  128. package/native/dist/selection.js +1 -0
  129. package/native/dist/setting-switch.d.ts +1 -1
  130. package/native/dist/setting-switch.js +7 -3
  131. package/native/dist/slider.js +5 -1
  132. package/native/dist/sound-haptics-block.js +1 -1
  133. package/native/dist/status.d.ts +41 -9
  134. package/native/dist/status.js +34 -17
  135. package/native/dist/sticky-header.js +9 -1
  136. package/native/dist/swap-amount-card.d.ts +57 -0
  137. package/native/dist/swap-amount-card.js +31 -0
  138. package/native/dist/{swap-panel-block.d.ts → swap-block.d.ts} +18 -8
  139. package/native/dist/{swap-panel-block.js → swap-block.js} +63 -35
  140. package/native/dist/swap-parts.d.ts +3 -10
  141. package/native/dist/swap-parts.js +22 -24
  142. package/native/dist/swap-shared.d.ts +2 -2
  143. package/native/dist/swap-shared.js +10 -6
  144. package/native/dist/swap-sheet.d.ts +3 -3
  145. package/native/dist/swap-sheet.js +3 -3
  146. package/native/dist/swap-views.js +1 -1
  147. package/native/dist/target-block.d.ts +7 -1
  148. package/native/dist/target-block.js +13 -6
  149. package/native/dist/toast.d.ts +47 -0
  150. package/native/dist/toast.js +386 -0
  151. package/native/dist/token-action-block.d.ts +11 -2
  152. package/native/dist/token-action-block.js +10 -4
  153. package/native/dist/trade-history-list-block.js +7 -4
  154. package/native/dist/wallet-address-core.js +6 -3
  155. package/native-fonts/README.md +1 -1
  156. package/og-fonts/README.md +1 -1
  157. package/package.json +155 -11
  158. package/react/README.md +3 -1
  159. package/react/dist/animated-number-flow.d.ts +72 -0
  160. package/react/dist/animated-number-flow.js +316 -0
  161. package/react/dist/animated-number-model.d.ts +18 -0
  162. package/react/dist/animated-number-model.js +75 -5
  163. package/react/dist/animated-number.d.ts +45 -1
  164. package/react/dist/animated-number.js +137 -6
  165. package/react/dist/asset-balance-row.d.ts +3 -1
  166. package/react/dist/asset-balance-row.js +10 -4
  167. package/react/dist/async-result.d.ts +2 -0
  168. package/react/dist/async-result.js +11 -0
  169. package/react/dist/avatar.d.ts +25 -0
  170. package/react/dist/avatar.js +50 -0
  171. package/react/dist/blocks/account-block.d.ts +5 -1
  172. package/react/dist/blocks/account-block.js +11 -6
  173. package/react/dist/blocks/assets-block.d.ts +106 -0
  174. package/react/dist/blocks/assets-block.js +135 -0
  175. package/react/dist/blocks/confirm-block.d.ts +91 -0
  176. package/react/dist/blocks/confirm-block.js +31 -0
  177. package/react/dist/blocks/deposit-block.d.ts +19 -0
  178. package/react/dist/blocks/deposit-block.js +15 -0
  179. package/react/dist/blocks/explainer-block.d.ts +80 -0
  180. package/react/dist/blocks/explainer-block.js +20 -0
  181. package/react/dist/blocks/install-command.js +3 -1
  182. package/react/dist/blocks/language-block.d.ts +5 -1
  183. package/react/dist/blocks/language-block.js +4 -3
  184. package/react/dist/blocks/login-block.d.ts +4 -0
  185. package/react/dist/blocks/login-block.js +14 -0
  186. package/react/dist/blocks/manage-position-block.d.ts +3 -1
  187. package/react/dist/blocks/manage-position-block.js +2 -2
  188. package/react/dist/blocks/market-row.js +8 -3
  189. package/react/dist/blocks/notifications-block.d.ts +3 -1
  190. package/react/dist/blocks/notifications-block.js +2 -2
  191. package/react/dist/blocks/pickers.d.ts +9 -0
  192. package/react/dist/blocks/pickers.js +4 -2
  193. package/react/dist/blocks/position-block.d.ts +3 -3
  194. package/react/dist/blocks/preset-picker-block.d.ts +85 -0
  195. package/react/dist/blocks/preset-picker-block.js +19 -0
  196. package/react/dist/blocks/profile-block.d.ts +5 -1
  197. package/react/dist/blocks/profile-block.js +12 -13
  198. package/react/dist/blocks/reward-block.d.ts +13 -8
  199. package/react/dist/blocks/reward-block.js +7 -4
  200. package/react/dist/blocks/screen-header.d.ts +10 -2
  201. package/react/dist/blocks/screen-header.js +7 -4
  202. package/react/dist/blocks/setting-switch.js +6 -3
  203. package/react/dist/blocks/signals-block.d.ts +3 -1
  204. package/react/dist/blocks/signals-block.js +4 -3
  205. package/react/dist/blocks/sound-haptics-block.d.ts +3 -1
  206. package/react/dist/blocks/sound-haptics-block.js +2 -2
  207. package/react/dist/blocks/sticky-header.d.ts +14 -4
  208. package/react/dist/blocks/sticky-header.js +68 -8
  209. package/react/dist/blocks/swap/settings.js +2 -1
  210. package/react/dist/blocks/swap/shared.d.ts +22 -22
  211. package/react/dist/blocks/swap/shared.js +30 -28
  212. package/react/dist/blocks/{swap-panel-block.d.ts → swap-block.d.ts} +19 -8
  213. package/react/dist/blocks/swap-block.js +215 -0
  214. package/react/dist/blocks/swap-sheet.d.ts +3 -3
  215. package/react/dist/blocks/swap-sheet.js +3 -3
  216. package/react/dist/blocks/target-block.d.ts +7 -1
  217. package/react/dist/blocks/target-block.js +10 -4
  218. package/react/dist/blocks/token-action-block.d.ts +6 -2
  219. package/react/dist/blocks/token-action-block.js +3 -2
  220. package/react/dist/blocks/trade-history-detail-block.d.ts +3 -1
  221. package/react/dist/blocks/trade-history-detail-block.js +2 -2
  222. package/react/dist/blocks/trade-history-list-block.d.ts +3 -1
  223. package/react/dist/blocks/trade-history-list-block.js +7 -4
  224. package/react/dist/blocks.d.ts +8 -2
  225. package/react/dist/blocks.js +7 -1
  226. package/react/dist/brand.js +2 -1
  227. package/react/dist/button.d.ts +9 -3
  228. package/react/dist/button.js +8 -3
  229. package/react/dist/confetti.d.ts +27 -0
  230. package/react/dist/confetti.js +240 -0
  231. package/react/dist/data.js +8 -1
  232. package/react/dist/field.d.ts +6 -1
  233. package/react/dist/field.js +18 -9
  234. package/react/dist/gesture-sheet.d.ts +15 -1
  235. package/react/dist/gesture-sheet.js +53 -8
  236. package/react/dist/list-group.js +11 -7
  237. package/react/dist/navigation.js +11 -3
  238. package/react/dist/overlay.d.ts +1 -4
  239. package/react/dist/overlay.js +1 -3
  240. package/react/dist/popover.d.ts +30 -0
  241. package/react/dist/popover.js +34 -0
  242. package/react/dist/preset-group.d.ts +30 -0
  243. package/react/dist/preset-group.js +13 -0
  244. package/react/dist/provider.d.ts +2 -2
  245. package/react/dist/provider.js +23 -6
  246. package/react/dist/qr-code.d.ts +32 -0
  247. package/react/dist/qr-code.js +28 -0
  248. package/react/dist/select.js +10 -3
  249. package/react/dist/selection.d.ts +13 -5
  250. package/react/dist/selection.js +13 -8
  251. package/react/dist/slider.js +5 -1
  252. package/react/dist/status.d.ts +14 -10
  253. package/react/dist/status.js +17 -9
  254. package/react/dist/styles.css +260 -165
  255. package/react/dist/toast.d.ts +19 -12
  256. package/react/dist/toast.js +29 -7
  257. package/react/dist/wallet-address-core.d.ts +8 -4
  258. package/react/dist/wallet-address-core.js +10 -5
  259. package/tokens/README.md +2 -2
  260. package/tokens/assets/onramps/apple-pay.svg +33 -0
  261. package/tokens/assets/onramps/bank.svg +98 -0
  262. package/tokens/assets/onramps/blink.svg +37 -0
  263. package/tokens/assets/onramps/cashapp.svg +33 -0
  264. package/tokens/assets/onramps/crypto.svg +121 -0
  265. package/tokens/assets/onramps/exchange.svg +105 -0
  266. package/tokens/dist/deposit-icons.d.ts +1 -0
  267. package/tokens/dist/deposit-icons.js +28 -0
  268. package/tokens/dist/index.d.ts +16 -0
  269. package/tokens/dist/index.js +16 -0
  270. package/tokens/dist/manifest.json +8 -0
  271. package/tokens/dist/tokens.css +6 -0
  272. package/react/dist/blocks/swap-panel-block.js +0 -178
@@ -1,4 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check } from '@bloxwap/icons/native/check';
3
+ import { useState } from 'react';
2
4
  import { Image, Pressable, View } from 'react-native';
3
5
  import { useColors, useFills, useNumberLocale, usePresentNumber } from './provider.js';
4
6
  import { Text } from './surface.js';
@@ -10,17 +12,26 @@ const units = { maximumFractionDigits: 6 };
10
12
  const avatar = 40;
11
13
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
12
14
  /** One holding as a capsule row: a round avatar, the asset's name over its symbol, and its dollar value over its units. The avatar is padded equally on every side, so the capsule end is concentric with it, and both numbers update place by place. */
13
- export function AssetBalanceRow({ name, symbol, icon, value, balance, balanceOptions = units, unitsSuffix, headline = 'value', amounts = true, tag, trailing, trailingLabel, selected, disabled, onSelect, testID }) {
15
+ export function AssetBalanceRow({ name, symbol, icon, value, balance, balanceOptions = units, unitsSuffix, headline = 'value', amounts = true, tag, trailing, trailingLabel, trailingInteractive, selected, disabled, onSelect, testID }) {
14
16
  const colors = useColors(), fills = useFills(), locale = useNumberLocale(), present = usePresentNumber();
17
+ const [held, setHeld] = useState(false);
18
+ const split = !!trailingInteractive && trailing != null && trailing !== false;
15
19
  const unitsFirst = headline === 'units', hasUnits = amounts && !unitsFirst && balance !== undefined;
16
20
  const unitsText = () => formatNumberReadout(balance, locale, balanceOptions, undefined, undefined, unitsSuffix).text;
17
21
  const headlineText = amounts ? unitsFirst ? unitsText() : formatNumberReadout(value, locale, present(usd)).text : null;
18
- const label = [name, symbol, headlineText, hasUnits ? unitsText() : null, tag || null, trailingLabel ?? (trailing != null && trailing !== false ? plainText(trailing) : null)].filter(Boolean).join(', ');
22
+ const label = [name, symbol, headlineText, hasUnits ? unitsText() : null, tag || null, split ? null : trailingLabel ?? (trailing != null && trailing !== false ? plainText(trailing) : null)].filter(Boolean).join(', ');
19
23
  const state = selected || disabled ? { ...(selected ? { selected: true } : {}), ...(disabled ? { disabled: true } : {}) } : undefined;
20
24
  const strong = disabled ? colors.muted : colors.text;
21
25
  const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
22
26
  const art = typeof icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: icon }, style: shape }) : _jsx(View, { style: shape, children: icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: symbol.slice(0, 3) }) });
23
27
  const row = (pressed) => ({ flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 56, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 28, backgroundColor: pressed && !disabled ? fills.raised : fills.well });
24
- const content = _jsxs(_Fragment, { children: [_jsx(View, { ...hidden, style: disabled ? { opacity: 0.5 } : undefined, children: art }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: strong }, children: name }), _jsx(Text, { numberOfLines: 1, style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: symbol })] }), amounts || tag ? _jsxs(View, { ...hidden, style: { alignItems: 'flex-end', justifyContent: 'center' }, children: [amounts ? unitsFirst ? _jsx(AnimatedNumberReadout, { value: balance, options: balanceOptions, suffix: unitsSuffix, tone: disabled ? 'muted' : undefined, testID: testID ? `${testID}-balance` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) : _jsx(AnimatedNumberReadout, { value: value, options: usd, tone: disabled ? 'muted' : undefined, testID: testID ? `${testID}-value` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) : null, hasUnits ? _jsx(AnimatedNumberReadout, { value: balance, options: balanceOptions, suffix: unitsSuffix, tone: 'muted', testID: testID ? `${testID}-balance` : undefined, style: { fontSize: 14, lineHeight: 20 } }) : null, tag ? _jsx(Text, { testID: testID ? `${testID}-tag` : undefined, numberOfLines: 1, style: { fontSize: 12, lineHeight: 18, color: colors.muted }, children: tag }) : null] }) : null, trailing != null && trailing !== false ? _jsx(View, { ...hidden, testID: testID ? `${testID}-trailing` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 8 }, children: trailing }) : null, selected ? _jsx(View, { ...hidden, testID: testID ? `${testID}-check` : undefined, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' }, children: _jsx(View, { style: { width: 6, height: 12, borderRightWidth: 2, borderBottomWidth: 2, borderColor: strong, transform: [{ translateY: -1 }, { rotate: '45deg' }] } }) }) : null] });
25
- return onSelect ? _jsx(Pressable, { testID: testID, accessibilityRole: 'button', accessibilityLabel: label, accessibilityState: state, disabled: disabled, onPress: onSelect, style: ({ pressed }) => row(pressed), children: content }) : _jsx(View, { testID: testID, accessible: true, accessibilityLabel: label, accessibilityState: state, style: row(false), children: content });
28
+ const content = _jsxs(_Fragment, { children: [_jsx(View, { ...hidden, style: disabled ? { opacity: 0.5 } : undefined, children: art }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: strong }, children: name }), _jsx(Text, { numberOfLines: 1, style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: symbol })] }), amounts || tag ? _jsxs(View, { ...hidden, style: { alignItems: 'flex-end', justifyContent: 'center' }, children: [amounts ? unitsFirst ? _jsx(AnimatedNumberReadout, { value: balance, options: balanceOptions, suffix: unitsSuffix, tone: disabled ? 'muted' : undefined, testID: testID ? `${testID}-balance` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) : _jsx(AnimatedNumberReadout, { value: value, options: usd, tone: disabled ? 'muted' : undefined, testID: testID ? `${testID}-value` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) : null, hasUnits ? _jsx(AnimatedNumberReadout, { value: balance, options: balanceOptions, suffix: unitsSuffix, tone: 'muted', testID: testID ? `${testID}-balance` : undefined, style: { fontSize: 14, lineHeight: 20 } }) : null, tag ? _jsx(Text, { testID: testID ? `${testID}-tag` : undefined, numberOfLines: 1, style: { fontSize: 12, lineHeight: 18, color: colors.muted }, children: tag }) : null] }) : null, trailing != null && trailing !== false && !split ? _jsx(View, { ...hidden, testID: testID ? `${testID}-trailing` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 8 }, children: trailing }) : null] });
29
+ const check = selected ? _jsx(Check, { size: 20, color: strong, testID: testID ? `${testID}-check` : undefined }) : null;
30
+ if (split) {
31
+ // The control leaves the row's element: the rest is one element (or button), the control its own target beside it.
32
+ const main = { flex: 1, minWidth: 0, flexDirection: 'row', alignItems: 'center', gap: 12, alignSelf: 'stretch' };
33
+ return _jsxs(View, { testID: testID, style: row(held), children: [onSelect ? _jsx(Pressable, { testID: testID ? `${testID}-main` : undefined, accessibilityRole: 'button', accessibilityLabel: label, accessibilityState: state, disabled: disabled, onPress: onSelect, onPressIn: () => setHeld(true), onPressOut: () => setHeld(false), style: main, children: content })
34
+ : _jsx(View, { testID: testID ? `${testID}-main` : undefined, accessible: true, accessibilityLabel: label, accessibilityState: state, style: main, children: content }), _jsx(View, { testID: testID ? `${testID}-trailing` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 8 }, children: trailing }), check] });
35
+ }
36
+ return onSelect ? _jsxs(Pressable, { testID: testID, accessibilityRole: 'button', accessibilityLabel: label, accessibilityState: state, disabled: disabled, onPress: onSelect, style: ({ pressed }) => row(pressed), children: [content, check] }) : _jsxs(View, { testID: testID, accessible: true, accessibilityLabel: label, accessibilityState: state, style: row(false), children: [content, check] });
26
37
  }
@@ -0,0 +1,115 @@
1
+ import React from 'react';
2
+ import { type ScrollViewProps } from 'react-native';
3
+ /** A market's live heat signal: `watch` while it is being watched, `up` or `down` once it trends. */
4
+ export type AssetSignal = 'watch' | 'up' | 'down';
5
+ /** The three views of the list: every market, the markets with an open position, and the markets with a signal. */
6
+ export type AssetsView = 'all' | 'positions' | 'trend';
7
+ /** One market the host offers. Every word is host text. */
8
+ export interface AssetItem {
9
+ /** Stable id the host switches on. */
10
+ id: string;
11
+ /** Bitcoin. */
12
+ name: string;
13
+ /** BTC. */
14
+ symbol: string;
15
+ /** `id` of the `AssetCategory` whose section the market sits in. */
16
+ category: string;
17
+ /** Short host text after the symbol on the second line, such as the maximum leverage: `40×`. */
18
+ detail?: string;
19
+ /** Round artwork: an image URL or a host element. Without it the row shows the first letters of the symbol. */
20
+ icon?: string | React.ReactElement;
21
+ /** The trailing signal disc. `null` draws an empty disc, for a market with no signal yet; leave it out to draw no disc. */
22
+ signal?: AssetSignal | null;
23
+ /** The viewer holds an open position in this market, so it shows under Positions. */
24
+ position?: boolean;
25
+ /** Host content on the trailing edge, before the signal disc, such as the live result of the viewer's open position. It is drawn only (inside the row button, hidden from assistive technology); the row reads `trailingLabel` for it. Test ID `<testID>-<id>-trailing`. */
26
+ trailing?: React.ReactNode;
27
+ /** Words the row reads after its symbol line, such as `open position`, for what `trailing` shows. */
28
+ trailingLabel?: string;
29
+ /** More text the search matches, such as an alias or a ticker on another venue. */
30
+ keywords?: string;
31
+ disabled?: boolean;
32
+ }
33
+ /** A market type: a section of the list and a capsule in the category filter. */
34
+ export interface AssetCategory {
35
+ id: string;
36
+ /** Crypto. */
37
+ label: string;
38
+ /** A badge on the section heading's trailing edge, such as OPEN. Bloxwap trades around the clock, so there is no closed badge: use `opensAt` for a legacy market that is shut. */
39
+ status?: {
40
+ label: string;
41
+ tone?: 'positive' | 'negative' | 'warning' | 'info';
42
+ };
43
+ /** When the legacy market behind this category next opens, as epoch milliseconds or a `Date`. While it is ahead, the badge counts down to it (“Opens in 2:14:33”) in place of `status`, and the heading reads it in words. Once it passes, `status` shows again. */
44
+ opensAt?: number | Date;
45
+ }
46
+ export interface AssetsBlockProps {
47
+ /** Shows a clear button in the search field while it holds text: it empties the query and returns focus to the field. Named by `messages.clearSearch`; test ID `<testID>-search-clear`. */
48
+ clearable?: boolean;
49
+ /** Heading. Defaults to the built-in “Assets”. */
50
+ title?: string;
51
+ /** Shows Close on the trailing edge of the header. */
52
+ onClose?: () => void;
53
+ assets: readonly AssetItem[];
54
+ /** Sections and filter capsules, in order. A market whose category is not listed is not shown. */
55
+ categories: readonly AssetCategory[];
56
+ onSelect: (asset: AssetItem) => void;
57
+ /** `id` of the market in use: its row is marked selected. */
58
+ selectedId?: string | null;
59
+ view?: AssetsView;
60
+ defaultView?: AssetsView;
61
+ onViewChange?: (view: AssetsView) => void;
62
+ /** `id` of the chosen category; `''` is All. */
63
+ category?: string;
64
+ defaultCategory?: string;
65
+ onCategoryChange?: (category: string) => void;
66
+ query?: string;
67
+ defaultQuery?: string;
68
+ onQueryChange?: (query: string) => void;
69
+ /** `false` leaves out the category filter. Defaults to `true` when there is more than one category. */
70
+ categoryFilter?: boolean;
71
+ /** The horizontal scroll view the category capsules sit in, such as a sheet library's ScrollView. Forwarded to `Filter`. */
72
+ filterScrollComponent?: React.ComponentType<ScrollViewProps>;
73
+ /** Shows the loading text in place of the empty text while the list is empty. */
74
+ loading?: boolean;
75
+ /** 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 (test ID `<testID>-sticky-header`, `assets-sticky-header` without one). Place it in a bounded container, such as a sheet body. */
76
+ stickyHeader?: boolean;
77
+ /** With `stickyHeader`: the header's fill once content is under it. Defaults to the background role; in a sheet pass the sheet's fill. */
78
+ stickyHeaderBackground?: string;
79
+ /** The scroll view used with `stickyHeader`, such as a sheet library's own. Defaults to React Native's ScrollView. */
80
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
81
+ /** `nativeID` of the title, so a sheet around the block can name itself with `accessibilityLabelledBy` (Android), as `GestureSheet labelledBy` does. */
82
+ headingId?: string;
83
+ /** Freezes the opening countdown at the text it last showed, stops its timer and its digits rolling, for example while the sheet is closed or the app is in the background. */
84
+ paused?: boolean;
85
+ /** The host's clock in epoch milliseconds, read for the opening countdown. Defaults to `Date.now`. */
86
+ now?: () => number;
87
+ /** A button under the empty text, drawn only while the list is empty and not `loading`, such as Browse all markets on an empty Positions view. Test ID `testID`, else `<testID>-empty-action`. */
88
+ emptyAction?: AssetsEmptyAction;
89
+ /** Focuses the search field on mount, raising the keyboard, so typing filters at once. */
90
+ autoFocusSearch?: boolean;
91
+ /** While the search field holds a query, the keyboard's Search key chooses the first enabled match, as a search box's top hit. By default it only closes the keyboard. */
92
+ enterChoosesFirst?: boolean;
93
+ testID?: string;
94
+ }
95
+ /** The empty list's action. */
96
+ export interface AssetsEmptyAction {
97
+ label: string;
98
+ onPress: () => void;
99
+ testID?: string;
100
+ }
101
+ /** The markets a view, category and query leave, grouped by category in the host's order. Empty sections are dropped. */
102
+ export declare function filterAssets(assets: readonly AssetItem[], categories: readonly AssetCategory[], { view, category, query }?: {
103
+ view?: AssetsView;
104
+ category?: string;
105
+ query?: string;
106
+ }): {
107
+ category: AssetCategory;
108
+ assets: AssetItem[];
109
+ }[];
110
+ /**
111
+ * Choose a market as one screen: a header, a search field, category capsules, the All / Positions / Trend views, then the
112
+ * markets in sections by category, each with its icon, name, symbol and detail on one line each, and its signal disc. The host
113
+ * owns the data and the scrolling, unless `stickyHeader` makes the block its own scroll view.
114
+ */
115
+ export declare function AssetsBlock({ title, onClose, assets, categories, onSelect, selectedId, view, defaultView, onViewChange, category, defaultCategory, onCategoryChange, query, defaultQuery, onQueryChange, categoryFilter, filterScrollComponent, loading, stickyHeader, stickyHeaderBackground, scrollComponent, headingId, clearable, paused, now: clock, emptyAction, autoFocusSearch, enterChoosesFirst, testID }: AssetsBlockProps): React.JSX.Element;
@@ -0,0 +1,87 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useMemo, useRef, useState } from 'react';
3
+ import { formatCountdown } from '@bloxwap/hig/contracts';
4
+ import { Image, Pressable, View } from 'react-native';
5
+ import { useColors, useFills, useHIG, useMessages } from './provider.js';
6
+ import { Text } from './surface.js';
7
+ import { AnimatedNumberReadout } from './animated-number.js';
8
+ import { SearchInput } from './field.js';
9
+ import { Filter, SegmentedControl } from './radio-group.js';
10
+ import { ScreenHeader, HeaderClose } from './screen-header.js';
11
+ import { StickyHeaderLayout } from './sticky-header.js';
12
+ import { EyeIcon, TrendIcon } from './icons.js';
13
+ import { Button } from './button.js';
14
+ const fold = (text) => text.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase();
15
+ /** The markets a view, category and query leave, grouped by category in the host's order. Empty sections are dropped. */
16
+ export function filterAssets(assets, categories, { view = 'all', category = '', query = '' } = {}) {
17
+ const needle = fold(query.trim());
18
+ const keep = (asset) => (view === 'all' || (view === 'positions' ? !!asset.position : asset.signal != null)) && (needle === '' || fold(`${asset.name} ${asset.symbol} ${asset.keywords ?? ''}`).includes(needle));
19
+ return categories.filter(entry => category === '' || entry.id === category).map(entry => ({ category: entry, assets: assets.filter(asset => asset.category === entry.id && keep(asset)) })).filter(section => section.assets.length > 0);
20
+ }
21
+ /** Controlled when `value` is set, otherwise local. No feedback: the filter and segmented control emit their own, and typing emits none. */
22
+ function useHostState(value, initial, onChange) {
23
+ const [local, setLocal] = useState(initial);
24
+ const current = value === undefined ? local : value;
25
+ return [current, next => { if (Object.is(next, current))
26
+ return; if (value === undefined)
27
+ setLocal(next); onChange?.(next); }];
28
+ }
29
+ /** The host clock, ticking each second while one of `openings` is still ahead and not `paused`; paused keeps the last reading (or takes one) and judges "ahead" against it, so a host re-render after an opening passes keeps the frozen text. */
30
+ function useNow(openings, paused, clock) {
31
+ const [now, setNow] = useState(() => { const first = clock(); return openings.some(at => at > first) ? first : null; });
32
+ const read = useRef(clock);
33
+ read.current = clock;
34
+ const reading = paused && now != null ? now : openings.length ? clock() : 0;
35
+ const active = openings.some(at => at > reading);
36
+ useEffect(() => { if (!active) {
37
+ setNow(null);
38
+ return;
39
+ } if (paused) {
40
+ setNow(last => last ?? read.current());
41
+ return;
42
+ } setNow(read.current()); const tick = setInterval(() => setNow(read.current()), 1000); return () => clearInterval(tick); }, [active, paused]);
43
+ return active ? now : null;
44
+ }
45
+ const opensAtTime = (category) => category.opensAt == null ? null : +category.opensAt;
46
+ const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
47
+ const disc = 44;
48
+ /**
49
+ * Choose a market as one screen: a header, a search field, category capsules, the All / Positions / Trend views, then the
50
+ * markets in sections by category, each with its icon, name, symbol and detail on one line each, and its signal disc. The host
51
+ * owns the data and the scrolling, unless `stickyHeader` makes the block its own scroll view.
52
+ */
53
+ export function AssetsBlock({ title, onClose, assets, categories, onSelect, selectedId = null, view, defaultView = 'all', onViewChange, category, defaultCategory = '', onCategoryChange, query, defaultQuery = '', onQueryChange, categoryFilter, filterScrollComponent, loading, stickyHeader, stickyHeaderBackground, scrollComponent, headingId, clearable, paused = false, now: clock = Date.now, emptyAction, autoFocusSearch, enterChoosesFirst, testID }) {
54
+ const colors = useColors(), fills = useFills(), t = useMessages(), { direction, locale } = useHIG();
55
+ const id = (part) => testID === undefined ? undefined : `${testID}-${part}`;
56
+ const [currentView, setView] = useHostState(view, defaultView, onViewChange);
57
+ const [currentCategory, setCategory] = useHostState(category, defaultCategory, onCategoryChange);
58
+ const [currentQuery, setQuery] = useHostState(query, defaultQuery, onQueryChange);
59
+ const sections = useMemo(() => filterAssets(assets, categories, { view: currentView, category: currentCategory, query: currentQuery }), [assets, categories, currentView, currentCategory, currentQuery]);
60
+ // The clock runs only while a section on screen has an opening still ahead.
61
+ const now = useNow(sections.flatMap(section => { const at = opensAtTime(section.category); return at == null ? [] : [at]; }), paused, clock);
62
+ const signalName = { watch: t.signalWatch, up: t.signalUp, down: t.signalDown };
63
+ const signalColor = { watch: colors.warning, up: colors.positive, down: colors.negative };
64
+ const toneColor = { positive: colors.positive, negative: colors.negative, warning: colors.warning, info: colors.info };
65
+ const empty = loading ? `${t.loading}…` : currentQuery.trim() !== '' ? t.noResults : currentView === 'positions' ? t.noPositions : currentView === 'trend' ? t.noTrend : t.noItems;
66
+ const round = { width: disc, height: disc, borderRadius: disc / 2, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
67
+ const row = (asset) => {
68
+ const second = asset.detail ? `${asset.symbol} · ${asset.detail}` : asset.symbol;
69
+ const selected = asset.id === selectedId;
70
+ const style = ({ pressed }) => ({ flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 64, padding: 8, borderRadius: 32, backgroundColor: pressed || selected ? fills.well : 'transparent', opacity: asset.disabled ? 0.5 : 1 });
71
+ return _jsx(Pressable, { testID: id(asset.id), accessibilityRole: 'button', accessibilityLabel: [asset.name, second, asset.trailingLabel, asset.signal ? signalName[asset.signal] : null].filter(Boolean).join(', '), accessibilityState: { selected, disabled: !!asset.disabled }, disabled: asset.disabled, onPress: () => onSelect(asset), style: style, children: ({ pressed }) => _jsxs(_Fragment, { children: [_jsx(View, { ...hidden, children: typeof asset.icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: asset.icon }, style: round }) : _jsx(View, { style: [round, { backgroundColor: fills.raised }], children: asset.icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: asset.symbol.slice(0, 4) }) }) }), _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: asset.name }), _jsx(Text, { numberOfLines: 1, style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: second })] }), asset.trailing != null && asset.trailing !== false ? _jsx(View, { ...hidden, testID: id(`${asset.id}-trailing`), style: { flexShrink: 0, alignItems: 'flex-end' }, children: asset.trailing }) : null, asset.signal === undefined ? null : _jsx(View, { ...hidden, testID: id(`${asset.id}-signal`), style: [round, { backgroundColor: asset.signal ? `${signalColor[asset.signal]}26` : pressed || selected ? fills.raised : fills.well }], children: asset.signal === 'watch' ? _jsx(EyeIcon, { color: colors.warning }) : asset.signal ? _jsx(TrendIcon, { color: signalColor[asset.signal], direction: asset.signal }) : null })] }) }, asset.id);
72
+ };
73
+ const showFilter = (categoryFilter ?? true) && categories.length > 1;
74
+ const header = _jsx(ScreenHeader, { title: title ?? t.assets, testID: id('header'), headingId: headingId, action: onClose ? _jsx(HeaderClose, { onClose: onClose, label: t.close, testID: id('close') }) : undefined });
75
+ const body = _jsxs(_Fragment, { children: [_jsx(SearchInput, { testID: id('search'), accessibilityLabel: t.searchMarkets, placeholder: `${t.searchMarkets}…`, value: currentQuery, onChangeText: setQuery, onClear: clearable ? () => setQuery('') : undefined, autoFocus: autoFocusSearch, returnKeyType: 'search', onSubmitEditing: enterChoosesFirst ? () => { const first = currentQuery.trim() === '' ? undefined : sections.flatMap(section => section.assets).find(asset => !asset.disabled); if (first)
76
+ onSelect(first); } : undefined, autoCapitalize: 'none', autoCorrect: false, spellCheck: false }), showFilter ? _jsx(Filter, { label: t.marketCategories, options: [{ value: '', label: t.assetsAll }, ...categories.map(entry => ({ value: entry.id, label: entry.label }))], value: currentCategory, onValueChange: setCategory, scrollComponent: filterScrollComponent, bleed: 16 }) : null, _jsx(SegmentedControl, { hideLabel: true, testID: id('view'), label: t.assetsView, options: [{ value: 'all', label: t.assetsAll }, { value: 'positions', label: t.assetsPositions }, { value: 'trend', label: t.assetsTrend }], value: currentView, onValueChange: next => setView(next) }), sections.length === 0 ? _jsxs(View, { style: { gap: 16, alignItems: 'center' }, children: [_jsx(Text, { testID: id('empty'), accessibilityLiveRegion: 'polite', style: { alignSelf: 'stretch', paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20, color: colors.muted }, children: empty }), !loading && emptyAction ? _jsx(Button, { intent: 'secondary', testID: emptyAction.testID ?? id('empty-action'), onPress: emptyAction.onPress, style: { alignSelf: 'center' }, children: emptyAction.label }) : null] }) :
77
+ _jsx(View, { testID: id('list'), style: { gap: 16 }, children: sections.map(section => {
78
+ const at = opensAtTime(section.category);
79
+ const remaining = now != null && at != null && at > now ? at - now : null, countdown = remaining != null ? formatCountdown(remaining, locale) : null;
80
+ const status = countdown ? { label: `${t.opensIn} ${countdown.visible}`, spoken: `${t.opensIn} ${countdown.spoken}`, color: colors.muted, fill: fills.well } : section.category.status ? { label: section.category.status.label, spoken: section.category.status.label, color: toneColor[section.category.status.tone ?? 'positive'], fill: `${toneColor[section.category.status.tone ?? 'positive']}26` } : null;
81
+ return _jsxs(View, { testID: id(`section-${section.category.id}`), style: { gap: 4 }, children: [_jsxs(View, { testID: id(`section-${section.category.id}-header`), style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 32, paddingHorizontal: 8 }, children: [_jsx(Text, { accessibilityRole: 'header', accessibilityLabel: status ? `${section.category.label}, ${status.spoken}` : undefined, style: { flexShrink: 1, fontSize: 14, lineHeight: 20, fontWeight: '500', color: colors.muted }, children: section.category.label }), status ? _jsx(View, { ...hidden, testID: id(`status-${section.category.id}`), style: { borderRadius: 9999, paddingVertical: 2, paddingHorizontal: 10, backgroundColor: status.fill }, children: countdown && remaining != null ? _jsx(AnimatedNumberReadout, { value: Math.ceil(remaining / 1000), formattedValue: countdown.visible, animateFormatted: true, duration: paused ? 0 : undefined, prefix: `${t.opensIn} `, testID: id(`countdown-${section.category.id}`), tone: 'muted', maxFontSizeMultiplier: 1.4, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', letterSpacing: 0.25 } }) : _jsx(Text, { maxFontSizeMultiplier: 1.4, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', letterSpacing: 1, fontVariant: ['tabular-nums'], color: status.color }, children: status.label }) }) : null] }), _jsx(View, { style: { gap: 4 }, children: section.assets.map(row) })] }, section.category.id);
82
+ }) })] });
83
+ // The sticky layout puts the header and the body in separate views, so the body's first gap is its top padding.
84
+ if (stickyHeader)
85
+ return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: id('sticky-header') ?? 'assets-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, bodyStyle: { direction, gap: 16, paddingTop: 16 }, children: body });
86
+ return _jsxs(View, { testID: testID, style: { direction, padding: 16, gap: 16 }, children: [header, body] });
87
+ }
@@ -0,0 +1,2 @@
1
+ /** Start an operation and test whether its result still belongs to this owner. */
2
+ export declare function useAsyncResult(owner: unknown): () => () => boolean;
@@ -0,0 +1,11 @@
1
+ import { useEffect, useRef } from 'react';
2
+ /** Start an operation and test whether its result still belongs to this owner. */
3
+ export function useAsyncResult(owner) {
4
+ const state = useRef({ owner, generation: 0, alive: true });
5
+ if (!Object.is(state.current.owner, owner)) {
6
+ state.current.owner = owner;
7
+ state.current.generation++;
8
+ }
9
+ useEffect(() => { state.current.alive = true; return () => { state.current.alive = false; state.current.generation++; }; }, []);
10
+ return () => { const generation = ++state.current.generation; return () => state.current.alive && state.current.generation === generation; };
11
+ }
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { type ImageSourcePropType } from 'react-native';
3
+ /** The side of an avatar when `size` is left out. */
4
+ export declare const avatarSize = 40;
5
+ /** What every Avatar takes, with or without the generated face. */
6
+ export interface AvatarFrameProps {
7
+ /** The person or account. It is the accessible name, and the first two letters are the initials. */
8
+ name: string;
9
+ /** An image to show instead, cropped to fill the box. If it fails to load, or it names no image (`{uri: undefined}`, an empty address), the fallback shows in its place. */
10
+ source?: ImageSourcePropType;
11
+ /** Width and height in dp. Defaults to 40. With it, the initials are drawn at 40% of the size and keep that size at every system text size, so they stay inside the box. A size that is not a finite number of zero or more is ignored. */
12
+ size?: number;
13
+ /** A square with no rounded corners instead of a disc, for a host that clips it to its own shape. */
14
+ square?: boolean;
15
+ /** Hides the avatar from VoiceOver and TalkBack, for an avatar beside the name it stands for. */
16
+ decorative?: boolean;
17
+ }
18
+ /**
19
+ * The same frame props: each one identical, and `source` the same image in whichever object.
20
+ * Each prop is read by name, because walking a list of names costs as much as the render it saves. `tests/native/avatar-typecheck.tsx` lists every prop, so a new one is seen there.
21
+ */
22
+ export declare const sameFrame: (a: AvatarFrameProps, b: AvatarFrameProps) => boolean;
23
+ /**
24
+ * The box behind every Avatar: the image, else `face` clipped to the box, else the first two letters on the well fill.
25
+ * Internal. `status` renders it with no face and `avatar` with the generated one, so only the `avatar` entry loads `react-native-svg`.
26
+ */
27
+ export declare function AvatarFrame({ name, source, size, square, decorative, face }: AvatarFrameProps & {
28
+ face?: React.ReactNode;
29
+ }): React.JSX.Element;
@@ -0,0 +1,56 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Image, View } from 'react-native';
4
+ import { avatarInitials, avatarSide } from '@bloxwap/hig/contracts/avatar';
5
+ import { Text } from './surface.js';
6
+ import { useFills } from './provider.js';
7
+ /** The side of an avatar when `size` is left out. */
8
+ export const avatarSize = 40;
9
+ const unread = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
10
+ /**
11
+ * What identifies an image source across renders: its address (a host often builds `{uri}` inline), or the `require` number.
12
+ * Undefined when the source names no image (no address, an empty one, an empty list), which a host gets from `{uri: photo}` before the photo is known.
13
+ */
14
+ function sourceKey(source) {
15
+ if (typeof source === 'number' || typeof source === 'string')
16
+ return source || undefined;
17
+ if (Array.isArray(source))
18
+ return source.map(item => sourceKey(item)).filter(key => key !== undefined).join(' ') || undefined;
19
+ if (typeof source !== 'object' || source === null)
20
+ return undefined;
21
+ const uri = source.uri;
22
+ return typeof uri === 'string' && uri !== '' ? uri : undefined;
23
+ }
24
+ /** Whether two sources name the same image the same way: the same value, or objects whose fields are identical (a host often writes `{uri}` inline), or lists of those. */
25
+ function sameSource(a, b) {
26
+ if (Object.is(a, b))
27
+ return true;
28
+ if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null || Array.isArray(a) !== Array.isArray(b))
29
+ return false;
30
+ if (Array.isArray(a))
31
+ return a.length === b.length && a.every((item, index) => sameSource(item, b[index]));
32
+ const keys = Object.keys(a), theirs = b;
33
+ return keys.length === Object.keys(b).length && keys.every(key => key in theirs && Object.is(a[key], theirs[key]));
34
+ }
35
+ /**
36
+ * The same frame props: each one identical, and `source` the same image in whichever object.
37
+ * Each prop is read by name, because walking a list of names costs as much as the render it saves. `tests/native/avatar-typecheck.tsx` lists every prop, so a new one is seen there.
38
+ */
39
+ export const sameFrame = (a, b) => a.name === b.name && a.size === b.size && a.square === b.square && a.decorative === b.decorative && sameSource(a.source, b.source);
40
+ /**
41
+ * The box behind every Avatar: the image, else `face` clipped to the box, else the first two letters on the well fill.
42
+ * Internal. `status` renders it with no face and `avatar` with the generated one, so only the `avatar` entry loads `react-native-svg`.
43
+ */
44
+ export function AvatarFrame({ name, source, size, square, decorative, face }) {
45
+ const fills = useFills();
46
+ const [failed, setFailed] = useState();
47
+ const sized = avatarSide(size), side = sized ?? avatarSize, borderRadius = square ? 0 : side / 2, key = sourceKey(source);
48
+ // The fallback is a named image, so the photo is one too: an Image with a label alone is not an accessibility element on iOS.
49
+ const reading = decorative ? unread : { accessible: true, accessibilityRole: 'image', accessibilityLabel: name };
50
+ if (source && key !== undefined && (!failed || failed.key !== key))
51
+ return _jsx(Image, { ...reading, source: source, onError: () => setFailed({ key }), style: { width: side, height: side, borderRadius } });
52
+ if (face != null)
53
+ return _jsx(View, { ...reading, style: { width: side, height: side, borderRadius, overflow: 'hidden' }, children: face });
54
+ // Letters sized to the box stay that size, like the letters in HIG's other fixed discs; without `size` they follow the system text size as they always have.
55
+ return _jsx(View, { ...reading, style: { width: side, height: side, borderRadius, backgroundColor: fills.well, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { accessible: false, maxFontSizeMultiplier: sized === undefined ? undefined : 1, style: sized === undefined ? undefined : { fontSize: Math.round(sized * 0.4), lineHeight: Math.round(sized * 0.6) }, children: avatarInitials(name) }) });
56
+ }
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import { type AvatarFrameProps } from './avatar-frame.js';
3
+ /** Token roles of the default face palette, in this order: the `avatarColorRoles` of `@bloxwap/hig/contracts/avatar`, which web and native share. The order and the number of colours decide which colours a seed lands on. */
4
+ export declare const avatarColorRoles: readonly ["action", "info", "negative", "warning"];
5
+ export interface AvatarProps extends AvatarFrameProps {
6
+ /** What the generated face is drawn from, such as a wallet address. The same seed and colours draw the same face on web and native. It is case-sensitive. Passing it selects the generated face. Defaults to `name`. */
7
+ seed?: string;
8
+ /** What shows without an image: `initials`, the first two letters of `name` on the well fill, or `beam`, a generated face. Defaults to `initials`, or to `beam` when `seed` is given. */
9
+ variant?: 'initials' | 'beam';
10
+ /** Palette of the generated face, as React Native colours. Defaults to the `action`, `info`, `negative` and `warning` roles of the provider's colour table (`avatarColorRoles`), which is Display P3 on an iOS host that paints in it. A seed picks by position, so the same list in the same order keeps the same faces. */
11
+ colors?: readonly string[];
12
+ /** One colour for the eyes and mouth of every generated face. Left out, each face takes the `background` role on a bright colour and the `text` role on a deep one. */
13
+ faceColor?: string;
14
+ }
15
+ /**
16
+ * A person or account as a 40dp disc: an image, else the first two letters of the name on the well fill (one step lighter inside a Surface, Dialog or sheet),
17
+ * else (with `variant='beam'` or a `seed`) a face generated from the seed. The face is an identity picture, so it is the same in right-to-left layouts and it never moves.
18
+ * This entry draws the face with `react-native-svg`; `Avatar` from `@bloxwap/hig/native/status` is the same component without the face and without that peer.
19
+ * It renders again only when one of its props changes.
20
+ */
21
+ export declare function Avatar({ seed, variant, colors, faceColor, ...frame }: AvatarProps): React.JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import Svg, { G, Path, Rect } from 'react-native-svg';
4
+ import { avatarColorRoles as paletteRoles, avatarSide, beamAvatar, beamEye, beamSize } from '@bloxwap/hig/contracts/avatar';
5
+ import { AvatarFrame, avatarSize, sameFrame } from './avatar-frame.js';
6
+ import { useColors } from './provider.js';
7
+ /** Token roles of the default face palette, in this order: the `avatarColorRoles` of `@bloxwap/hig/contracts/avatar`, which web and native share. The order and the number of colours decide which colours a seed lands on. */
8
+ export const avatarColorRoles = paletteRoles;
9
+ const beamBox = `0 0 ${beamSize} ${beamSize}`;
10
+ const samePalette = (a, b) => a === b || (a != null && b != null && a.length === b.length && a.every((color, index) => color === b[index]));
11
+ /** The generated face in react-native-svg. Memoised on what it draws, so a list that re-renders with the same seeds and colours costs nothing here. */
12
+ const BeamFace = React.memo(function BeamFace({ seed, size, colors, faceColor }) {
13
+ const roles = useColors();
14
+ const face = beamAvatar(seed, colors && colors.length > 0 ? colors : avatarColorRoles.map(role => roles[role]), { dark: roles.background, light: roles.text });
15
+ const ink = faceColor ?? face.faceColor, mouthFill = face.mouthStroked ? 'none' : ink, mouthStroke = face.mouthStroked ? ink : 'none';
16
+ return _jsxs(Svg, { width: size, height: size, viewBox: beamBox, children: [_jsx(Rect, { width: beamSize, height: beamSize, fill: face.backgroundColor }), _jsx(Rect, { width: beamSize, height: beamSize, rx: face.wrapperRadius, transform: face.wrapperTransform, fill: face.wrapperColor }), _jsxs(G, { transform: face.faceTransform, children: [_jsx(Path, { d: face.mouthPath, fill: mouthFill, stroke: mouthStroke, strokeLinecap: 'round' }), _jsx(Rect, { x: face.leftEyeX, y: beamEye.y, width: beamEye.width, height: beamEye.height, rx: beamEye.radius, fill: ink }), _jsx(Rect, { x: face.rightEyeX, y: beamEye.y, width: beamEye.width, height: beamEye.height, rx: beamEye.radius, fill: ink })] })] });
17
+ }, (previous, next) => previous.seed === next.seed && previous.size === next.size && previous.faceColor === next.faceColor && samePalette(previous.colors, next.colors));
18
+ /** The same props: each one identical, `colors` the same colours in whichever array and `source` the same image in whichever object, because a host often writes both inline. Each prop is read by name, as in `sameFrame`. */
19
+ const sameProps = (a, b) => sameFrame(a.frame, b.frame) && a.seed === b.seed && a.variant === b.variant && a.faceColor === b.faceColor && samePalette(a.colors, b.colors);
20
+ /** What Avatar draws, kept while its props are the same: a list that renders again renders no frame and no view for the rows that did not change. */
21
+ const Drawing = React.memo(function AvatarDrawing({ seed, variant, colors, faceColor, frame }) {
22
+ const beam = (variant ?? (seed == null ? 'initials' : 'beam')) === 'beam';
23
+ return _jsx(AvatarFrame, { ...frame, face: beam ? _jsx(BeamFace, { seed: seed ?? frame.name, size: avatarSide(frame.size) ?? avatarSize, colors: colors, faceColor: faceColor }) : undefined });
24
+ }, sameProps);
25
+ /**
26
+ * A person or account as a 40dp disc: an image, else the first two letters of the name on the well fill (one step lighter inside a Surface, Dialog or sheet),
27
+ * else (with `variant='beam'` or a `seed`) a face generated from the seed. The face is an identity picture, so it is the same in right-to-left layouts and it never moves.
28
+ * This entry draws the face with `react-native-svg`; `Avatar` from `@bloxwap/hig/native/status` is the same component without the face and without that peer.
29
+ * It renders again only when one of its props changes.
30
+ */
31
+ export function Avatar({ seed, variant, colors, faceColor, ...frame }) { return _jsx(Drawing, { seed: seed, variant: variant, colors: colors, faceColor: faceColor, frame: frame }); }
@@ -41,6 +41,8 @@ export interface BarMarkProps {
41
41
  surface?: boolean;
42
42
  testID?: string;
43
43
  }
44
+ /** How strong a bar's fill is drawn, so a wide bar does not outweigh the figures beside it. The edges of a move, the liquidation tick and the legend dots stay solid. Web: `--hig-bar-fill-opacity`. */
45
+ export declare const barFillOpacity = 0.5;
44
46
  /** The order segments take their colour in when an element names neither `tone` nor `color`. */
45
47
  export declare const barMarkTones: readonly BarMarkTone[];
46
48
  /** Each element's clamped value and its share of the whole, plus the unfilled remainder in the same unit. */
@@ -1,11 +1,13 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { useContext } from 'react';
3
3
  import { View } from 'react-native';
4
- import { formatNumber } from '@bloxwap/hig/contracts';
4
+ import { formatNumber } from './number-format.js';
5
5
  import { useColors, useFills, useHIG, useNumberLocale, usePresentNumber } from './provider.js';
6
6
  import { figureReading } from './figure.js';
7
7
  import { Surface, Text } from './surface.js';
8
8
  export const BarMarkFigureContext = React.createContext(null);
9
+ /** How strong a bar's fill is drawn, so a wide bar does not outweigh the figures beside it. The edges of a move, the liquidation tick and the legend dots stay solid. Web: `--hig-bar-fill-opacity`. */
10
+ export const barFillOpacity = 0.5;
9
11
  /** The order segments take their colour in when an element names neither `tone` nor `color`. */
10
12
  export const barMarkTones = ['positive', 'info', 'warning', 'negative', 'muted', 'faint'];
11
13
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
@@ -18,7 +20,7 @@ export function barMarkShares(elements, total) {
18
20
  // A component of its own so the track reads the raised fill of whatever it sits on: one step above the card inside the Surface, one step above the page without it.
19
21
  function Bar({ elements, values, rest, colors, small, testID }) {
20
22
  const track = useFills().raised;
21
- return _jsxs(View, { ...hidden, testID: testID ? `${testID}-bar` : undefined, style: { flexDirection: 'row', height: small ? 12 : 24, borderRadius: small ? 6 : 8, overflow: 'hidden', gap: 2 }, children: [elements.map((element, index) => values[index] > 0 ? _jsx(View, { testID: testID ? `${testID}-segment-${element.id ?? index}` : undefined, style: { flexGrow: values[index], flexShrink: 1, flexBasis: 0, minWidth: 3, backgroundColor: colors[index] } }, element.id ?? index) : null), rest > 0 ? _jsx(View, { testID: testID ? `${testID}-track` : undefined, style: { flexGrow: rest, flexShrink: 1, flexBasis: 0, backgroundColor: track } }) : null] });
23
+ return _jsxs(View, { ...hidden, testID: testID ? `${testID}-bar` : undefined, style: { flexDirection: 'row', height: small ? 12 : 24, borderRadius: small ? 6 : 8, overflow: 'hidden', gap: 2 }, children: [elements.map((element, index) => values[index] > 0 ? _jsx(View, { testID: testID ? `${testID}-segment-${element.id ?? index}` : undefined, style: { flexGrow: values[index], flexShrink: 1, flexBasis: 0, minWidth: 3, backgroundColor: colors[index], opacity: barFillOpacity } }, element.id ?? index) : null), rest > 0 ? _jsx(View, { testID: testID ? `${testID}-track` : undefined, style: { flexGrow: rest, flexShrink: 1, flexBasis: 0, backgroundColor: track } }) : null] });
22
24
  }
23
25
  /**
24
26
  * One horizontally stacked bar on a card: the title leads and the description trails, the bar splits into a segment per
@@ -2,6 +2,7 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
2
2
  import { View } from 'react-native';
3
3
  import { useColors, useFills, useHIG, useNumberLocale, usePresentNumber } from './provider.js';
4
4
  import { Surface, Text } from './surface.js';
5
+ import { barFillOpacity } from './bar-mark.js';
5
6
  import { AnimatedNumberReadout } from './animated-number.js';
6
7
  import { formatNumberReadout } from './animated-number-model.js';
7
8
  const usd = { style: 'currency', currency: 'USD' };
@@ -56,5 +57,5 @@ export function BarPnl({ entry, mark, liquidation, side, labels, title, descript
56
57
  function Bar({ from, to, markLeads, tone, liquidation, testID }) {
57
58
  const colors = useColors(), track = useFills().raised;
58
59
  const part = (grow) => ({ flexGrow: grow, flexShrink: 1, flexBasis: 0, backgroundColor: track });
59
- return _jsxs(View, { ...hidden, testID: testID ? `${testID}-bar` : undefined, style: { flexDirection: 'row', height: 24, borderRadius: 8, overflow: 'hidden' }, children: [_jsx(View, { style: part(from) }), _jsx(View, { testID: testID ? `${testID}-move` : undefined, style: { flexGrow: to - from, flexShrink: 1, flexBasis: 0, minWidth: 6, backgroundColor: tone, borderStartWidth: 3, borderEndWidth: 3, borderStartColor: markLeads ? tone : colors.text, borderEndColor: markLeads ? colors.text : tone } }), _jsx(View, { style: part(1 - to) }), liquidation === undefined ? null : _jsx(View, { testID: testID ? `${testID}-liquidation-tick` : undefined, style: { position: 'absolute', top: 0, bottom: 0, width: 3, start: `${liquidation * 100}%`, marginStart: liquidation <= 0 ? 0 : liquidation >= 1 ? -3 : -1.5, backgroundColor: colors.negative } })] });
60
+ return _jsxs(View, { ...hidden, testID: testID ? `${testID}-bar` : undefined, style: { flexDirection: 'row', height: 24, borderRadius: 8, overflow: 'hidden' }, children: [_jsx(View, { style: part(from) }), _jsx(View, { testID: testID ? `${testID}-move` : undefined, style: { flexGrow: to - from, flexShrink: 1, flexBasis: 0, minWidth: 6, borderStartWidth: 3, borderEndWidth: 3, borderStartColor: markLeads ? tone : colors.text, borderEndColor: markLeads ? colors.text : tone }, children: _jsx(View, { testID: testID ? `${testID}-fill` : undefined, style: { flex: 1, backgroundColor: tone, opacity: barFillOpacity } }) }), _jsx(View, { style: part(1 - to) }), liquidation === undefined ? null : _jsx(View, { testID: testID ? `${testID}-liquidation-tick` : undefined, style: { position: 'absolute', top: 0, bottom: 0, width: 3, start: `${liquidation * 100}%`, marginStart: liquidation <= 0 ? 0 : liquidation >= 1 ? -3 : -1.5, backgroundColor: colors.negative } })] });
60
61
  }
@@ -21,18 +21,25 @@ export declare function MarketingHero({ title, description, href, cta }: {
21
21
  cta: string;
22
22
  }): React.JSX.Element;
23
23
  export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow, type AccountBlockProps, type AccountAsset, type AccountSection, type AccountOrder, type AccountRowsOptions, type AssetArtwork, type AssetBalanceRowProps } from './account-block.js';
24
+ export { LoginBlock, type LoginBlockProps, type LoginProvider } from './login-block.js';
25
+ export { DepositBlock, type DepositBlockProps, type DepositMethod } from './deposit-block.js';
24
26
  export { LanguageBlock, filterLanguages, type LanguageBlockProps, type LanguageOption } from './language-block.js';
25
27
  export { TokenActionBlock, tokenActionLabel, type TokenActionBlockProps, type TokenAction, type TokenActionId } from './token-action-block.js';
26
28
  export { ManagePositionBlock, positionCorridor, type ManagePositionBlockProps, type ManagePositionBlockLabels, type ManagePositionBlockAction, type ManagePositionBlockSummary, type ManagePositionBlockFigure, type ManagePositionIcon } from './manage-position-block.js';
27
29
  export { TradeHistoryListBlock, tradeHistorySide, type TradeHistoryListBlockProps, type TradeHistoryListLabels, type TradeHistoryItem } from './trade-history-list-block.js';
28
30
  export { TradeHistoryDetailBlock, type TradeHistoryDetailBlockProps, type TradeHistoryDetailLabels, type TradeHistoryDetail, type TradeHistoryAction } from './trade-history-detail-block.js';
29
31
  export { TargetBlock, targetLayout, targetFormat, targetPresets, targetUnits, type TargetBlockProps, type TargetBlockLabels, type TargetKind, type TargetUnit, type TargetPrice, type TargetPreset, type TargetUnitOption } from './target-block.js';
32
+ export { AssetsBlock, filterAssets, type AssetsBlockProps, type AssetItem, type AssetCategory, type AssetSignal, type AssetsView, type AssetsEmptyAction } from './assets-block.js';
30
33
  export { ProfileBlock, type ProfileBlockProps, type ProfileRow, type ProfileSection, type ProfileStatus, type ProfileAction, type ProfileFigure } from './profile-block.js';
31
34
  export { PositionBlock, PositionBlockHeader, type PositionBlockProps, type PositionBlockHeaderProps, type PositionBlockDetail, type PositionBlockFigure, type PositionBlockRow, type PositionBlockFlag, type PositionBlockFlagAction } from './position-block.js';
32
35
  export { RewardBlock, rewardProgress, type RewardBlockProps, type RewardPromo, type RewardEntry } from './reward-block.js';
33
36
  export { SoundHapticsBlock, soundLevel, type SoundHapticsBlockProps, type SoundSection, type SoundVolume, type SettingAction } from './sound-haptics-block.js';
34
37
  export { SignalsBlock, type SignalsBlockProps, type SignalsGroup, type SignalsItem } from './signals-block.js';
35
38
  export { NotificationsBlock, type NotificationsBlockProps, type NotificationsItem } from './notifications-block.js';
36
- export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps, type PickerInputProps, SwapHostContext } from './pickers.js';
39
+ export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps, type PickerInputProps, type PickerRowProps, SwapHostContext } from './pickers.js';
37
40
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
38
- export { SwapPanelBlock, SwapPanel, swapAction, type SwapPanelBlockProps, type SwapPanelProps, type SwapToken, type SwapArtwork, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapFigure, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-panel-block.js';
41
+ export { SwapAmountCard, SwapPill, type SwapAmountCardProps, type SwapPillProps } from './swap-amount-card.js';
42
+ export { SwapBlock, SwapPanelBlock, SwapPanel, swapAction, type SwapBlockProps, type SwapPanelBlockProps, type SwapPanelProps, type SwapToken, type SwapArtwork, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapFigure, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-block.js';
43
+ export { ConfirmBlock, type ConfirmBlockProps, type ConfirmDetail, type ConfirmTertiaryAction } from './confirm-block.js';
44
+ export { PresetPickerBlock, type PresetPickerBlockProps, type PresetPickerCustom, type PresetPickerAdjustable } from './preset-picker-block.js';
45
+ export { ExplainerBlock, type ExplainerBlockProps, type ExplainerSection, type ExplainerAction, type ExplainerTone } from './explainer-block.js';
@@ -25,12 +25,15 @@ export function InstallCommand({ command, onCopy }) {
25
25
  }
26
26
  export function MarketingHero({ title, description, href, cta }) { return _jsxs(Stack, { children: [_jsx(Heading, { children: title }), _jsx(Text, { children: description }), _jsx(Link, { href: href, children: cta })] }); }
27
27
  export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow } from './account-block.js';
28
+ export { LoginBlock } from './login-block.js';
29
+ export { DepositBlock } from './deposit-block.js';
28
30
  export { LanguageBlock, filterLanguages } from './language-block.js';
29
31
  export { TokenActionBlock, tokenActionLabel } from './token-action-block.js';
30
32
  export { ManagePositionBlock, positionCorridor } from './manage-position-block.js';
31
33
  export { TradeHistoryListBlock, tradeHistorySide } from './trade-history-list-block.js';
32
34
  export { TradeHistoryDetailBlock } from './trade-history-detail-block.js';
33
35
  export { TargetBlock, targetLayout, targetFormat, targetPresets, targetUnits } from './target-block.js';
36
+ export { AssetsBlock, filterAssets } from './assets-block.js';
34
37
  export { ProfileBlock } from './profile-block.js';
35
38
  export { PositionBlock, PositionBlockHeader } from './position-block.js';
36
39
  export { RewardBlock, rewardProgress } from './reward-block.js';
@@ -39,4 +42,8 @@ export { SignalsBlock } from './signals-block.js';
39
42
  export { NotificationsBlock } from './notifications-block.js';
40
43
  export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, SwapHostContext } from './pickers.js';
41
44
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
42
- export { SwapPanelBlock, SwapPanel, swapAction } from './swap-panel-block.js';
45
+ export { SwapAmountCard, SwapPill } from './swap-amount-card.js';
46
+ export { SwapBlock, SwapPanelBlock, SwapPanel, swapAction } from './swap-block.js';
47
+ export { ConfirmBlock } from './confirm-block.js';
48
+ export { PresetPickerBlock } from './preset-picker-block.js';
49
+ export { ExplainerBlock } from './explainer-block.js';
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check } from '@bloxwap/icons/native/check';
2
3
  import Svg, { Rect, G, Path } from 'react-native-svg';
3
4
  import { brandMark as mark } from '@bloxwap/hig/tokens/brand';
4
5
  import { useColors, useColorSpace } from './provider.js';
5
6
  /** The approved mark. Geometry and fills come from the pinned SVG through `@bloxwap/hig/tokens/brand`, painted in the provider's colour space and independent of its primary colour. */
6
7
  export function BrandMark({ size = 32, label }) { const space = useColorSpace() === 'display-p3' ? 'displayP3' : 'srgb'; return _jsxs(Svg, { width: size, height: size, viewBox: mark.viewBox, accessible: !!label, accessibilityLabel: label, children: [_jsx(Rect, { width: String(mark.size), height: String(mark.size), rx: String(mark.radius), fill: mark.fill[space] }), _jsx(G, { fill: 'none', stroke: mark.stroke[space], strokeWidth: String(mark.strokeWidth), strokeLinecap: mark.strokeLinecap, children: mark.paths.map(d => _jsx(Path, { d: d }, d)) })] }); }
7
- export function CheckIcon() { const colors = useColors(); return _jsx(Svg, { width: '20', height: '20', viewBox: '0 0 24 24', accessible: false, children: _jsx(Path, { d: 'm5 12 4 4 10-10', fill: 'none', stroke: colors.text, strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) }); }
8
+ export function CheckIcon() { const colors = useColors(); return _jsx(Check, { size: 20, color: colors.text }); }
@@ -2,16 +2,21 @@ import React from 'react';
2
2
  import { View, type PressableProps } from 'react-native';
3
3
  import type { Intent } from '@bloxwap/hig/contracts';
4
4
  import { type TextScript } from './surface.js';
5
+ /** A button's intent: the shared `Intent`, a market-direction fill, `up` (buy, long) or `down` (sell, short), that follows `HIGProvider marketColors` (default the buy and sell colours) with a dark label, or `warning`, the warning role's fill with a dark label, for an action that goes ahead despite a caution. */
6
+ export type ButtonIntent = Intent | 'up' | 'down' | 'warning';
5
7
  export interface ButtonProps extends Omit<PressableProps, 'children'> {
6
8
  children: React.ReactNode; /** Custom content renders host nodes directly; the host owns visible busy content. Root disabled/busy/feedback semantics stay canonical. */
7
9
  contentMode?: 'default' | 'custom';
8
- intent?: Intent;
10
+ intent?: ButtonIntent;
9
11
  busy?: boolean; /** Busy text for this button's accessible name; defaults to HIGProvider `messages.busy`. `''` leaves the name unchanged (accessibilityState.busy stays set). The visible busy state is a leading spinner. */
10
12
  busyLabel?: string; /** Overrides the provider's text scale cap for the label. */
11
13
  maxFontSizeMultiplier?: number;
12
14
  script?: TextScript;
13
15
  fullWidth?: boolean;
14
- suppressFeedback?: boolean;
16
+ suppressFeedback?: boolean; /** Makes the button a link: link semantics (`accessibilityRole="link"`), and without `onPress` a press opens this URL through `Linking.openURL`, failures going to `onError`. A host `onPress` replaces that navigation (a router or in-app browser), so one press never opens both. On React Native Web the root also renders the `href`. */
17
+ href?: string; /** Receives a failed `Linking.openURL(href)`. */
18
+ onError?: (error: unknown) => void; /** A soft halo in the fill colour around a filled intent, for one hero action on a brand or marketing surface. No halo while unavailable. */
19
+ glow?: boolean;
15
20
  }
16
21
  /** Android appends its localized busy state; including the suffix there would speak it twice. */
17
22
  export declare function busyAccessibilityLabel(text: string, busyText: string, os?: string): string | undefined;