@bloxwap/hig 0.7.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 (246) 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/messages.d.ts +56 -2
  35. package/contracts/dist/messages.js +20 -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 +10 -1
  47. package/native/dist/account-block.js +17 -7
  48. package/native/dist/animated-number-model.d.ts +41 -1
  49. package/native/dist/animated-number-model.js +201 -23
  50. package/native/dist/animated-number.d.ts +39 -1
  51. package/native/dist/animated-number.js +161 -16
  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 +3 -1
  55. package/native/dist/asset-balance-row.js +15 -4
  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 +2 -0
  65. package/native/dist/bar-mark.js +4 -2
  66. package/native/dist/bar-pnl.js +2 -1
  67. package/native/dist/blocks.d.ts +6 -1
  68. package/native/dist/blocks.js +5 -0
  69. package/native/dist/brand.js +2 -1
  70. package/native/dist/button.d.ts +7 -2
  71. package/native/dist/button.js +13 -3
  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.js +2 -0
  78. package/native/dist/explainer-block.d.ts +91 -0
  79. package/native/dist/explainer-block.js +34 -0
  80. package/native/dist/field.d.ts +5 -1
  81. package/native/dist/field.js +27 -6
  82. package/native/dist/gesture-sheet-model.d.ts +50 -0
  83. package/native/dist/gesture-sheet-model.js +105 -0
  84. package/native/dist/gesture-sheet-next.d.ts +82 -0
  85. package/native/dist/gesture-sheet-next.js +315 -0
  86. package/native/dist/gesture-sheet.d.ts +5 -1
  87. package/native/dist/gesture-sheet.js +13 -6
  88. package/native/dist/icons.d.ts +9 -6
  89. package/native/dist/icons.js +25 -24
  90. package/native/dist/language-block.d.ts +10 -1
  91. package/native/dist/language-block.js +11 -4
  92. package/native/dist/list-group.d.ts +3 -1
  93. package/native/dist/list-group.js +26 -13
  94. package/native/dist/manage-position-block.d.ts +8 -1
  95. package/native/dist/manage-position-block.js +7 -2
  96. package/native/dist/market-row.js +19 -8
  97. package/native/dist/navigation.js +5 -3
  98. package/native/dist/number-format.d.ts +6 -0
  99. package/native/dist/number-format.js +9 -0
  100. package/native/dist/pickers.d.ts +8 -0
  101. package/native/dist/pickers.js +3 -3
  102. package/native/dist/position-block.d.ts +5 -5
  103. package/native/dist/preset-group.d.ts +31 -0
  104. package/native/dist/preset-group.js +39 -0
  105. package/native/dist/preset-picker-block.d.ts +107 -0
  106. package/native/dist/preset-picker-block.js +43 -0
  107. package/native/dist/profile-block.d.ts +10 -1
  108. package/native/dist/profile-block.js +8 -3
  109. package/native/dist/provider.d.ts +5 -2
  110. package/native/dist/provider.js +27 -5
  111. package/native/dist/qr-code.d.ts +33 -0
  112. package/native/dist/qr-code.js +29 -0
  113. package/native/dist/radio-group.d.ts +19 -7
  114. package/native/dist/radio-group.js +39 -10
  115. package/native/dist/reward-block.d.ts +10 -7
  116. package/native/dist/reward-block.js +9 -4
  117. package/native/dist/screen-header.d.ts +13 -3
  118. package/native/dist/screen-header.js +12 -4
  119. package/native/dist/select.js +4 -2
  120. package/native/dist/selection.d.ts +2 -1
  121. package/native/dist/selection.js +1 -0
  122. package/native/dist/setting-switch.d.ts +1 -1
  123. package/native/dist/setting-switch.js +7 -3
  124. package/native/dist/slider.js +5 -1
  125. package/native/dist/sound-haptics-block.js +1 -1
  126. package/native/dist/status.d.ts +41 -9
  127. package/native/dist/status.js +34 -17
  128. package/native/dist/sticky-header.js +9 -1
  129. package/native/dist/swap-amount-card.d.ts +57 -0
  130. package/native/dist/swap-amount-card.js +31 -0
  131. package/native/dist/swap-panel-block.d.ts +9 -3
  132. package/native/dist/swap-panel-block.js +59 -33
  133. package/native/dist/swap-parts.d.ts +3 -10
  134. package/native/dist/swap-parts.js +22 -24
  135. package/native/dist/swap-shared.d.ts +2 -2
  136. package/native/dist/swap-shared.js +10 -6
  137. package/native/dist/swap-views.js +1 -1
  138. package/native/dist/target-block.d.ts +7 -1
  139. package/native/dist/target-block.js +13 -6
  140. package/native/dist/toast.d.ts +47 -0
  141. package/native/dist/toast.js +386 -0
  142. package/native/dist/token-action-block.d.ts +10 -1
  143. package/native/dist/token-action-block.js +9 -4
  144. package/native/dist/trade-history-list-block.js +7 -4
  145. package/native/dist/wallet-address-core.js +6 -3
  146. package/native-fonts/README.md +1 -1
  147. package/og-fonts/README.md +1 -1
  148. package/package.json +111 -2
  149. package/react/README.md +3 -1
  150. package/react/dist/animated-number-flow.d.ts +72 -0
  151. package/react/dist/animated-number-flow.js +316 -0
  152. package/react/dist/animated-number-model.d.ts +18 -0
  153. package/react/dist/animated-number-model.js +75 -5
  154. package/react/dist/animated-number.d.ts +45 -1
  155. package/react/dist/animated-number.js +137 -6
  156. package/react/dist/asset-balance-row.d.ts +3 -1
  157. package/react/dist/asset-balance-row.js +10 -4
  158. package/react/dist/async-result.d.ts +2 -0
  159. package/react/dist/async-result.js +11 -0
  160. package/react/dist/avatar.d.ts +25 -0
  161. package/react/dist/avatar.js +50 -0
  162. package/react/dist/blocks/account-block.d.ts +5 -1
  163. package/react/dist/blocks/account-block.js +11 -6
  164. package/react/dist/blocks/assets-block.d.ts +106 -0
  165. package/react/dist/blocks/assets-block.js +135 -0
  166. package/react/dist/blocks/confirm-block.d.ts +91 -0
  167. package/react/dist/blocks/confirm-block.js +31 -0
  168. package/react/dist/blocks/explainer-block.d.ts +80 -0
  169. package/react/dist/blocks/explainer-block.js +20 -0
  170. package/react/dist/blocks/install-command.js +3 -1
  171. package/react/dist/blocks/language-block.d.ts +5 -1
  172. package/react/dist/blocks/language-block.js +4 -3
  173. package/react/dist/blocks/manage-position-block.d.ts +3 -1
  174. package/react/dist/blocks/manage-position-block.js +2 -2
  175. package/react/dist/blocks/market-row.js +8 -3
  176. package/react/dist/blocks/notifications-block.d.ts +3 -1
  177. package/react/dist/blocks/notifications-block.js +2 -2
  178. package/react/dist/blocks/pickers.d.ts +9 -0
  179. package/react/dist/blocks/pickers.js +4 -2
  180. package/react/dist/blocks/position-block.d.ts +3 -3
  181. package/react/dist/blocks/preset-picker-block.d.ts +85 -0
  182. package/react/dist/blocks/preset-picker-block.js +19 -0
  183. package/react/dist/blocks/profile-block.d.ts +5 -1
  184. package/react/dist/blocks/profile-block.js +12 -13
  185. package/react/dist/blocks/reward-block.d.ts +13 -8
  186. package/react/dist/blocks/reward-block.js +7 -4
  187. package/react/dist/blocks/screen-header.d.ts +10 -2
  188. package/react/dist/blocks/screen-header.js +7 -4
  189. package/react/dist/blocks/setting-switch.js +6 -3
  190. package/react/dist/blocks/signals-block.d.ts +3 -1
  191. package/react/dist/blocks/signals-block.js +4 -3
  192. package/react/dist/blocks/sound-haptics-block.d.ts +3 -1
  193. package/react/dist/blocks/sound-haptics-block.js +2 -2
  194. package/react/dist/blocks/sticky-header.d.ts +14 -4
  195. package/react/dist/blocks/sticky-header.js +68 -8
  196. package/react/dist/blocks/swap/settings.js +2 -1
  197. package/react/dist/blocks/swap/shared.d.ts +22 -22
  198. package/react/dist/blocks/swap/shared.js +30 -28
  199. package/react/dist/blocks/swap-panel-block.d.ts +10 -3
  200. package/react/dist/blocks/swap-panel-block.js +71 -36
  201. package/react/dist/blocks/target-block.d.ts +7 -1
  202. package/react/dist/blocks/target-block.js +10 -4
  203. package/react/dist/blocks/token-action-block.d.ts +5 -1
  204. package/react/dist/blocks/token-action-block.js +2 -2
  205. package/react/dist/blocks/trade-history-detail-block.d.ts +3 -1
  206. package/react/dist/blocks/trade-history-detail-block.js +2 -2
  207. package/react/dist/blocks/trade-history-list-block.d.ts +3 -1
  208. package/react/dist/blocks/trade-history-list-block.js +7 -4
  209. package/react/dist/blocks.d.ts +5 -1
  210. package/react/dist/blocks.js +4 -0
  211. package/react/dist/brand.js +2 -1
  212. package/react/dist/button.d.ts +9 -3
  213. package/react/dist/button.js +8 -3
  214. package/react/dist/confetti.d.ts +27 -0
  215. package/react/dist/confetti.js +240 -0
  216. package/react/dist/data.js +8 -1
  217. package/react/dist/field.d.ts +6 -1
  218. package/react/dist/field.js +18 -9
  219. package/react/dist/gesture-sheet.d.ts +15 -1
  220. package/react/dist/gesture-sheet.js +53 -8
  221. package/react/dist/list-group.js +11 -7
  222. package/react/dist/navigation.js +11 -3
  223. package/react/dist/overlay.d.ts +28 -3
  224. package/react/dist/overlay.js +29 -3
  225. package/react/dist/preset-group.d.ts +30 -0
  226. package/react/dist/preset-group.js +13 -0
  227. package/react/dist/provider.d.ts +2 -2
  228. package/react/dist/provider.js +23 -6
  229. package/react/dist/qr-code.d.ts +32 -0
  230. package/react/dist/qr-code.js +28 -0
  231. package/react/dist/select.js +10 -3
  232. package/react/dist/selection.d.ts +13 -5
  233. package/react/dist/selection.js +13 -8
  234. package/react/dist/slider.js +5 -1
  235. package/react/dist/status.d.ts +14 -10
  236. package/react/dist/status.js +17 -9
  237. package/react/dist/styles.css +238 -163
  238. package/react/dist/toast.d.ts +19 -12
  239. package/react/dist/toast.js +29 -7
  240. package/react/dist/wallet-address-core.d.ts +8 -4
  241. package/react/dist/wallet-address-core.js +10 -5
  242. package/tokens/README.md +2 -2
  243. package/tokens/dist/index.d.ts +16 -0
  244. package/tokens/dist/index.js +16 -0
  245. package/tokens/dist/manifest.json +8 -0
  246. package/tokens/dist/tokens.css +6 -0
@@ -1,6 +1,7 @@
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 { View } from 'react-native';
3
- import { formatNumber } from '@bloxwap/hig/contracts';
3
+ import { StickyHeaderLayout } from './sticky-header.js';
4
+ import { formatNumber } from './number-format.js';
4
5
  import { withAlpha } from '@bloxwap/hig/tokens';
5
6
  import * as en from '@bloxwap/hig/contracts/messages';
6
7
  import { useColors, useHIG, useMessages, useNumberLocale } from './provider.js';
@@ -18,11 +19,15 @@ export const tokenActionLabel = (action, messages) => action.label ?? (action.id
18
19
  /** One token as a screen: a header, where it is held, which chains it sits on, then what the user can do with it. */
19
20
  /** Legend figures inside the block move place by place, like its total. */
20
21
  const animatedFigure = (figure, { testID }) => _jsx(AnimatedNumberReadout, { ...figureProps(figure), tone: 'faint', testID: testID, style: { fontSize: 14, lineHeight: 21 } });
21
- export function TokenActionBlock({ symbol, name, value, units, unitsSuffix, unitsOptions = unitsFormat, assets, chains, chainsTitle, actions, onBack, headerAction, note, noteTone = 'muted', testID }) {
22
+ export function TokenActionBlock({ symbol, name, value, units, unitsSuffix, unitsOptions = unitsFormat, assets, chains, chainsTitle, actions, onBack, headerAction, note, noteTone = 'muted', stickyHeader, stickyHeaderBackground, scrollComponent, headingId, testID }) {
22
23
  const colors = useColors(), t = useMessages(), { direction } = useHIG(), locale = useNumberLocale();
23
24
  const total = value !== undefined ? value : (assets ?? []).reduce((sum, asset) => sum + (held(asset.value) ? asset.value : 0), 0);
24
25
  // With no dollar value the units are the headline, as an AccountBlock row headlines them.
25
26
  const headline = units !== undefined && value == null ? _jsx(AnimatedNumberReadout, { value: units, options: unitsOptions, suffix: unitsSuffix, tone: 'muted', testID: 'token-units', style: { fontSize: 14, lineHeight: 21 } }, 'units') : _jsx(AnimatedNumberReadout, { value: total, options: usd, tone: 'muted', testID: 'token-value', style: { fontSize: 14, lineHeight: 21 } }, 'value');
26
27
  const tone = noteTone === 'warning' ? colors.warning : noteTone === 'negative' ? colors.negative : null;
27
- return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsxs(View, { testID: 'token-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: 'token-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'token-title', accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: symbol }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] }), assets || chains ? _jsx(BarMarkFigureContext.Provider, { value: animatedFigure, children: _jsxs(View, { testID: 'token-bars', style: { gap: 20, marginTop: 16, paddingHorizontal: 4 }, children: [assets ? _jsx(BarMark, { testID: 'token-assets', surface: false, title: name ?? symbol, elements: assets, description: headline }) : null, chains ? _jsx(BarMark, { testID: 'token-chains', surface: false, title: chainsTitle ?? t.swapChains, elements: chains, description: formatNumber(chains.filter(chain => held(chain.value)).length, locale) }) : null] }) }) : null, actions.length > 0 ? _jsx(View, { testID: 'token-actions', style: { gap: 8, marginTop: 16 }, children: actions.map(action => _jsx(Button, { testID: `token-action-${action.id}`, fullWidth: true, intent: action.intent ?? 'secondary', disabled: action.disabled, onPress: action.onSelect, children: tokenActionLabel(action, t) }, action.id)) }) : null, note != null && note !== false ? _jsx(View, { testID: 'token-note', style: [{ marginTop: actions.length > 0 ? 8 : 16 }, tone ? { paddingVertical: 12, paddingHorizontal: 16, borderRadius: 16, backgroundColor: withAlpha(tone, 0.1) } : { paddingHorizontal: 4 }], children: _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: tone ?? colors.muted }, children: note }) }) : null] });
28
+ const header = _jsxs(View, { testID: 'token-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: 'token-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'token-title', nativeID: headingId, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: symbol }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] });
29
+ const body = _jsxs(_Fragment, { children: [assets || chains ? _jsx(BarMarkFigureContext.Provider, { value: animatedFigure, children: _jsxs(View, { testID: 'token-bars', style: { gap: 20, marginTop: 16, paddingHorizontal: 4 }, children: [assets ? _jsx(BarMark, { testID: 'token-assets', surface: false, title: name ?? symbol, elements: assets, description: headline }) : null, chains ? _jsx(BarMark, { testID: 'token-chains', surface: false, title: chainsTitle ?? t.swapChains, elements: chains, description: formatNumber(chains.filter(chain => held(chain.value)).length, locale) }) : null] }) }) : null, actions.length > 0 ? _jsx(View, { testID: 'token-actions', style: { gap: 8, marginTop: 16 }, children: actions.map(action => _jsx(Button, { testID: `token-action-${action.id}`, fullWidth: true, intent: action.intent ?? 'secondary', disabled: action.disabled, onPress: action.onSelect, children: tokenActionLabel(action, t) }, action.id)) }) : null, note != null && note !== false ? _jsx(View, { testID: 'token-note', style: [{ marginTop: actions.length > 0 ? 8 : 16 }, tone ? { paddingVertical: 12, paddingHorizontal: 16, borderRadius: 16, backgroundColor: withAlpha(tone, 0.1) } : { paddingHorizontal: 4 }], children: _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: tone ?? colors.muted }, children: note }) }) : null] });
30
+ if (stickyHeader)
31
+ return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'token-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
32
+ return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
28
33
  }
@@ -1,6 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowUp } from '@bloxwap/icons/native/arrow-up';
3
+ import { ArrowDown } from '@bloxwap/icons/native/arrow-down';
2
4
  import { Image, Pressable, View } from 'react-native';
3
- import { formatNumber } from '@bloxwap/hig/contracts';
5
+ import { formatNumber } from './number-format.js';
4
6
  import { useColors, useFills, useHIG, useNumberLocale, usePresentNumber } from './provider.js';
5
7
  import { Text } from './surface.js';
6
8
  import { ChevronIcon } from './icons.js';
@@ -15,7 +17,7 @@ const avatar = 40, skeletons = [0, 1, 2, 3], dot = '·';
15
17
  const keyOf = (trade) => trade.id;
16
18
  function Gap() { return _jsx(View, { style: { height: 8 } }); }
17
19
  /** Points up; a short turns it over. */
18
- function Arrow({ color, down }) { return _jsxs(View, { style: { width: 12, height: 14, alignItems: 'center', transform: down ? [{ rotate: '180deg' }] : undefined }, children: [_jsx(View, { style: { position: 'absolute', top: 1, width: 7, height: 7, borderLeftWidth: 1.75, borderTopWidth: 1.75, borderColor: color, transform: [{ rotate: '45deg' }] } }), _jsx(View, { style: { width: 1.75, height: 14, borderRadius: 1, backgroundColor: color } })] }); }
20
+ function Arrow({ color, down }) { const Symbol = down ? ArrowDown : ArrowUp; return _jsx(Symbol, { size: 16, color: color }); }
19
21
  /** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the market direction colour, and the net result in the market direction colour over its age. */
20
22
  export function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions = pnlFormat, loading, loadingLabel, error, notice, footer, renderList, listChrome, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
21
23
  const colors = useColors(), fills = useFills(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
@@ -31,10 +33,11 @@ export function TradeHistoryListBlock({ labels, trades, onSelect, onBack, header
31
33
  return onSelect ? _jsxs(Pressable, { testID: testID ? `${testID}-${trade.id}` : undefined, accessibilityRole: 'button', accessibilityLabel: reading, onPress: () => onSelect(trade), style: ({ pressed }) => row(pressed), children: [content, _jsx(View, { ...hidden, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }, trade.id)
32
34
  : _jsx(View, { testID: testID ? `${testID}-${trade.id}` : undefined, accessible: true, accessibilityLabel: reading, style: row(false), children: content }, trade.id);
33
35
  };
34
- const plain = { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20 };
36
+ // The empty and error lines keep 32 above them and none below: the block's (or the host sheet's) 16 bottom inset is the only space under the text.
37
+ const plain = { paddingTop: 32, paddingBottom: 0, textAlign: 'center', fontSize: 14, lineHeight: 20 };
35
38
  const body = loading ? _jsx(View, { testID: testID ? `${testID}-loading` : undefined, accessible: !!loadingLabel, accessibilityLabel: loadingLabel, accessibilityState: { busy: true }, style: { gap: 8 }, children: skeletons.map(index => _jsx(View, { style: { minHeight: 56, borderRadius: 28, backgroundColor: fills.raised } }, index)) })
36
39
  : error ? _jsx(Text, { testID: testID ? `${testID}-error` : undefined, accessibilityRole: 'alert', accessibilityLiveRegion: 'polite', style: { ...plain, color: colors.negative }, children: error })
37
- : trades.length === 0 ? (labels.emptyDescription ? _jsxs(View, { testID: testID ? `${testID}-empty` : undefined, accessible: true, accessibilityLabel: `${labels.empty}, ${labels.emptyDescription}`, style: { paddingVertical: 32, gap: 4 }, children: [_jsx(Text, { style: { ...plain, paddingVertical: 0, fontWeight: '600', color: colors.text }, children: labels.empty }), _jsx(Text, { style: { ...plain, paddingVertical: 0, color: colors.muted }, children: labels.emptyDescription })] }) : _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, style: { ...plain, color: colors.muted }, children: labels.empty }))
40
+ : trades.length === 0 ? (labels.emptyDescription ? _jsxs(View, { testID: testID ? `${testID}-empty` : undefined, accessible: true, accessibilityLabel: `${labels.empty}, ${labels.emptyDescription}`, style: { paddingTop: 32, gap: 4 }, children: [_jsx(Text, { style: { ...plain, paddingTop: 0, fontWeight: '600', color: colors.text }, children: labels.empty }), _jsx(Text, { style: { ...plain, paddingTop: 0, color: colors.muted }, children: labels.emptyDescription })] }) : _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, style: { ...plain, color: colors.muted }, children: labels.empty }))
38
41
  : null;
39
42
  const header = _jsx(ScreenHeader, { testID: testID, title: labels.title, onBack: onBack, action: headerAction });
40
43
  const noticeView = notice != null && notice !== false ? _jsx(View, { testID: testID ? `${testID}-notice` : undefined, style: { gap: 8 }, children: notice }) : null;
@@ -1,4 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Copy } from '@bloxwap/icons/native/copy';
3
+ import { useAsyncResult } from './async-result.js';
2
4
  import { Pressable, View } from 'react-native';
3
5
  import { useColors, useMessages } from './provider.js';
4
6
  import { Text } from './surface.js';
@@ -7,7 +9,7 @@ import { VerticalAddress, addressKind } from './data.js';
7
9
  export { VerticalAddress, addressKind } from './data.js';
8
10
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
9
11
  /** Two overlapping rounded squares: copy. */
10
- function CopyIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 16, height: 16 }, children: [_jsx(View, { style: { position: 'absolute', left: 0, top: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } }), _jsx(View, { style: { position: 'absolute', right: 0, bottom: 0, width: 11, height: 11, borderRadius: 3, borderWidth: 1.5, borderColor: color } })] }); }
12
+ function CopyIcon({ color }) { return _jsx(Copy, { size: 16, color: color }); }
11
13
  /** @internal The layout both `WalletAddress` entries share. `code` is the QR as drawn, already named for assistive technology. */
12
14
  export function WalletAddressFrame({ address, kind, code, size = 196, onCopy, announce = true, testID }) {
13
15
  const colors = useColors();
@@ -15,8 +17,9 @@ export function WalletAddressFrame({ address, kind, code, size = 196, onCopy, an
15
17
  const { notice, show, dismiss } = useTransientNotice();
16
18
  const layout = kind ?? addressKind(address), rows = Math.max(1, Math.ceil(address.length / (layout === 'ethereum' ? 6 : 4)));
17
19
  const body = _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 16 }, children: [_jsx(View, { style: { width: size, height: size }, children: code }), _jsx(VerticalAddress, { address: address, kind: layout, rowHeight: size / rows, testID: 'wallet-address-column' })] }), onCopy ? _jsxs(View, { ...hidden, style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 8, marginTop: 12 }, children: [_jsx(CopyIcon, { color: colors.muted }), _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21 }, children: t.tapToCopy })] }) : null] });
18
- const copy = () => { if (!onCopy)
19
- return; Promise.resolve().then(onCopy).then(() => { if (announce)
20
+ const beginCopy = useAsyncResult(address);
21
+ const copy = () => { const current = beginCopy(); if (!onCopy)
22
+ return; Promise.resolve().then(onCopy).then(() => { if (current() && announce)
20
23
  show(t.addressCopied); }).catch(() => { }); };
21
24
  // The toast sits outside the button so its dismiss control is not nested in another control.
22
25
  return _jsxs(View, { testID: testID, style: { alignItems: 'center' }, children: [onCopy ? _jsx(Pressable, { accessibilityRole: 'button', accessibilityLabel: `${t.copyAddress}: ${address}`, testID: 'wallet-address-copy', onPress: copy, style: ({ pressed }) => ({ opacity: pressed ? 0.8 : 1 }), children: body }) : _jsx(View, { children: body }), notice ? _jsx(View, { style: { marginTop: 8 }, children: _jsx(Toast, { notices: [notice], onDismiss: dismiss }) }) : null] });
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/native-fonts
2
2
 
3
- Version 0.7.0, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
3
+ Version 0.8.1, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
4
4
 
5
5
  Web hosts never import this entry: load fonts through `@bloxwap/font` and use `@bloxwap/hig/tokens/css`. Open Graph card renderers (Satori, `next/og`) use the much smaller `@bloxwap/hig/og-fonts` entry instead (#99).
6
6
 
@@ -1,6 +1,6 @@
1
1
  # @bloxwap/hig/og-fonts
2
2
 
3
- Version 0.7.0, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
3
+ Version 0.8.1, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
4
4
 
5
5
  | Face | File | Weight |
6
6
  | --- | --- | --- |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bloxwap/hig",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
4
4
  "description": "Bloxwap Human Interface Guidelines: tokens, contracts, React and React Native components, chart adapter, feedback and fonts in one package.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -36,11 +36,36 @@
36
36
  "import": "./contracts/dist/announcements.js",
37
37
  "default": "./contracts/dist/announcements.js"
38
38
  },
39
+ "./contracts/number-flow": {
40
+ "types": "./contracts/dist/number-flow.d.ts",
41
+ "import": "./contracts/dist/number-flow.js",
42
+ "default": "./contracts/dist/number-flow.js"
43
+ },
39
44
  "./contracts/messages": {
40
45
  "types": "./contracts/dist/messages.d.ts",
41
46
  "import": "./contracts/dist/messages.js",
42
47
  "default": "./contracts/dist/messages.js"
43
48
  },
49
+ "./contracts/toast": {
50
+ "types": "./contracts/dist/toast.d.ts",
51
+ "import": "./contracts/dist/toast.js",
52
+ "default": "./contracts/dist/toast.js"
53
+ },
54
+ "./contracts/confetti": {
55
+ "types": "./contracts/dist/confetti.d.ts",
56
+ "import": "./contracts/dist/confetti.js",
57
+ "default": "./contracts/dist/confetti.js"
58
+ },
59
+ "./contracts/avatar": {
60
+ "types": "./contracts/dist/avatar.d.ts",
61
+ "import": "./contracts/dist/avatar.js",
62
+ "default": "./contracts/dist/avatar.js"
63
+ },
64
+ "./contracts/qr": {
65
+ "types": "./contracts/dist/qr.d.ts",
66
+ "import": "./contracts/dist/qr.js",
67
+ "default": "./contracts/dist/qr.js"
68
+ },
44
69
  "./native-fonts": {
45
70
  "types": "./native-fonts/dist/index.d.ts",
46
71
  "import": "./native-fonts/dist/index.js",
@@ -140,6 +165,11 @@
140
165
  "import": "./react/dist/status.js",
141
166
  "default": "./react/dist/status.js"
142
167
  },
168
+ "./react/avatar": {
169
+ "types": "./react/dist/avatar.d.ts",
170
+ "import": "./react/dist/avatar.js",
171
+ "default": "./react/dist/avatar.js"
172
+ },
143
173
  "./react/toast": {
144
174
  "types": "./react/dist/toast.d.ts",
145
175
  "import": "./react/dist/toast.js",
@@ -263,6 +293,16 @@
263
293
  "import": "./react/dist/wallet-address-core.js",
264
294
  "default": "./react/dist/wallet-address-core.js"
265
295
  },
296
+ "./react/qr-code": {
297
+ "types": "./react/dist/qr-code.d.ts",
298
+ "import": "./react/dist/qr-code.js",
299
+ "default": "./react/dist/qr-code.js"
300
+ },
301
+ "./native/qr-code": {
302
+ "types": "./native/dist/qr-code.d.ts",
303
+ "import": "./native/dist/qr-code.js",
304
+ "default": "./native/dist/qr-code.js"
305
+ },
266
306
  "./react/asset-balance-row": {
267
307
  "types": "./react/dist/asset-balance-row.d.ts",
268
308
  "import": "./react/dist/asset-balance-row.js",
@@ -333,6 +373,51 @@
333
373
  "import": "./react/dist/blocks/profile-block.js",
334
374
  "default": "./react/dist/blocks/profile-block.js"
335
375
  },
376
+ "./react/blocks/confirm-block": {
377
+ "types": "./react/dist/blocks/confirm-block.d.ts",
378
+ "import": "./react/dist/blocks/confirm-block.js",
379
+ "default": "./react/dist/blocks/confirm-block.js"
380
+ },
381
+ "./native/confirm-block": {
382
+ "types": "./native/dist/confirm-block.d.ts",
383
+ "import": "./native/dist/confirm-block.js",
384
+ "default": "./native/dist/confirm-block.js"
385
+ },
386
+ "./react/blocks/preset-picker-block": {
387
+ "types": "./react/dist/blocks/preset-picker-block.d.ts",
388
+ "import": "./react/dist/blocks/preset-picker-block.js",
389
+ "default": "./react/dist/blocks/preset-picker-block.js"
390
+ },
391
+ "./native/preset-picker-block": {
392
+ "types": "./native/dist/preset-picker-block.d.ts",
393
+ "import": "./native/dist/preset-picker-block.js",
394
+ "default": "./native/dist/preset-picker-block.js"
395
+ },
396
+ "./react/blocks/explainer-block": {
397
+ "types": "./react/dist/blocks/explainer-block.d.ts",
398
+ "import": "./react/dist/blocks/explainer-block.js",
399
+ "default": "./react/dist/blocks/explainer-block.js"
400
+ },
401
+ "./native/explainer-block": {
402
+ "types": "./native/dist/explainer-block.d.ts",
403
+ "import": "./native/dist/explainer-block.js",
404
+ "default": "./native/dist/explainer-block.js"
405
+ },
406
+ "./react/confetti": {
407
+ "types": "./react/dist/confetti.d.ts",
408
+ "import": "./react/dist/confetti.js",
409
+ "default": "./react/dist/confetti.js"
410
+ },
411
+ "./native/confetti": {
412
+ "types": "./native/dist/confetti.d.ts",
413
+ "import": "./native/dist/confetti.js",
414
+ "default": "./native/dist/confetti.js"
415
+ },
416
+ "./react/blocks/assets-block": {
417
+ "types": "./react/dist/blocks/assets-block.d.ts",
418
+ "import": "./react/dist/blocks/assets-block.js",
419
+ "default": "./react/dist/blocks/assets-block.js"
420
+ },
336
421
  "./react/blocks/screen-header": {
337
422
  "types": "./react/dist/blocks/screen-header.d.ts",
338
423
  "import": "./react/dist/blocks/screen-header.js",
@@ -443,6 +528,11 @@
443
528
  "import": "./native/dist/profile-block.js",
444
529
  "default": "./native/dist/profile-block.js"
445
530
  },
531
+ "./native/assets-block": {
532
+ "types": "./native/dist/assets-block.d.ts",
533
+ "import": "./native/dist/assets-block.js",
534
+ "default": "./native/dist/assets-block.js"
535
+ },
446
536
  "./native/screen-header": {
447
537
  "types": "./native/dist/screen-header.d.ts",
448
538
  "import": "./native/dist/screen-header.js",
@@ -513,6 +603,11 @@
513
603
  "import": "./native/dist/status.js",
514
604
  "default": "./native/dist/status.js"
515
605
  },
606
+ "./native/avatar": {
607
+ "types": "./native/dist/avatar.d.ts",
608
+ "import": "./native/dist/avatar.js",
609
+ "default": "./native/dist/avatar.js"
610
+ },
516
611
  "./native/data": {
517
612
  "types": "./native/dist/data.d.ts",
518
613
  "import": "./native/dist/data.js",
@@ -568,11 +663,21 @@
568
663
  "import": "./native/dist/gesture-sheet.js",
569
664
  "default": "./native/dist/gesture-sheet.js"
570
665
  },
666
+ "./native/gesture-sheet-next": {
667
+ "types": "./native/dist/gesture-sheet-next.d.ts",
668
+ "import": "./native/dist/gesture-sheet-next.js",
669
+ "default": "./native/dist/gesture-sheet-next.js"
670
+ },
571
671
  "./native/animated-number": {
572
672
  "types": "./native/dist/animated-number.d.ts",
573
673
  "import": "./native/dist/animated-number.js",
574
674
  "default": "./native/dist/animated-number.js"
575
675
  },
676
+ "./native/toast": {
677
+ "types": "./native/dist/toast.d.ts",
678
+ "import": "./native/dist/toast.js",
679
+ "default": "./native/dist/toast.js"
680
+ },
576
681
  "./package.json": "./package.json"
577
682
  },
578
683
  "files": [
@@ -628,7 +733,8 @@
628
733
  "@gorhom/bottom-sheet": "^5.2.14",
629
734
  "react-native-reanimated": "^4.1.1",
630
735
  "react-native-worklets": "^0.5.1 || ^0.7.4 || ^0.13.0",
631
- "react-native-gesture-handler": "^2.28.0 || ^3.3.0"
736
+ "react-native-gesture-handler": "^2.28.0 || ^3.3.0",
737
+ "@bloxwap/icons": "^0.1.0"
632
738
  },
633
739
  "peerDependenciesMeta": {
634
740
  "react": {
@@ -693,6 +799,9 @@
693
799
  },
694
800
  "react-native-gesture-handler": {
695
801
  "optional": true
802
+ },
803
+ "@bloxwap/icons": {
804
+ "optional": true
696
805
  }
697
806
  },
698
807
  "repository": {
package/react/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # @bloxwap/hig/react
2
2
 
3
- Version 0.7.0, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
3
+ Version 0.8.1, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
4
+
5
+ UI symbols come from `@bloxwap/icons` (install `@bloxwap/icons@^0.1.0`). The web entry renders inline SVG and imports individual icon modules.
4
6
 
5
7
  Set a brand accent with `<HIGProvider primaryColor='#ff0000'>` from
6
8
  `@bloxwap/hig/react/provider`. It accepts opaque sRGB hex (`#RGB` or `#RRGGBB`),
@@ -0,0 +1,72 @@
1
+ import { type NumberFlowTimings } from '@bloxwap/hig/contracts/number-flow';
2
+ /** One timing as the Web Animations API takes it. `fallback` is the curve for a browser without `linear()`. */
3
+ export interface NumberFlowWebTiming {
4
+ duration: number;
5
+ easing: string;
6
+ fallback: string;
7
+ }
8
+ export interface NumberFlowWebMotion {
9
+ spin: NumberFlowWebTiming;
10
+ transform: NumberFlowWebTiming;
11
+ opacity: NumberFlowWebTiming;
12
+ }
13
+ /** One place's turn: how many glyphs, around a reel of what length, starting from which digit when the place is not already turning. */
14
+ export interface NumberFlowSpin {
15
+ delta: number;
16
+ length: number;
17
+ from: number;
18
+ }
19
+ export declare function numberFlowWebMotion(timings: NumberFlowTimings): NumberFlowWebMotion;
20
+ export declare const numberFlowCommit: {
21
+ /** A figure will read and write in the commit that is starting. */
22
+ expect(): void;
23
+ /** That figure has read all it needs: the last one to say so writes for all of them. */
24
+ done(): void;
25
+ };
26
+ /**
27
+ * NumberFlow's motion over elements React drew. React owns the final text of every part; this adds what moves, and removes it
28
+ * when it lands, so nothing here survives into a render:
29
+ * - a window over a turning place and, inside it, a strip of glyphs that rolls through every digit between the old and the new;
30
+ * - a sideways slide for each part whose position changed (first, last, invert, play), so a figure that gains or loses a
31
+ * place closes up instead of jumping;
32
+ * - a fade for parts that arrive, and a fading copy of each part that left;
33
+ * - a clip on the digits (first digit to last, with the separators between) that travels from their old edges to their new
34
+ * ones, so a place arriving or leaving passes under the edge rather than over the sign or the text beside it.
35
+ * A roll or a slide that joins another in flight on the same element is an additive animation on `transform`, so a new value
36
+ * joins the motion instead of restarting it. After the commit that starts it there is no script and no layout per frame.
37
+ * Chromium does not hand an additive animation to its compositor, though: it runs on the main thread, one style recalculation
38
+ * a frame for the parts that move (55 for one 900 ms roll against 6 for a plain one), so a movement that is alone on its
39
+ * element, which is most of them, is written as a plain animation instead (see `retimable`). Fades animate `opacity`, and
40
+ * the clip animates `clip-path` only while the figure changes width.
41
+ */
42
+ export declare class NumberFlowEngine {
43
+ private root;
44
+ private before;
45
+ private extent;
46
+ private clip;
47
+ private readonly reels;
48
+ private readonly slides;
49
+ private readonly running;
50
+ private readonly fades;
51
+ private ghosts;
52
+ private epoch;
53
+ /** The element holding the parts. Fading copies are drawn in the empty layers React left in it: one inside the digits, clipped with them, and one for the signs and affixes around them. */
54
+ attach(root: HTMLElement | null): void;
55
+ /** Whether anything is still moving. */
56
+ get busy(): boolean;
57
+ /** First: where every part is now, read before the commit that changes them. */
58
+ measure(): void;
59
+ /** Last, invert, play: slide every part from where it was, fade in what arrived and fade out a copy of what left. Does nothing without a `measure` since the last call. */
60
+ flip(motion: NumberFlowWebMotion): void;
61
+ /** Turn the places whose digits changed. `glyphs` are the ten digits of the reading's numbering system, zero first. */
62
+ spin(spins: ReadonlyMap<string, NumberFlowSpin>, glyphs: readonly string[], timing: NumberFlowWebTiming): void;
63
+ /** Stop everything where it is going: the parts are left exactly as React drew them. */
64
+ cancel(): void;
65
+ /** Writes now, or with the rest of the commit when other figures are still to read. A `cancel` in between drops it. */
66
+ private write;
67
+ /** Makes room on an element for another movement: one in flight alone becomes its additive twin, where it is and on the same clock. Returns what is still in flight. */
68
+ private join;
69
+ private stop;
70
+ private settle;
71
+ private play;
72
+ }