@bloxwap/hig 0.6.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.md +2 -2
  2. package/chart/README.md +13 -2
  3. package/chart/dist/altimeter-burst.d.ts +4 -0
  4. package/chart/dist/altimeter-burst.js +43 -0
  5. package/chart/dist/altimeter-chart.d.ts +52 -0
  6. package/chart/dist/altimeter-chart.js +275 -0
  7. package/chart/dist/altimeter-model.d.ts +43 -0
  8. package/chart/dist/altimeter-model.js +148 -0
  9. package/chart/dist/altimeter-targets.d.ts +33 -0
  10. package/chart/dist/altimeter-targets.js +88 -0
  11. package/chart/dist/bitcoin-price.d.ts +8 -0
  12. package/chart/dist/bitcoin-price.js +41 -0
  13. package/chart/dist/champions-league.d.ts +19 -0
  14. package/chart/dist/champions-league.js +104 -0
  15. package/chart/dist/index.d.ts +6 -0
  16. package/chart/dist/index.js +5 -0
  17. package/chart/dist/outcome-chart.d.ts +37 -0
  18. package/chart/dist/outcome-chart.js +212 -0
  19. package/chart/dist/outcome-model.d.ts +43 -0
  20. package/chart/dist/outcome-model.js +71 -0
  21. package/chart/dist/plus-grid.d.ts +6 -0
  22. package/chart/dist/plus-grid.js +29 -0
  23. package/contracts/README.md +1 -1
  24. package/contracts/dist/avatar.d.ts +68 -0
  25. package/contracts/dist/avatar.js +93 -0
  26. package/contracts/dist/confetti.d.ts +174 -0
  27. package/contracts/dist/confetti.js +138 -0
  28. package/contracts/dist/decimal.d.ts +7 -0
  29. package/contracts/dist/decimal.js +35 -0
  30. package/contracts/dist/index.d.ts +45 -2
  31. package/contracts/dist/index.js +145 -4
  32. package/contracts/dist/invariants.d.ts +17 -0
  33. package/contracts/dist/invariants.js +24 -0
  34. package/contracts/dist/messages.d.ts +62 -2
  35. package/contracts/dist/messages.js +22 -2
  36. package/contracts/dist/number-flow.d.ts +90 -0
  37. package/contracts/dist/number-flow.js +150 -0
  38. package/contracts/dist/qr.d.ts +151 -0
  39. package/contracts/dist/qr.js +581 -0
  40. package/contracts/dist/toast.d.ts +168 -0
  41. package/contracts/dist/toast.js +171 -0
  42. package/feedback/README.md +1 -1
  43. package/feedback/dist/contract.js +1 -1
  44. package/feedback/dist/react.js +2 -4
  45. package/native/README.md +6 -1
  46. package/native/dist/account-block.d.ts +62 -7
  47. package/native/dist/account-block.js +54 -11
  48. package/native/dist/animated-number-model.d.ts +47 -1
  49. package/native/dist/animated-number-model.js +248 -21
  50. package/native/dist/animated-number.d.ts +41 -1
  51. package/native/dist/animated-number.js +165 -17
  52. package/native/dist/announce.d.ts +2 -0
  53. package/native/dist/announce.js +10 -0
  54. package/native/dist/asset-balance-row.d.ts +19 -1
  55. package/native/dist/asset-balance-row.js +24 -8
  56. package/native/dist/assets-block.d.ts +115 -0
  57. package/native/dist/assets-block.js +87 -0
  58. package/native/dist/async-result.d.ts +2 -0
  59. package/native/dist/async-result.js +11 -0
  60. package/native/dist/avatar-frame.d.ts +29 -0
  61. package/native/dist/avatar-frame.js +56 -0
  62. package/native/dist/avatar.d.ts +21 -0
  63. package/native/dist/avatar.js +31 -0
  64. package/native/dist/bar-mark.d.ts +16 -2
  65. package/native/dist/bar-mark.js +23 -7
  66. package/native/dist/bar-pnl.js +7 -5
  67. package/native/dist/blocks.d.ts +13 -14
  68. package/native/dist/blocks.js +10 -6
  69. package/native/dist/brand.js +2 -1
  70. package/native/dist/button.d.ts +7 -2
  71. package/native/dist/button.js +16 -4
  72. package/native/dist/checkbox.js +2 -1
  73. package/native/dist/confetti.d.ts +33 -0
  74. package/native/dist/confetti.js +143 -0
  75. package/native/dist/confirm-block.d.ts +98 -0
  76. package/native/dist/confirm-block.js +48 -0
  77. package/native/dist/data.d.ts +1 -1
  78. package/native/dist/data.js +8 -4
  79. package/native/dist/explainer-block.d.ts +91 -0
  80. package/native/dist/explainer-block.js +34 -0
  81. package/native/dist/field.d.ts +19 -5
  82. package/native/dist/field.js +56 -9
  83. package/native/dist/figure.d.ts +23 -0
  84. package/native/dist/figure.js +10 -0
  85. package/native/dist/gesture-sheet-model.d.ts +50 -0
  86. package/native/dist/gesture-sheet-model.js +105 -0
  87. package/native/dist/gesture-sheet-next.d.ts +82 -0
  88. package/native/dist/gesture-sheet-next.js +315 -0
  89. package/native/dist/gesture-sheet.d.ts +5 -1
  90. package/native/dist/gesture-sheet.js +13 -6
  91. package/native/dist/icons.d.ts +9 -6
  92. package/native/dist/icons.js +25 -24
  93. package/native/dist/language-block.d.ts +14 -1
  94. package/native/dist/language-block.js +11 -4
  95. package/native/dist/list-group.d.ts +44 -8
  96. package/native/dist/list-group.js +84 -13
  97. package/native/dist/manage-position-block.d.ts +35 -2
  98. package/native/dist/manage-position-block.js +41 -11
  99. package/native/dist/market-row.d.ts +46 -0
  100. package/native/dist/market-row.js +41 -0
  101. package/native/dist/navigation.js +5 -3
  102. package/native/dist/notifications-block.d.ts +30 -2
  103. package/native/dist/notifications-block.js +16 -8
  104. package/native/dist/number-format.d.ts +6 -0
  105. package/native/dist/number-format.js +9 -0
  106. package/native/dist/pickers.d.ts +32 -2
  107. package/native/dist/pickers.js +17 -9
  108. package/native/dist/position-block.d.ts +66 -10
  109. package/native/dist/position-block.js +45 -11
  110. package/native/dist/preset-group.d.ts +31 -0
  111. package/native/dist/preset-group.js +39 -0
  112. package/native/dist/preset-picker-block.d.ts +107 -0
  113. package/native/dist/preset-picker-block.js +43 -0
  114. package/native/dist/profile-block.d.ts +38 -5
  115. package/native/dist/profile-block.js +31 -6
  116. package/native/dist/provider.d.ts +14 -5
  117. package/native/dist/provider.js +32 -6
  118. package/native/dist/qr-code.d.ts +33 -0
  119. package/native/dist/qr-code.js +29 -0
  120. package/native/dist/radio-group.d.ts +23 -5
  121. package/native/dist/radio-group.js +40 -12
  122. package/native/dist/recipes.d.ts +6 -0
  123. package/native/dist/recipes.js +6 -0
  124. package/native/dist/reward-block.d.ts +55 -13
  125. package/native/dist/reward-block.js +37 -14
  126. package/native/dist/screen-header.d.ts +59 -0
  127. package/native/dist/screen-header.js +37 -0
  128. package/native/dist/select.js +4 -2
  129. package/native/dist/selection.d.ts +3 -2
  130. package/native/dist/selection.js +1 -0
  131. package/native/dist/setting-header.d.ts +2 -8
  132. package/native/dist/setting-header.js +2 -11
  133. package/native/dist/setting-switch.d.ts +15 -2
  134. package/native/dist/setting-switch.js +11 -4
  135. package/native/dist/signals-block.d.ts +26 -2
  136. package/native/dist/signals-block.js +14 -4
  137. package/native/dist/slider.js +5 -1
  138. package/native/dist/sound-haptics-block.d.ts +29 -2
  139. package/native/dist/sound-haptics-block.js +19 -8
  140. package/native/dist/status.d.ts +47 -14
  141. package/native/dist/status.js +39 -22
  142. package/native/dist/sticky-header.d.ts +28 -0
  143. package/native/dist/sticky-header.js +29 -0
  144. package/native/dist/surface.d.ts +3 -1
  145. package/native/dist/surface.js +2 -1
  146. package/native/dist/swap-amount-card.d.ts +57 -0
  147. package/native/dist/swap-amount-card.js +31 -0
  148. package/native/dist/swap-panel-block.d.ts +11 -4
  149. package/native/dist/swap-panel-block.js +67 -38
  150. package/native/dist/swap-parts.d.ts +5 -10
  151. package/native/dist/swap-parts.js +22 -24
  152. package/native/dist/swap-shared.d.ts +8 -2
  153. package/native/dist/swap-shared.js +10 -6
  154. package/native/dist/swap-views.js +6 -4
  155. package/native/dist/switch-row.d.ts +3 -2
  156. package/native/dist/switch-row.js +5 -3
  157. package/native/dist/switch.d.ts +4 -2
  158. package/native/dist/switch.js +3 -3
  159. package/native/dist/target-block.d.ts +40 -7
  160. package/native/dist/target-block.js +31 -11
  161. package/native/dist/toast.d.ts +47 -0
  162. package/native/dist/toast.js +386 -0
  163. package/native/dist/token-action-block.d.ts +26 -9
  164. package/native/dist/token-action-block.js +21 -8
  165. package/native/dist/trade-history-detail-block.d.ts +26 -1
  166. package/native/dist/trade-history-detail-block.js +17 -9
  167. package/native/dist/trade-history-list-block.d.ts +71 -5
  168. package/native/dist/trade-history-list-block.js +55 -17
  169. package/native/dist/wallet-address-core.d.ts +25 -0
  170. package/native/dist/wallet-address-core.js +34 -0
  171. package/native/dist/wallet-address.d.ts +6 -10
  172. package/native/dist/wallet-address.js +16 -20
  173. package/native-fonts/README.md +1 -1
  174. package/og-fonts/README.md +1 -1
  175. package/package.json +131 -2
  176. package/react/README.md +3 -1
  177. package/react/dist/animated-number-flow.d.ts +72 -0
  178. package/react/dist/animated-number-flow.js +316 -0
  179. package/react/dist/animated-number-model.d.ts +24 -0
  180. package/react/dist/animated-number-model.js +106 -3
  181. package/react/dist/animated-number.d.ts +49 -1
  182. package/react/dist/animated-number.js +146 -11
  183. package/react/dist/asset-balance-row.d.ts +19 -1
  184. package/react/dist/asset-balance-row.js +17 -3
  185. package/react/dist/async-result.d.ts +2 -0
  186. package/react/dist/async-result.js +11 -0
  187. package/react/dist/avatar.d.ts +25 -0
  188. package/react/dist/avatar.js +50 -0
  189. package/react/dist/bar-mark.d.ts +5 -2
  190. package/react/dist/bar-mark.js +5 -3
  191. package/react/dist/blocks/account-block.d.ts +57 -7
  192. package/react/dist/blocks/account-block.js +51 -11
  193. package/react/dist/blocks/assets-block.d.ts +106 -0
  194. package/react/dist/blocks/assets-block.js +135 -0
  195. package/react/dist/blocks/confirm-block.d.ts +91 -0
  196. package/react/dist/blocks/confirm-block.js +31 -0
  197. package/react/dist/blocks/explainer-block.d.ts +80 -0
  198. package/react/dist/blocks/explainer-block.js +20 -0
  199. package/react/dist/blocks/install-command.js +3 -1
  200. package/react/dist/blocks/language-block.d.ts +9 -1
  201. package/react/dist/blocks/language-block.js +8 -6
  202. package/react/dist/blocks/manage-position-block.d.ts +30 -2
  203. package/react/dist/blocks/manage-position-block.js +23 -4
  204. package/react/dist/blocks/market-row.d.ts +20 -9
  205. package/react/dist/blocks/market-row.js +17 -4
  206. package/react/dist/blocks/notifications-block.d.ts +27 -2
  207. package/react/dist/blocks/notifications-block.js +11 -2
  208. package/react/dist/blocks/pickers.d.ts +30 -1
  209. package/react/dist/blocks/pickers.js +32 -10
  210. package/react/dist/blocks/position-block.d.ts +34 -11
  211. package/react/dist/blocks/position-block.js +16 -5
  212. package/react/dist/blocks/preset-picker-block.d.ts +85 -0
  213. package/react/dist/blocks/preset-picker-block.js +19 -0
  214. package/react/dist/blocks/profile-block.d.ts +33 -6
  215. package/react/dist/blocks/profile-block.js +31 -6
  216. package/react/dist/blocks/reward-block.d.ts +65 -21
  217. package/react/dist/blocks/reward-block.js +24 -11
  218. package/react/dist/blocks/screen-header.d.ts +34 -2
  219. package/react/dist/blocks/screen-header.js +17 -6
  220. package/react/dist/blocks/setting-switch.d.ts +14 -1
  221. package/react/dist/blocks/setting-switch.js +11 -4
  222. package/react/dist/blocks/signals-block.d.ts +23 -2
  223. package/react/dist/blocks/signals-block.js +6 -5
  224. package/react/dist/blocks/sound-haptics-block.d.ts +27 -3
  225. package/react/dist/blocks/sound-haptics-block.js +11 -7
  226. package/react/dist/blocks/sticky-header.d.ts +19 -0
  227. package/react/dist/blocks/sticky-header.js +103 -0
  228. package/react/dist/blocks/swap/amount-card.js +2 -1
  229. package/react/dist/blocks/swap/settings.js +4 -3
  230. package/react/dist/blocks/swap/shared.d.ts +29 -23
  231. package/react/dist/blocks/swap/shared.js +36 -32
  232. package/react/dist/blocks/swap-panel-block.d.ts +12 -3
  233. package/react/dist/blocks/swap-panel-block.js +72 -37
  234. package/react/dist/blocks/target-block.d.ts +35 -7
  235. package/react/dist/blocks/target-block.js +26 -12
  236. package/react/dist/blocks/token-action-block.d.ts +21 -8
  237. package/react/dist/blocks/token-action-block.js +9 -6
  238. package/react/dist/blocks/trade-history-detail-block.d.ts +23 -1
  239. package/react/dist/blocks/trade-history-detail-block.js +5 -4
  240. package/react/dist/blocks/trade-history-list-block.d.ts +31 -5
  241. package/react/dist/blocks/trade-history-list-block.js +20 -10
  242. package/react/dist/blocks.d.ts +12 -8
  243. package/react/dist/blocks.js +6 -2
  244. package/react/dist/brand.js +2 -1
  245. package/react/dist/button.d.ts +9 -3
  246. package/react/dist/button.js +12 -5
  247. package/react/dist/confetti.d.ts +27 -0
  248. package/react/dist/confetti.js +240 -0
  249. package/react/dist/data.js +11 -4
  250. package/react/dist/field.d.ts +20 -5
  251. package/react/dist/field.js +30 -8
  252. package/react/dist/figure.d.ts +23 -0
  253. package/react/dist/figure.js +12 -0
  254. package/react/dist/gesture-sheet.d.ts +15 -1
  255. package/react/dist/gesture-sheet.js +53 -8
  256. package/react/dist/list-group.d.ts +41 -8
  257. package/react/dist/list-group.js +49 -13
  258. package/react/dist/navigation.js +11 -3
  259. package/react/dist/overlay.d.ts +28 -3
  260. package/react/dist/overlay.js +29 -3
  261. package/react/dist/preset-group.d.ts +30 -0
  262. package/react/dist/preset-group.js +13 -0
  263. package/react/dist/provider.d.ts +42 -5
  264. package/react/dist/provider.js +84 -10
  265. package/react/dist/qr-code.d.ts +32 -0
  266. package/react/dist/qr-code.js +28 -0
  267. package/react/dist/select.js +10 -3
  268. package/react/dist/selection.d.ts +18 -4
  269. package/react/dist/selection.js +20 -10
  270. package/react/dist/slider.js +5 -1
  271. package/react/dist/status.d.ts +14 -10
  272. package/react/dist/status.js +17 -9
  273. package/react/dist/styles.css +380 -150
  274. package/react/dist/surface.d.ts +5 -1
  275. package/react/dist/surface.js +1 -1
  276. package/react/dist/toast.d.ts +19 -12
  277. package/react/dist/toast.js +29 -7
  278. package/react/dist/wallet-address-core.d.ts +27 -0
  279. package/react/dist/wallet-address-core.js +29 -0
  280. package/react/dist/wallet-address.d.ts +6 -12
  281. package/react/dist/wallet-address.js +5 -16
  282. package/tokens/README.md +2 -2
  283. package/tokens/dist/index.d.ts +16 -0
  284. package/tokens/dist/index.js +16 -0
  285. package/tokens/dist/manifest.json +8 -0
  286. package/tokens/dist/tokens.css +6 -0
@@ -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 }); }
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type Figure } from './figure.js';
2
3
  /** Colour roles a segment can take. They follow the provider's colour space and market colours as those roles do. */
3
4
  export type BarMarkTone = 'positive' | 'info' | 'warning' | 'negative' | 'muted' | 'faint';
4
5
  export interface BarMarkElement {
@@ -11,9 +12,20 @@ export interface BarMarkElement {
11
12
  tone?: BarMarkTone;
12
13
  /** A host colour for this segment; wins over `tone`. */
13
14
  color?: string;
14
- /** Host-formatted amount shown after the label in the legend, such as `12.4 GB`. */
15
- detail?: string;
15
+ /** Amount shown after the label in the legend: host-formatted text, such as `12.4 GB`, or a live figure. */
16
+ detail?: string | BarMarkFigure;
16
17
  }
18
+ /** A legend amount that can change while the bar is shown: formatted with `options` between `prefix` and `suffix`. `null` reads as unknown. */
19
+ export type BarMarkFigure = Figure;
20
+ /**
21
+ * Draws a live legend figure. The bar-mark entry imports no animation engine, so without a renderer a figure is drawn
22
+ * formatted, without movement. `TokenActionBlock` supplies one that moves place by place through `AnimatedNumberReadout`,
23
+ * and a host that installs the animated-number peers can do the same around its own `BarMark`.
24
+ */
25
+ export type BarMarkFigureRenderer = (figure: BarMarkFigure, props: {
26
+ testID?: string;
27
+ }) => React.ReactNode;
28
+ export declare const BarMarkFigureContext: React.Context<BarMarkFigureRenderer | null>;
17
29
  export interface BarMarkProps {
18
30
  title: string;
19
31
  /** Trailing text on the title row, such as `59.2 GB of 64 GB`. A string is drawn muted; an element is rendered as given. */
@@ -29,6 +41,8 @@ export interface BarMarkProps {
29
41
  surface?: boolean;
30
42
  testID?: string;
31
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;
32
46
  /** The order segments take their colour in when an element names neither `tone` nor `color`. */
33
47
  export declare const barMarkTones: readonly BarMarkTone[];
34
48
  /** Each element's clamped value and its share of the whole, plus the unfilled remainder in the same unit. */
@@ -1,8 +1,13 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useContext } from 'react';
2
3
  import { View } from 'react-native';
3
- import { formatNumber } from '@bloxwap/hig/contracts';
4
- import { useColors, useFills, useHIG } from './provider.js';
4
+ import { formatNumber } from './number-format.js';
5
+ import { useColors, useFills, useHIG, useNumberLocale, usePresentNumber } from './provider.js';
6
+ import { figureReading } from './figure.js';
5
7
  import { Surface, Text } from './surface.js';
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;
6
11
  /** The order segments take their colour in when an element names neither `tone` nor `color`. */
7
12
  export const barMarkTones = ['positive', 'info', 'warning', 'negative', 'muted', 'faint'];
8
13
  const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
@@ -15,7 +20,7 @@ export function barMarkShares(elements, total) {
15
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.
16
21
  function Bar({ elements, values, rest, colors, small, testID }) {
17
22
  const track = useFills().raised;
18
- 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] });
19
24
  }
20
25
  /**
21
26
  * One horizontally stacked bar on a card: the title leads and the description trails, the bar splits into a segment per
@@ -23,12 +28,23 @@ function Bar({ elements, values, rest, colors, small, testID }) {
23
28
  * label, detail and share. Layout follows the provider's direction.
24
29
  */
25
30
  export function BarMark({ title, description, elements, total, legend = true, size = 'default', surface = true, testID }) {
26
- const { locale, direction } = useHIG();
27
- const palette = useColors();
31
+ const { direction } = useHIG();
32
+ const locale = useNumberLocale(), palette = useColors(), present = usePresentNumber(), renderFigure = useContext(BarMarkFigureContext);
28
33
  const { values, shares, rest } = barMarkShares(elements, total);
29
34
  const colors = elements.map((element, index) => element.color ?? palette[element.tone ?? barMarkTones[index % barMarkTones.length]]);
30
- const reading = (element, index) => [element.label, element.detail, formatNumber(shares[index], locale, { style: 'percent', maximumFractionDigits: 1 })].filter(Boolean).join(', ');
35
+ const detailText = (detail) => detail == null || typeof detail === 'string' ? detail : figureReading(detail, locale, present(detail.options));
36
+ const reading = (element, index) => [element.label, detailText(element.detail), formatNumber(shares[index], locale, { style: 'percent', maximumFractionDigits: 1 })].filter(Boolean).join(', ');
37
+ const detailStyle = { color: palette.faint, fontSize: 14, lineHeight: 21 };
38
+ const detail = (element, index) => {
39
+ const value = element.detail;
40
+ if (!value)
41
+ return null;
42
+ const id = testID ? `${testID}-detail-${element.id ?? index}` : undefined;
43
+ if (typeof value === 'string')
44
+ return _jsx(Text, { style: detailStyle, children: value });
45
+ return renderFigure ? renderFigure(value, { testID: id }) : _jsx(Text, { testID: id, style: detailStyle, children: detailText(value) });
46
+ };
31
47
  const group = legend ? {} : { accessible: true, accessibilityLabel: [title, ...elements.map(reading)].join(', ') };
32
- const content = _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: title }), description == null || description === false ? null : typeof description === 'string' || typeof description === 'number' ? _jsx(Text, { style: { color: palette.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: description }) : description] }), _jsx(Bar, { elements: elements, values: values, rest: rest, colors: colors, small: size === 'small', testID: testID }), legend ? _jsx(View, { style: { flexDirection: 'row', flexWrap: 'wrap', columnGap: 16, rowGap: 8 }, children: elements.map((element, index) => _jsxs(View, { accessible: true, accessibilityLabel: reading(element, index), testID: testID ? `${testID}-legend-${element.id ?? index}` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 6 }, children: [_jsx(View, { style: { width: 8, height: 8, borderRadius: 4, backgroundColor: colors[index] } }), _jsx(Text, { style: { color: palette.muted, fontSize: 14, lineHeight: 21 }, children: element.label }), element.detail ? _jsx(Text, { style: { color: palette.faint, fontSize: 14, lineHeight: 21 }, children: element.detail }) : null] }, element.id ?? index)) }) : null] });
48
+ const content = _jsxs(_Fragment, { children: [_jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: title }), description == null || description === false ? null : typeof description === 'string' || typeof description === 'number' ? _jsx(Text, { style: { color: palette.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: description }) : description] }), _jsx(Bar, { elements: elements, values: values, rest: rest, colors: colors, small: size === 'small', testID: testID }), legend ? _jsx(View, { style: { flexDirection: 'row', flexWrap: 'wrap', columnGap: 16, rowGap: 8 }, children: elements.map((element, index) => _jsxs(View, { accessible: true, accessibilityLabel: reading(element, index), testID: testID ? `${testID}-legend-${element.id ?? index}` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 6 }, children: [_jsx(View, { style: { width: 8, height: 8, borderRadius: 4, backgroundColor: colors[index] } }), _jsx(Text, { style: { color: palette.muted, fontSize: 14, lineHeight: 21 }, children: element.label }), detail(element, index)] }, element.id ?? index)) }) : null] });
33
49
  return surface ? _jsx(Surface, { testID: testID, style: { gap: 12 }, ...group, children: content }) : _jsx(View, { testID: testID, style: { direction, gap: 12, minWidth: 0 }, ...group, children: content });
34
50
  }
@@ -1,7 +1,8 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { View } from 'react-native';
3
- import { useColors, useFills, useHIG } from './provider.js';
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' };
@@ -40,20 +41,21 @@ export function barPnlLayout({ entry, mark, liquidation, side, fit }) {
40
41
  }
41
42
  /** A position's profit or loss as one bar: the stretch between entry and mark is filled solid in the result colour, a tick marks each price, and the liquidation, mark and entry prices read under the bar in price order, so mark and entry trade places as the position moves. The bar is decorative; each readout reads its label and price. */
42
43
  export function BarPnl({ entry, mark, liquidation, side, labels, title, description, priceOptions = usd, compact = false, fit = false, surface = true, testID }) {
43
- const colors = useColors(), { locale, direction } = useHIG();
44
+ const colors = useColors(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
44
45
  const { result, positions, order } = barPnlLayout({ entry, mark, liquidation, side, fit });
45
- const tone = result === 'profit' ? colors.positive : result === 'loss' ? colors.negative : colors.muted;
46
+ // The result follows the market direction roles (HIGProvider marketColors), which default to buy and sell.
47
+ const tone = result === 'profit' ? colors.up : result === 'loss' ? colors.down : colors.muted;
46
48
  const from = Math.min(positions.entry ?? 0.5, positions.mark ?? 0.5), to = Math.max(positions.entry ?? 0.5, positions.mark ?? 0.5);
47
49
  const markLeads = (positions.mark ?? 0) < (positions.entry ?? 0);
48
50
  const values = { liquidation, mark, entry };
49
51
  const format = (kind) => compact ? barPnlCompactOptions(values[kind], priceOptions) : priceOptions;
50
52
  const align = (index) => order.length > 1 && index === order.length - 1 ? 'flex-end' : order.length === 3 && index === 1 ? 'center' : 'flex-start';
51
- const content = _jsxs(_Fragment, { children: [title || description != null ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [title ? _jsx(Text, { accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: title }) : _jsx(View, {}), description == null || description === false ? null : typeof description === 'string' || typeof description === 'number' ? _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: description }) : description] }) : null, _jsx(Bar, { from: from, to: to, markLeads: markLeads, tone: tone, liquidation: positions.liquidation, testID: testID }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'space-between', gap: 12 }, children: order.map((kind, index) => _jsxs(View, { accessible: true, accessibilityLabel: `${labels[kind]}, ${formatNumberReadout(values[kind], locale, format(kind)).text}`, testID: testID ? `${testID}-${kind}` : undefined, style: { alignItems: align(index), flexShrink: 1, minWidth: 0 }, children: [_jsx(View, { ...hidden, children: _jsx(AnimatedNumberReadout, { value: values[kind], options: format(kind), tone: kind === 'liquidation' ? 'negative' : kind === 'mark' && result !== 'flat' ? (result === 'profit' ? 'positive' : 'negative') : 'text', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { color: colors.muted, fontSize: 12, lineHeight: 16 }, children: labels[kind] })] }, kind)) })] });
53
+ const content = _jsxs(_Fragment, { children: [title || description != null ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [title ? _jsx(Text, { accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: title }) : _jsx(View, {}), description == null || description === false ? null : typeof description === 'string' || typeof description === 'number' ? _jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: description }) : description] }) : null, _jsx(Bar, { from: from, to: to, markLeads: markLeads, tone: tone, liquidation: positions.liquidation, testID: testID }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'space-between', gap: 12 }, children: order.map((kind, index) => _jsxs(View, { accessible: true, accessibilityLabel: `${labels[kind]}, ${formatNumberReadout(values[kind], locale, present(format(kind))).text}`, testID: testID ? `${testID}-${kind}` : undefined, style: { alignItems: align(index), flexShrink: 1, minWidth: 0 }, children: [_jsx(View, { ...hidden, children: _jsx(AnimatedNumberReadout, { value: values[kind], options: format(kind), tone: kind === 'liquidation' ? 'negative' : kind === 'mark' && result !== 'flat' ? (result === 'profit' ? 'up' : 'down') : 'text', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { color: colors.muted, fontSize: 12, lineHeight: 16 }, children: labels[kind] })] }, kind)) })] });
52
54
  return surface ? _jsx(Surface, { testID: testID, style: { gap: 12 }, children: content }) : _jsx(View, { testID: testID, style: { direction, gap: 12, minWidth: 0 }, children: content });
53
55
  }
54
56
  // Inside the Surface, so the track takes the fill that sits one step above the card.
55
57
  function Bar({ from, to, markLeads, tone, liquidation, testID }) {
56
58
  const colors = useColors(), track = useFills().raised;
57
59
  const part = (grow) => ({ flexGrow: grow, flexShrink: 1, flexBasis: 0, backgroundColor: track });
58
- 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 } })] });
59
61
  }
@@ -1,11 +1,5 @@
1
1
  import React from 'react';
2
- export declare function MarketRow({ symbol, name, price, change, onSelect }: {
3
- symbol: string;
4
- name: string;
5
- price: number | null;
6
- change: number | null;
7
- onSelect: () => void;
8
- }): React.JSX.Element;
2
+ export { MarketRow, type MarketRowProps } from './market-row.js';
9
3
  export declare function TradeEntry({ asset, amount, onAmountChange, onConfirm, busy, error, available }: {
10
4
  asset: string;
11
5
  amount: string;
@@ -26,19 +20,24 @@ export declare function MarketingHero({ title, description, href, cta }: {
26
20
  href: string;
27
21
  cta: string;
28
22
  }): React.JSX.Element;
29
- export { AccountBlock, accountRows, assetValue, AssetBalanceRow, type AccountBlockProps, type AccountAsset, type AssetArtwork, type AssetBalanceRowProps } from './account-block.js';
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';
30
24
  export { LanguageBlock, filterLanguages, type LanguageBlockProps, type LanguageOption } from './language-block.js';
31
25
  export { TokenActionBlock, tokenActionLabel, type TokenActionBlockProps, type TokenAction, type TokenActionId } from './token-action-block.js';
32
- export { ManagePositionBlock, positionCorridor, type ManagePositionBlockProps, type ManagePositionBlockLabels, type ManagePositionBlockAction, type ManagePositionBlockSummary } from './manage-position-block.js';
26
+ export { ManagePositionBlock, positionCorridor, type ManagePositionBlockProps, type ManagePositionBlockLabels, type ManagePositionBlockAction, type ManagePositionBlockSummary, type ManagePositionBlockFigure, type ManagePositionIcon } from './manage-position-block.js';
33
27
  export { TradeHistoryListBlock, tradeHistorySide, type TradeHistoryListBlockProps, type TradeHistoryListLabels, type TradeHistoryItem } from './trade-history-list-block.js';
34
28
  export { TradeHistoryDetailBlock, type TradeHistoryDetailBlockProps, type TradeHistoryDetailLabels, type TradeHistoryDetail, type TradeHistoryAction } from './trade-history-detail-block.js';
35
- export { TargetBlock, targetLayout, targetFormat, type TargetBlockProps, type TargetBlockLabels, type TargetKind, type TargetUnit, type TargetPrice } from './target-block.js';
36
- export { ProfileBlock, type ProfileBlockProps, type ProfileRow, type ProfileSection, type ProfileStatus } from './profile-block.js';
37
- export { PositionBlock, type PositionBlockProps, type PositionBlockDetail, type PositionBlockFigure, type PositionBlockRow, type PositionBlockFlag } from './position-block.js';
29
+ export { TargetBlock, targetLayout, targetFormat, targetPresets, targetUnits, type TargetBlockProps, type TargetBlockLabels, type TargetKind, type TargetUnit, type TargetPrice, type TargetPreset, type TargetUnitOption } from './target-block.js';
30
+ export { AssetsBlock, filterAssets, type AssetsBlockProps, type AssetItem, type AssetCategory, type AssetSignal, type AssetsView, type AssetsEmptyAction } from './assets-block.js';
31
+ export { ProfileBlock, type ProfileBlockProps, type ProfileRow, type ProfileSection, type ProfileStatus, type ProfileAction, type ProfileFigure } from './profile-block.js';
32
+ export { PositionBlock, PositionBlockHeader, type PositionBlockProps, type PositionBlockHeaderProps, type PositionBlockDetail, type PositionBlockFigure, type PositionBlockRow, type PositionBlockFlag, type PositionBlockFlagAction } from './position-block.js';
38
33
  export { RewardBlock, rewardProgress, type RewardBlockProps, type RewardPromo, type RewardEntry } from './reward-block.js';
39
- export { SoundHapticsBlock, soundLevel, type SoundHapticsBlockProps, type SoundSection, type SoundVolume } from './sound-haptics-block.js';
34
+ export { SoundHapticsBlock, soundLevel, type SoundHapticsBlockProps, type SoundSection, type SoundVolume, type SettingAction } from './sound-haptics-block.js';
40
35
  export { SignalsBlock, type SignalsBlockProps, type SignalsGroup, type SignalsItem } from './signals-block.js';
41
36
  export { NotificationsBlock, type NotificationsBlockProps, type NotificationsItem } from './notifications-block.js';
42
- export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps } from './pickers.js';
37
+ export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps, type PickerInputProps, type PickerRowProps, SwapHostContext } from './pickers.js';
43
38
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
39
+ export { SwapAmountCard, SwapPill, type SwapAmountCardProps, type SwapPillProps } from './swap-amount-card.js';
44
40
  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 { ConfirmBlock, type ConfirmBlockProps, type ConfirmDetail, type ConfirmTertiaryAction } from './confirm-block.js';
42
+ export { PresetPickerBlock, type PresetPickerBlockProps, type PresetPickerCustom, type PresetPickerAdjustable } from './preset-picker-block.js';
43
+ export { ExplainerBlock, type ExplainerBlockProps, type ExplainerSection, type ExplainerAction, type ExplainerTone } from './explainer-block.js';
@@ -7,9 +7,8 @@ import { Button, Link } from './button.js';
7
7
  import { Surface, Stack, Heading, Text } from './surface.js';
8
8
  import { Field, Input } from './field.js';
9
9
  import { Dialog } from './overlay.js';
10
- import { Row, Usd, Percent } from './data.js';
11
10
  import { Toast, useTransientNotice } from './status.js';
12
- export function MarketRow({ symbol, name, price, change, onSelect }) { return _jsxs(Row, { children: [_jsxs(Button, { intent: 'ghost', onPress: onSelect, children: [name, " (", symbol, ")"] }), _jsx(Usd, { value: price }), _jsx(Percent, { value: change })] }); }
11
+ export { MarketRow } from './market-row.js';
13
12
  /** The call to action that closes a form sits a double step, 16dp, below it (the Stack gap is 12). */
14
13
  const formAction = { marginTop: 4 };
15
14
  /** In a dialog the confirm action is 16dp below the content and 8dp above the dialog's own closing button, which adds 4dp itself. */
@@ -25,19 +24,24 @@ export function InstallCommand({ command, onCopy }) {
25
24
  return _jsxs(Surface, { style: { gap: 12 }, children: [_jsx(Text, { selectable: true, style: code, children: command }), _jsx(Button, { intent: 'secondary', onPress: () => { Promise.resolve().then(onCopy).then(() => show(messages.copied ?? en.copied, 'success')).catch(() => show(messages.copyFailed ?? en.copyFailed, 'error')); }, children: messages.copyInstallCommand ?? en.copyInstallCommand }), notice && _jsx(Toast, { notices: [notice], onDismiss: dismiss })] });
26
25
  }
27
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 })] }); }
28
- export { AccountBlock, accountRows, assetValue, AssetBalanceRow } from './account-block.js';
27
+ export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow } from './account-block.js';
29
28
  export { LanguageBlock, filterLanguages } from './language-block.js';
30
29
  export { TokenActionBlock, tokenActionLabel } from './token-action-block.js';
31
30
  export { ManagePositionBlock, positionCorridor } from './manage-position-block.js';
32
31
  export { TradeHistoryListBlock, tradeHistorySide } from './trade-history-list-block.js';
33
32
  export { TradeHistoryDetailBlock } from './trade-history-detail-block.js';
34
- export { TargetBlock, targetLayout, targetFormat } from './target-block.js';
33
+ export { TargetBlock, targetLayout, targetFormat, targetPresets, targetUnits } from './target-block.js';
34
+ export { AssetsBlock, filterAssets } from './assets-block.js';
35
35
  export { ProfileBlock } from './profile-block.js';
36
- export { PositionBlock } from './position-block.js';
36
+ export { PositionBlock, PositionBlockHeader } from './position-block.js';
37
37
  export { RewardBlock, rewardProgress } from './reward-block.js';
38
38
  export { SoundHapticsBlock, soundLevel } from './sound-haptics-block.js';
39
39
  export { SignalsBlock } from './signals-block.js';
40
40
  export { NotificationsBlock } from './notifications-block.js';
41
- export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker } from './pickers.js';
41
+ export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, SwapHostContext } from './pickers.js';
42
42
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
43
+ export { SwapAmountCard, SwapPill } from './swap-amount-card.js';
43
44
  export { SwapPanelBlock, SwapPanel, swapAction } from './swap-panel-block.js';
45
+ export { ConfirmBlock } from './confirm-block.js';
46
+ export { PresetPickerBlock } from './preset-picker-block.js';
47
+ 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;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { forwardRef, useId, useRef } from 'react';
3
- import { ActivityIndicator, Pressable, Linking, Platform, View } from 'react-native';
3
+ import { ActivityIndicator, Pressable, Linking, Platform, View, processColor } from 'react-native';
4
4
  import * as en from '@bloxwap/hig/contracts/messages';
5
5
  import { useColors, useFills, useHIG } from './provider.js';
6
6
  import { Text } from './surface.js';
@@ -16,18 +16,30 @@ function labelRuns(children) { const runs = []; for (const child of React.Childr
16
16
  } return runs; }
17
17
  /** A 44dp control keeps a 48dp touch target. */
18
18
  const touchSlop = { top: 2, bottom: 2 };
19
+ /** An icon button is 44dp both ways, so its 48dp target reaches out on every side. */
20
+ const iconSlop = { top: 2, bottom: 2, left: 2, right: 2 };
21
+ /** `fill` at `alpha` of its own opacity: `#rrggbb` gains an alpha byte; any other React Native colour string (`#rgb`, `rgb()`, `hsl()`, a named colour, as `HIGProvider marketColors` may pass) is parsed with processColor into `rgba()`. A platform colour object has no channels to read and gets none. */
22
+ function translucent(fill, alpha) { if (/^#[0-9a-f]{6}$/i.test(fill))
23
+ return `${fill}${Math.round(alpha * 255).toString(16).padStart(2, '0')}`; const argb = processColor(fill); if (typeof argb !== 'number')
24
+ return undefined; const n = argb >>> 0; return `rgba(${(n >> 16) & 255},${(n >> 8) & 255},${n & 255},${Number(((n >>> 24) / 255 * alpha).toFixed(3))})`; }
25
+ const halo = (fill) => { const near = translucent(fill, .45), far = translucent(fill, .2); return near && far ? `0 0 60px 8px ${near}, 0 0 120px 20px ${far}` : undefined; };
19
26
  /** Android appends its localized busy state; including the suffix there would speak it twice. */
20
27
  export function busyAccessibilityLabel(text, busyText, os = Platform.OS) { return text ? (busyText && os !== 'android' ? `${text} · ${busyText}` : text) : undefined; }
21
- export const Button = /* @__PURE__ */ forwardRef(function Button({ children, contentMode = 'default', intent = 'primary', disabled, busy, busyLabel, maxFontSizeMultiplier, script, fullWidth, suppressFeedback, onPress, style, ...props }, ref) { const env = useHIG(); const colors = useColors(); const fills = useFills(); const id = useId(); const sequence = useRef(0); const busyText = busyLabel ?? env.messages.busy ?? en.busy; const filled = intent === 'primary' || intent === 'destructive'; /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ const inert = !!disabled && !busy; const label = plainText(children); const accessibleLabel = props.accessibilityLabel ?? (busy ? busyAccessibilityLabel(label, busyText) : undefined); const labelStyle = { color: inert ? (intent === 'ghost' ? colors.faint : colors.muted) : intent === 'destructive' ? colors.background : intent === 'primary' ? colors.onAction : intent === 'ghost' ? colors.muted : colors.text, fontSize: 16, fontWeight: '600', textAlign: 'center' }; return _jsx(Pressable, { ...props, ref: ref, disabled: disabled || busy, accessibilityRole: 'button', accessibilityLabel: accessibleLabel, accessibilityState: { ...props.accessibilityState, disabled: !!disabled || !!busy, busy: !!busy }, "aria-busy": !!busy, onPress: e => { if (disabled || busy)
28
+ export const Button = /* @__PURE__ */ forwardRef(function Button({ children, contentMode = 'default', intent = 'primary', disabled, busy, busyLabel, maxFontSizeMultiplier, script, fullWidth, suppressFeedback, onPress, style, href, onError, glow, ...props }, ref) { const link = href !== undefined; const web = Platform.OS === 'web'; const env = useHIG(); const colors = useColors(); const fills = useFills(); const id = useId(); const sequence = useRef(0); const busyText = busyLabel ?? env.messages.busy ?? en.busy; const dark = intent === 'destructive' || intent === 'up' || intent === 'down' || intent === 'warning'; const filled = intent === 'primary' || dark; /* Market-direction and warning fills take the dark label destructive uses; market fills follow HIGProvider marketColors. */ /* Market-direction and warning fills take the dark label destructive uses; market fills follow HIGProvider marketColors. */ const fill = intent === 'destructive' ? colors.negative : intent === 'up' ? colors.up : intent === 'down' ? colors.down : intent === 'warning' ? colors.warning : colors.action; /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ const inert = !!disabled && !busy; const label = plainText(children); const runs = labelRuns(children); /* A glyph beside the label (an action icon) stays on the label's last line: the row does not wrap and the label shrinks to wrap its own words instead. A text-only label keeps the wrapping row. */ /* A glyph beside the label (an action icon) stays on the label's last line: the row does not wrap and the label shrinks to wrap its own words instead. A text-only label keeps the wrapping row. */ const withNode = runs.some(child => typeof child !== 'string'); const accessibleLabel = props.accessibilityLabel ?? (busy ? busyAccessibilityLabel(label, busyText) : undefined); const labelStyle = { color: inert ? (intent === 'ghost' ? colors.faint : colors.muted) : dark ? colors.background : intent === 'primary' ? colors.onAction : intent === 'ghost' ? colors.muted : colors.text, fontSize: 16, fontWeight: '600', textAlign: 'center' }; return _jsx(Pressable, { ...props, ...(web && link && !disabled && !busy ? { href } : {}), ref: ref, disabled: disabled || busy, accessibilityRole: link ? 'link' : 'button', accessibilityLabel: accessibleLabel, accessibilityState: { ...props.accessibilityState, disabled: !!disabled || !!busy, busy: !!busy }, "aria-busy": !!busy, onPress: e => { if (disabled || busy)
22
29
  return; e.stopPropagation(); onPress?.(e); if (!e.isDefaultPrevented() && !disabled && !busy && !suppressFeedback) {
23
30
  try {
24
31
  env.onAccepted?.(id);
25
32
  env.feedback?.emit({ id: `${id}/${++sequence.current}`, source: id, intent: 'activate', origin: 'native' });
26
33
  }
27
34
  catch { /* Best effort only. */ }
28
- } }, hitSlop: props.hitSlop ?? touchSlop, style: state => [{ minHeight: 44, paddingHorizontal: 20, paddingVertical: 10, borderRadius: 9999, alignItems: 'center', justifyContent: 'center', backgroundColor: inert ? (intent === 'ghost' ? 'transparent' : fills.well) : filled ? (intent === 'destructive' ? colors.negative : colors.action) : intent === 'ghost' && !state.pressed ? 'transparent' : colors.nested, opacity: busy ? 0.7 : state.pressed && !inert ? 0.85 : 1, alignSelf: fullWidth ? 'stretch' : 'flex-start' }, typeof style === 'function' ? style(state) : style], children: contentMode === 'custom' ? children : _jsxs(View, { style: { direction: env.direction, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8 }, children: [busy ? _jsx(ActivityIndicator, { size: 'small', color: labelStyle.color, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' }) : null, labelRuns(children).map((child, i) => typeof child === 'string' ? _jsx(Text, { script: script, maxFontSizeMultiplier: maxFontSizeMultiplier, style: labelStyle, children: child }, `label-${i}`) : child)] }) }); });
35
+ } /* Like Link: host navigation replaces Linking, and the web anchor never navigates on its own as well. */ /* Like Link: host navigation replaces Linking, and the web anchor never navigates on its own as well. */ if (link) {
36
+ if (!onPress)
37
+ void Linking.openURL(href).catch(onError ?? (() => { }));
38
+ if (web)
39
+ e.preventDefault();
40
+ } }, hitSlop: props.hitSlop ?? touchSlop, style: state => [{ minHeight: 44, paddingHorizontal: 20, paddingVertical: 10, borderRadius: 9999, alignItems: 'center', justifyContent: 'center', backgroundColor: inert ? (intent === 'ghost' ? 'transparent' : fills.well) : filled ? fill : intent === 'ghost' && !state.pressed ? 'transparent' : colors.nested, opacity: busy ? 0.7 : state.pressed && !inert ? 0.85 : 1, alignSelf: fullWidth ? 'stretch' : 'flex-start', ...(glow && filled && !inert ? { boxShadow: halo(fill) } : null) }, typeof style === 'function' ? style(state) : style], children: contentMode === 'custom' ? children : _jsxs(View, { style: { direction: env.direction, flexDirection: 'row', flexWrap: withNode ? 'nowrap' : 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8 }, children: [busy ? _jsx(ActivityIndicator, { size: 'small', color: labelStyle.color, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' }) : null, runs.map((child, i) => typeof child === 'string' ? _jsx(Text, { script: script, maxFontSizeMultiplier: maxFontSizeMultiplier, style: withNode ? [labelStyle, { flexShrink: 1 }] : labelStyle, children: child }, `label-${i}`) : child)] }) }); });
29
41
  /** While busy, the spinner takes the icon's place. */
30
- export function IconButton({ label, children, style, ...props }) { return _jsx(Button, { ...props, accessibilityLabel: label, style: state => [{ minWidth: 44, paddingHorizontal: 10 }, typeof style === 'function' ? style(state) : style], children: props.busy && props.contentMode !== 'custom' ? null : children }); }
42
+ export function IconButton({ label, children, style, ...props }) { return _jsx(Button, { ...props, hitSlop: props.hitSlop ?? iconSlop, accessibilityLabel: label, style: state => [{ minWidth: 44, paddingHorizontal: 10 }, typeof style === 'function' ? style(state) : style], children: props.busy && props.contentMode !== 'custom' ? null : children }); }
31
43
  export const Link = /* @__PURE__ */ forwardRef(function Link({ href, children, onError, onPress, contentMode = 'default', disabled, style, ...props }, ref) { const colors = useColors(); const web = Platform.OS === 'web', webHref = web && !disabled ? { href } : {}; return _jsx(Pressable, { ...props, ...webHref, ref: ref, accessibilityRole: 'link', disabled: disabled, accessibilityState: { ...props.accessibilityState, disabled: !!disabled }, "aria-busy": props.accessibilityState?.busy, onPress: event => { if (disabled)
32
44
  return; if (onPress)
33
45
  onPress(event);
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Check } from '@bloxwap/icons/native/check';
2
3
  import { Pressable, View } from 'react-native';
3
4
  import { nativeMetrics as tokens } from '@bloxwap/hig/tokens';
4
5
  import { useColors, useControllable, useHIG } from './provider.js';
@@ -7,5 +8,5 @@ export function Checkbox({ label, checked, defaultChecked = false, disabled, onC
7
8
  const [current, set] = useControllable(checked, defaultChecked, onCheckedChange);
8
9
  const colors = useColors(), env = useHIG();
9
10
  return _jsxs(Pressable, { accessibilityRole: 'checkbox', "aria-checked": current, "aria-disabled": !!disabled, accessibilityLabel: label, accessibilityState: { checked: current, disabled: !!disabled }, disabled: disabled, onPress: () => { if (!disabled)
10
- set(!current); }, style: { direction: env.direction, minHeight: 48, flexDirection: 'row', alignItems: 'center', gap: tokens.space.sm, opacity: disabled ? .5 : 1 }, children: [_jsx(View, { pointerEvents: 'none', accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', "aria-hidden": true, style: { width: 20, height: 20, flexShrink: 0, borderWidth: 1.5, borderColor: current ? colors.action : colors.muted, borderRadius: tokens.radius.sm, backgroundColor: current ? colors.action : colors.surface, alignItems: 'center', justifyContent: 'center' }, children: current && _jsx(View, { style: { width: 10, height: 6, borderLeftWidth: 2, borderBottomWidth: 2, borderColor: colors.onAction, transform: [{ translateY: -1 }, { rotate: '-45deg' }] } }) }), _jsx(Text, { style: { flexShrink: 1, minWidth: 0 }, children: label })] });
11
+ set(!current); }, style: { direction: env.direction, minHeight: 48, flexDirection: 'row', alignItems: 'center', gap: tokens.space.sm, opacity: disabled ? .5 : 1 }, children: [_jsx(View, { pointerEvents: 'none', accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', "aria-hidden": true, style: { width: 20, height: 20, flexShrink: 0, borderWidth: 1.5, borderColor: current ? colors.action : colors.muted, borderRadius: tokens.radius.sm, backgroundColor: current ? colors.action : colors.surface, alignItems: 'center', justifyContent: 'center' }, children: current && _jsx(Check, { size: 14, color: colors.onAction }) }), _jsx(Text, { style: { flexShrink: 1, minWidth: 0 }, children: label })] });
11
12
  }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
+ import { type ConfettiOptions } from '@bloxwap/hig/contracts/confetti';
4
+ export { mirrorConfetti, type ConfettiOptions, type ConfettiShape } from '@bloxwap/hig/contracts/confetti';
5
+ export interface ConfettiFire {
6
+ /** Fires one burst in the most recently mounted `Confetti` and resolves when it has finished, or at once when nothing is drawn: no `Confetti` is mounted, reduced motion is on (unless `disableForReducedMotion` is false) or the burst has no pieces. */
7
+ (options?: ConfettiOptions): Promise<void>;
8
+ /** Stops every burst now, also one still waiting for its layer, removes its views and resolves their promises. */
9
+ reset(): void;
10
+ }
11
+ /** Fires a burst of confetti. Call it from an event handler or an effect; mount `Confetti` once first. */
12
+ export declare const confetti: ConfettiFire;
13
+ export interface ConfettiProps {
14
+ /** Fires `options` whenever it is truthy: on mount, and each time it changes to another truthy value. A win count or an order id works. Leave it out to fire only through `confetti()`. */
15
+ trigger?: unknown;
16
+ /** The burst `trigger` fires, or several fired together. Read when `trigger` changes, so it need not be a stable object. */
17
+ options?: ConfettiOptions | readonly ConfettiOptions[];
18
+ /** Merged over the layer, which fills its parent and takes no touches. */
19
+ style?: StyleProp<ViewStyle>;
20
+ /** Test ID of the layer. */
21
+ testID?: string;
22
+ }
23
+ /**
24
+ * The confetti layer. Mount it once, last inside the screen root and inside HIGProvider, so it covers what it should rain
25
+ * over. Bursts follow the provider's `reducedMotion` and paint its `action`, `info`, `down`, `warning` and `up` colours
26
+ * (Display P3 on an iOS host that paints P3) unless the call names its own. The layer is hidden from assistive technology
27
+ * and stays left-to-right, because confetti is physical: `origin.x` 0 is the left edge in both text directions.
28
+ *
29
+ * HIGProvider learns the system's reduced motion setting a moment after it mounts. So a burst asked for while this layer
30
+ * mounts (a truthy `trigger`, or `confetti()` in a mount effect) waits until the layer has asked the system too, and is
31
+ * then drawn only if the provider says motion is wanted.
32
+ */
33
+ export declare function Confetti({ trigger, options, style, testID }: ConfettiProps): React.JSX.Element;