@bloxwap/hig 0.6.0 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/README.md +2 -2
  2. package/chart/README.md +13 -2
  3. package/chart/dist/altimeter-burst.d.ts +4 -0
  4. package/chart/dist/altimeter-burst.js +43 -0
  5. package/chart/dist/altimeter-chart.d.ts +52 -0
  6. package/chart/dist/altimeter-chart.js +275 -0
  7. package/chart/dist/altimeter-model.d.ts +43 -0
  8. package/chart/dist/altimeter-model.js +148 -0
  9. package/chart/dist/altimeter-targets.d.ts +33 -0
  10. package/chart/dist/altimeter-targets.js +88 -0
  11. package/chart/dist/bitcoin-price.d.ts +8 -0
  12. package/chart/dist/bitcoin-price.js +41 -0
  13. package/chart/dist/champions-league.d.ts +19 -0
  14. package/chart/dist/champions-league.js +104 -0
  15. package/chart/dist/index.d.ts +6 -0
  16. package/chart/dist/index.js +5 -0
  17. package/chart/dist/outcome-chart.d.ts +37 -0
  18. package/chart/dist/outcome-chart.js +212 -0
  19. package/chart/dist/outcome-model.d.ts +43 -0
  20. package/chart/dist/outcome-model.js +71 -0
  21. package/chart/dist/plus-grid.d.ts +6 -0
  22. package/chart/dist/plus-grid.js +29 -0
  23. package/contracts/README.md +1 -1
  24. package/contracts/dist/avatar.d.ts +68 -0
  25. package/contracts/dist/avatar.js +93 -0
  26. package/contracts/dist/confetti.d.ts +174 -0
  27. package/contracts/dist/confetti.js +138 -0
  28. package/contracts/dist/decimal.d.ts +7 -0
  29. package/contracts/dist/decimal.js +35 -0
  30. package/contracts/dist/index.d.ts +45 -2
  31. package/contracts/dist/index.js +145 -4
  32. package/contracts/dist/invariants.d.ts +17 -0
  33. package/contracts/dist/invariants.js +24 -0
  34. package/contracts/dist/messages.d.ts +62 -2
  35. package/contracts/dist/messages.js +22 -2
  36. package/contracts/dist/number-flow.d.ts +90 -0
  37. package/contracts/dist/number-flow.js +150 -0
  38. package/contracts/dist/qr.d.ts +151 -0
  39. package/contracts/dist/qr.js +581 -0
  40. package/contracts/dist/toast.d.ts +168 -0
  41. package/contracts/dist/toast.js +171 -0
  42. package/feedback/README.md +1 -1
  43. package/feedback/dist/contract.js +1 -1
  44. package/feedback/dist/react.js +2 -4
  45. package/native/README.md +6 -1
  46. package/native/dist/account-block.d.ts +62 -7
  47. package/native/dist/account-block.js +54 -11
  48. package/native/dist/animated-number-model.d.ts +47 -1
  49. package/native/dist/animated-number-model.js +248 -21
  50. package/native/dist/animated-number.d.ts +41 -1
  51. package/native/dist/animated-number.js +165 -17
  52. package/native/dist/announce.d.ts +2 -0
  53. package/native/dist/announce.js +10 -0
  54. package/native/dist/asset-balance-row.d.ts +19 -1
  55. package/native/dist/asset-balance-row.js +24 -8
  56. package/native/dist/assets-block.d.ts +115 -0
  57. package/native/dist/assets-block.js +87 -0
  58. package/native/dist/async-result.d.ts +2 -0
  59. package/native/dist/async-result.js +11 -0
  60. package/native/dist/avatar-frame.d.ts +29 -0
  61. package/native/dist/avatar-frame.js +56 -0
  62. package/native/dist/avatar.d.ts +21 -0
  63. package/native/dist/avatar.js +31 -0
  64. package/native/dist/bar-mark.d.ts +16 -2
  65. package/native/dist/bar-mark.js +23 -7
  66. package/native/dist/bar-pnl.js +7 -5
  67. package/native/dist/blocks.d.ts +13 -14
  68. package/native/dist/blocks.js +10 -6
  69. package/native/dist/brand.js +2 -1
  70. package/native/dist/button.d.ts +7 -2
  71. package/native/dist/button.js +16 -4
  72. package/native/dist/checkbox.js +2 -1
  73. package/native/dist/confetti.d.ts +33 -0
  74. package/native/dist/confetti.js +143 -0
  75. package/native/dist/confirm-block.d.ts +98 -0
  76. package/native/dist/confirm-block.js +48 -0
  77. package/native/dist/data.d.ts +1 -1
  78. package/native/dist/data.js +8 -4
  79. package/native/dist/explainer-block.d.ts +91 -0
  80. package/native/dist/explainer-block.js +34 -0
  81. package/native/dist/field.d.ts +19 -5
  82. package/native/dist/field.js +56 -9
  83. package/native/dist/figure.d.ts +23 -0
  84. package/native/dist/figure.js +10 -0
  85. package/native/dist/gesture-sheet-model.d.ts +50 -0
  86. package/native/dist/gesture-sheet-model.js +105 -0
  87. package/native/dist/gesture-sheet-next.d.ts +82 -0
  88. package/native/dist/gesture-sheet-next.js +315 -0
  89. package/native/dist/gesture-sheet.d.ts +5 -1
  90. package/native/dist/gesture-sheet.js +13 -6
  91. package/native/dist/icons.d.ts +9 -6
  92. package/native/dist/icons.js +25 -24
  93. package/native/dist/language-block.d.ts +14 -1
  94. package/native/dist/language-block.js +11 -4
  95. package/native/dist/list-group.d.ts +44 -8
  96. package/native/dist/list-group.js +84 -13
  97. package/native/dist/manage-position-block.d.ts +35 -2
  98. package/native/dist/manage-position-block.js +41 -11
  99. package/native/dist/market-row.d.ts +46 -0
  100. package/native/dist/market-row.js +41 -0
  101. package/native/dist/navigation.js +5 -3
  102. package/native/dist/notifications-block.d.ts +30 -2
  103. package/native/dist/notifications-block.js +16 -8
  104. package/native/dist/number-format.d.ts +6 -0
  105. package/native/dist/number-format.js +9 -0
  106. package/native/dist/pickers.d.ts +32 -2
  107. package/native/dist/pickers.js +17 -9
  108. package/native/dist/position-block.d.ts +66 -10
  109. package/native/dist/position-block.js +45 -11
  110. package/native/dist/preset-group.d.ts +31 -0
  111. package/native/dist/preset-group.js +39 -0
  112. package/native/dist/preset-picker-block.d.ts +107 -0
  113. package/native/dist/preset-picker-block.js +43 -0
  114. package/native/dist/profile-block.d.ts +38 -5
  115. package/native/dist/profile-block.js +31 -6
  116. package/native/dist/provider.d.ts +14 -5
  117. package/native/dist/provider.js +32 -6
  118. package/native/dist/qr-code.d.ts +33 -0
  119. package/native/dist/qr-code.js +29 -0
  120. package/native/dist/radio-group.d.ts +23 -5
  121. package/native/dist/radio-group.js +40 -12
  122. package/native/dist/recipes.d.ts +6 -0
  123. package/native/dist/recipes.js +6 -0
  124. package/native/dist/reward-block.d.ts +55 -13
  125. package/native/dist/reward-block.js +37 -14
  126. package/native/dist/screen-header.d.ts +59 -0
  127. package/native/dist/screen-header.js +37 -0
  128. package/native/dist/select.js +4 -2
  129. package/native/dist/selection.d.ts +3 -2
  130. package/native/dist/selection.js +1 -0
  131. package/native/dist/setting-header.d.ts +2 -8
  132. package/native/dist/setting-header.js +2 -11
  133. package/native/dist/setting-switch.d.ts +15 -2
  134. package/native/dist/setting-switch.js +11 -4
  135. package/native/dist/signals-block.d.ts +26 -2
  136. package/native/dist/signals-block.js +14 -4
  137. package/native/dist/slider.js +5 -1
  138. package/native/dist/sound-haptics-block.d.ts +29 -2
  139. package/native/dist/sound-haptics-block.js +19 -8
  140. package/native/dist/status.d.ts +47 -14
  141. package/native/dist/status.js +39 -22
  142. package/native/dist/sticky-header.d.ts +28 -0
  143. package/native/dist/sticky-header.js +29 -0
  144. package/native/dist/surface.d.ts +3 -1
  145. package/native/dist/surface.js +2 -1
  146. package/native/dist/swap-amount-card.d.ts +57 -0
  147. package/native/dist/swap-amount-card.js +31 -0
  148. package/native/dist/swap-panel-block.d.ts +11 -4
  149. package/native/dist/swap-panel-block.js +67 -38
  150. package/native/dist/swap-parts.d.ts +5 -10
  151. package/native/dist/swap-parts.js +22 -24
  152. package/native/dist/swap-shared.d.ts +8 -2
  153. package/native/dist/swap-shared.js +10 -6
  154. package/native/dist/swap-views.js +6 -4
  155. package/native/dist/switch-row.d.ts +3 -2
  156. package/native/dist/switch-row.js +5 -3
  157. package/native/dist/switch.d.ts +4 -2
  158. package/native/dist/switch.js +3 -3
  159. package/native/dist/target-block.d.ts +40 -7
  160. package/native/dist/target-block.js +31 -11
  161. package/native/dist/toast.d.ts +47 -0
  162. package/native/dist/toast.js +386 -0
  163. package/native/dist/token-action-block.d.ts +26 -9
  164. package/native/dist/token-action-block.js +21 -8
  165. package/native/dist/trade-history-detail-block.d.ts +26 -1
  166. package/native/dist/trade-history-detail-block.js +17 -9
  167. package/native/dist/trade-history-list-block.d.ts +71 -5
  168. package/native/dist/trade-history-list-block.js +55 -17
  169. package/native/dist/wallet-address-core.d.ts +25 -0
  170. package/native/dist/wallet-address-core.js +34 -0
  171. package/native/dist/wallet-address.d.ts +6 -10
  172. package/native/dist/wallet-address.js +16 -20
  173. package/native-fonts/README.md +1 -1
  174. package/og-fonts/README.md +1 -1
  175. package/package.json +131 -2
  176. package/react/README.md +3 -1
  177. package/react/dist/animated-number-flow.d.ts +72 -0
  178. package/react/dist/animated-number-flow.js +316 -0
  179. package/react/dist/animated-number-model.d.ts +24 -0
  180. package/react/dist/animated-number-model.js +106 -3
  181. package/react/dist/animated-number.d.ts +49 -1
  182. package/react/dist/animated-number.js +146 -11
  183. package/react/dist/asset-balance-row.d.ts +19 -1
  184. package/react/dist/asset-balance-row.js +17 -3
  185. package/react/dist/async-result.d.ts +2 -0
  186. package/react/dist/async-result.js +11 -0
  187. package/react/dist/avatar.d.ts +25 -0
  188. package/react/dist/avatar.js +50 -0
  189. package/react/dist/bar-mark.d.ts +5 -2
  190. package/react/dist/bar-mark.js +5 -3
  191. package/react/dist/blocks/account-block.d.ts +57 -7
  192. package/react/dist/blocks/account-block.js +51 -11
  193. package/react/dist/blocks/assets-block.d.ts +106 -0
  194. package/react/dist/blocks/assets-block.js +135 -0
  195. package/react/dist/blocks/confirm-block.d.ts +91 -0
  196. package/react/dist/blocks/confirm-block.js +31 -0
  197. package/react/dist/blocks/explainer-block.d.ts +80 -0
  198. package/react/dist/blocks/explainer-block.js +20 -0
  199. package/react/dist/blocks/install-command.js +3 -1
  200. package/react/dist/blocks/language-block.d.ts +9 -1
  201. package/react/dist/blocks/language-block.js +8 -6
  202. package/react/dist/blocks/manage-position-block.d.ts +30 -2
  203. package/react/dist/blocks/manage-position-block.js +23 -4
  204. package/react/dist/blocks/market-row.d.ts +20 -9
  205. package/react/dist/blocks/market-row.js +17 -4
  206. package/react/dist/blocks/notifications-block.d.ts +27 -2
  207. package/react/dist/blocks/notifications-block.js +11 -2
  208. package/react/dist/blocks/pickers.d.ts +30 -1
  209. package/react/dist/blocks/pickers.js +32 -10
  210. package/react/dist/blocks/position-block.d.ts +34 -11
  211. package/react/dist/blocks/position-block.js +16 -5
  212. package/react/dist/blocks/preset-picker-block.d.ts +85 -0
  213. package/react/dist/blocks/preset-picker-block.js +19 -0
  214. package/react/dist/blocks/profile-block.d.ts +33 -6
  215. package/react/dist/blocks/profile-block.js +31 -6
  216. package/react/dist/blocks/reward-block.d.ts +65 -21
  217. package/react/dist/blocks/reward-block.js +24 -11
  218. package/react/dist/blocks/screen-header.d.ts +34 -2
  219. package/react/dist/blocks/screen-header.js +17 -6
  220. package/react/dist/blocks/setting-switch.d.ts +14 -1
  221. package/react/dist/blocks/setting-switch.js +11 -4
  222. package/react/dist/blocks/signals-block.d.ts +23 -2
  223. package/react/dist/blocks/signals-block.js +6 -5
  224. package/react/dist/blocks/sound-haptics-block.d.ts +27 -3
  225. package/react/dist/blocks/sound-haptics-block.js +11 -7
  226. package/react/dist/blocks/sticky-header.d.ts +19 -0
  227. package/react/dist/blocks/sticky-header.js +103 -0
  228. package/react/dist/blocks/swap/amount-card.js +2 -1
  229. package/react/dist/blocks/swap/settings.js +4 -3
  230. package/react/dist/blocks/swap/shared.d.ts +29 -23
  231. package/react/dist/blocks/swap/shared.js +36 -32
  232. package/react/dist/blocks/swap-panel-block.d.ts +12 -3
  233. package/react/dist/blocks/swap-panel-block.js +72 -37
  234. package/react/dist/blocks/target-block.d.ts +35 -7
  235. package/react/dist/blocks/target-block.js +26 -12
  236. package/react/dist/blocks/token-action-block.d.ts +21 -8
  237. package/react/dist/blocks/token-action-block.js +9 -6
  238. package/react/dist/blocks/trade-history-detail-block.d.ts +23 -1
  239. package/react/dist/blocks/trade-history-detail-block.js +5 -4
  240. package/react/dist/blocks/trade-history-list-block.d.ts +31 -5
  241. package/react/dist/blocks/trade-history-list-block.js +20 -10
  242. package/react/dist/blocks.d.ts +12 -8
  243. package/react/dist/blocks.js +6 -2
  244. package/react/dist/brand.js +2 -1
  245. package/react/dist/button.d.ts +9 -3
  246. package/react/dist/button.js +12 -5
  247. package/react/dist/confetti.d.ts +27 -0
  248. package/react/dist/confetti.js +240 -0
  249. package/react/dist/data.js +11 -4
  250. package/react/dist/field.d.ts +20 -5
  251. package/react/dist/field.js +30 -8
  252. package/react/dist/figure.d.ts +23 -0
  253. package/react/dist/figure.js +12 -0
  254. package/react/dist/gesture-sheet.d.ts +15 -1
  255. package/react/dist/gesture-sheet.js +53 -8
  256. package/react/dist/list-group.d.ts +41 -8
  257. package/react/dist/list-group.js +49 -13
  258. package/react/dist/navigation.js +11 -3
  259. package/react/dist/overlay.d.ts +28 -3
  260. package/react/dist/overlay.js +29 -3
  261. package/react/dist/preset-group.d.ts +30 -0
  262. package/react/dist/preset-group.js +13 -0
  263. package/react/dist/provider.d.ts +42 -5
  264. package/react/dist/provider.js +84 -10
  265. package/react/dist/qr-code.d.ts +32 -0
  266. package/react/dist/qr-code.js +28 -0
  267. package/react/dist/select.js +10 -3
  268. package/react/dist/selection.d.ts +18 -4
  269. package/react/dist/selection.js +20 -10
  270. package/react/dist/slider.js +5 -1
  271. package/react/dist/status.d.ts +14 -10
  272. package/react/dist/status.js +17 -9
  273. package/react/dist/styles.css +380 -150
  274. package/react/dist/surface.d.ts +5 -1
  275. package/react/dist/surface.js +1 -1
  276. package/react/dist/toast.d.ts +19 -12
  277. package/react/dist/toast.js +29 -7
  278. package/react/dist/wallet-address-core.d.ts +27 -0
  279. package/react/dist/wallet-address-core.js +29 -0
  280. package/react/dist/wallet-address.d.ts +6 -12
  281. package/react/dist/wallet-address.js +5 -16
  282. package/tokens/README.md +2 -2
  283. package/tokens/dist/index.d.ts +16 -0
  284. package/tokens/dist/index.js +16 -0
  285. package/tokens/dist/manifest.json +8 -0
  286. package/tokens/dist/tokens.css +6 -0
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type Figure } from '../figure.js';
2
3
  import type { AssetArtwork } from '../asset-balance-row.js';
3
4
  /** The words of the block. They are trading terms, so the host supplies them in its own vocabulary and language; HIG ships none. */
4
5
  export interface ManagePositionBlockLabels {
@@ -14,16 +15,37 @@ export interface ManagePositionBlockLabels {
14
15
  long: string;
15
16
  short: string;
16
17
  }
18
+ /** A number the host supplies as a number so it updates place by place: `{value:66000,options:{style:'currency',currency:'USD'}}`. `null` reads as unknown. */
19
+ export type ManagePositionBlockFigure = Figure;
20
+ /** The position's artwork: an image URL, a host element, or a function that draws a host element and receives `failed`, to call when that element cannot draw (an SVG that did not load); the row then shows `iconFallback` or the initials. */
21
+ export type ManagePositionIcon = AssetArtwork | ((failed: () => void) => React.ReactNode);
17
22
  export interface ManagePositionBlockAction {
18
23
  id: string;
19
24
  label: string;
20
25
  onSelect: () => void;
21
26
  disabled?: boolean;
27
+ /** Trailing value of the row, before the chevron: host text or a live figure, such as the price a resting trigger is set at. */
28
+ value?: string | ManagePositionBlockFigure;
29
+ /** Colours `value`. The default is the muted value colour. */
30
+ tone?: 'positive' | 'negative' | 'muted';
22
31
  }
23
32
  /** The position being managed, shown as the row under the actions. */
24
33
  export interface ManagePositionBlockSummary {
25
34
  name: string;
26
- icon?: AssetArtwork;
35
+ /** An image URL, a host element, or a function that draws one and reports its failure. An image or element that fails shows `iconFallback`, else the initials. */
36
+ icon?: ManagePositionIcon;
37
+ /** A host element drawn in place of an `icon` that failed to draw. Without it the row shows the initials. */
38
+ iconFallback?: React.ReactNode;
39
+ /** Short ticker for the initials when there is no artwork: BTC. Without it the first letters of the name are shown. */
40
+ symbol?: string;
41
+ /** Host text after the name, drawn as a small `Badge`, such as a venue. */
42
+ badge?: string;
43
+ /** One line under the row, such as that the profit and loss is stale or estimated. */
44
+ caption?: string;
45
+ /** Makes the whole row a button, for example one that opens the market. Needs `label`. */
46
+ onSelect?: () => void;
47
+ /** Accessible name of the row when it is a button, read before what the row shows: View Bitcoin. The caption is its description. */
48
+ label?: string;
27
49
  /** 40 reads `40×`. */
28
50
  leverage?: number;
29
51
  /** Size in asset units. */
@@ -47,9 +69,15 @@ export interface ManagePositionBlockProps extends Omit<React.HTMLAttributes<HTML
47
69
  priceOptions?: Intl.NumberFormatOptions;
48
70
  actions: readonly ManagePositionBlockAction[];
49
71
  position?: ManagePositionBlockSummary;
72
+ /** Format of the position's profit and loss, merged over the default: signed US dollars with up to four decimals. */
73
+ pnlOptions?: Intl.NumberFormatOptions;
50
74
  onBack?: () => void;
51
75
  /** A control on the trailing edge of the header, usually an `IconButton`. */
52
76
  headerAction?: React.ReactNode;
77
+ /** Pins the header to the top of the nearest scroller: transparent at rest, filled once content scrolls under it, and still when it starts to stick. See Pinned headers. */
78
+ stickyHeader?: boolean;
79
+ /** `id` of the heading, so a dialog or sheet can name itself with `aria-labelledby`. */
80
+ headingId?: string;
53
81
  }
54
82
  /** Distance left before liquidation. `total` is the span from entry to liquidation, `buffer` what remains of it between the mark and liquidation (the whole span while in profit, nothing once past liquidation), `drawdown` the rest, and `share` the buffer as a fraction. Unknown prices, or a liquidation price on the wrong side of entry, give an empty corridor. */
55
83
  export declare function positionCorridor({ side, entry, mark, liquidation }: {
@@ -64,4 +92,4 @@ export declare function positionCorridor({ side, entry, mark, liquidation }: {
64
92
  share: number | null;
65
93
  };
66
94
  /** Manage one open position: margin against notional (with the share left before liquidation) as a `BarMark` and the liquidation, mark and entry prices as a `BarPnl`, both drawn without a card because they are read-only, the host's actions as one `ListGroup` of rows, and the position itself underneath. */
67
- export declare function ManagePositionBlock({ labels, mode, side, entry, mark, liquidation, margin, notional, priceOptions, actions, position, onBack, headerAction, className, ...rest }: ManagePositionBlockProps): React.JSX.Element;
95
+ export declare function ManagePositionBlock({ labels, mode, side, entry, mark, liquidation, margin, notional, priceOptions, actions, position, pnlOptions, onBack, headerAction, headingId, stickyHeader, className, ...rest }: ManagePositionBlockProps): React.JSX.Element;
@@ -1,7 +1,10 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useState } from 'react';
3
4
  import { formatNumber } from '@bloxwap/hig/contracts';
4
- import { useHIG } from '../provider.js';
5
+ import { PressDecoration, usePresentNumber, useNumberLocale } from '../provider.js';
6
+ import { figureProps } from '../figure.js';
7
+ import { Badge } from '../status.js';
5
8
  import { AnimatedNumberReadout } from '../animated-number.js';
6
9
  import { BarMark } from '../bar-mark.js';
7
10
  import { BarPnl } from '../bar-pnl.js';
@@ -19,10 +22,26 @@ export function positionCorridor({ side, entry, mark, liquidation }) {
19
22
  const traveled = side === 'long' ? entry - mark : mark - entry, buffer = Math.max(0, Math.min(span, span - traveled));
20
23
  return { total: span, buffer, drawdown: span - buffer, share: buffer / span };
21
24
  }
25
+ /** The position's disc: its artwork, or after a failure the host's fallback or the initials. A failure is kept until the artwork changes. */
26
+ function PositionArt({ position }) {
27
+ const { icon, iconFallback, symbol, name } = position, key = typeof icon === 'string' ? icon : `${symbol ?? ''}|${name}`;
28
+ const [broken, setBroken] = useState(null), failed = broken === key, fail = () => setBroken(key);
29
+ const initials = symbol ?? name.slice(0, 3);
30
+ const art = failed || icon == null ? (failed && iconFallback != null ? iconFallback : initials) : typeof icon === 'string' ? _jsx("img", { src: icon, alt: '', onError: fail }) : typeof icon === 'function' ? icon(fail) : icon;
31
+ return _jsx("span", { className: 'hig-asset-row-icon', "aria-hidden": 'true', children: art });
32
+ }
22
33
  /** Manage one open position: margin against notional (with the share left before liquidation) as a `BarMark` and the liquidation, mark and entry prices as a `BarPnl`, both drawn without a card because they are read-only, the host's actions as one `ListGroup` of rows, and the position itself underneath. */
23
- export function ManagePositionBlock({ labels, mode, side, entry, mark, liquidation, margin, notional, priceOptions, actions, position, onBack, headerAction, className, ...rest }) {
24
- const { locale } = useHIG();
34
+ export function ManagePositionBlock({ labels, mode, side, entry, mark, liquidation, margin, notional, priceOptions, actions, position, pnlOptions, onBack, headerAction, headingId, stickyHeader, className, ...rest }) {
35
+ const locale = useNumberLocale();
36
+ const present = usePresentNumber();
25
37
  const corridor = positionCorridor({ side, entry, mark, liquidation });
26
38
  const pnlTone = !known(position?.pnl) || position.pnl === 0 ? undefined : position.pnl > 0 ? 'up' : 'down';
27
- return _jsxs("section", { ...rest, className: `hig-manage-position-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: labels.title, onBack: onBack, action: headerAction }), _jsxs("div", { className: 'hig-token-bars', children: [_jsx(BarMark, { surface: false, title: mode ?? labels.margin, description: corridor.share === null ? labels.toLiquidation('—') : _jsx(SwapNumber, { template: labels.toLiquidation, value: Number((corridor.share * 100).toFixed(1)), suffix: '%', options: { maximumFractionDigits: 1 } }), elements: [{ id: 'margin', label: labels.margin, value: margin, detail: formatNumber(margin, locale, usd), tone: 'info' }, { id: 'notional', label: labels.notional, value: known(notional) ? Math.max(notional - margin, 0) : 0, detail: known(notional) ? formatNumber(notional, locale, usd) : '—', tone: 'positive' }] }), _jsx(BarPnl, { surface: false, compact: true, side: side, entry: entry, mark: mark, liquidation: liquidation, labels: { liquidation: labels.liquidation, mark: labels.mark, entry: labels.entry }, priceOptions: priceOptions })] }), actions.length > 0 && _jsx(ListGroup, { className: 'hig-manage-actions', children: actions.map(action => _jsx(ListRow, { label: action.label, disabled: action.disabled, onSelect: action.onSelect }, action.id)) }), position && _jsxs("div", { className: 'hig-asset-row hig-position-row', children: [_jsx("span", { className: 'hig-asset-row-icon', "aria-hidden": 'true', children: typeof position.icon === 'string' ? _jsx("img", { src: position.icon, alt: '' }) : position.icon ?? position.name.slice(0, 3) }), _jsxs("span", { className: 'hig-asset-row-identity', children: [_jsx("strong", { children: position.name }), _jsxs("span", { children: [_jsx("span", { className: 'hig-position-side', "data-side": side, "aria-hidden": 'true', children: side === 'long' ? '↑' : '↓' }), _jsx("span", { className: 'hig-sr-only', children: side === 'long' ? labels.long : labels.short }), position.leverage != null && _jsxs("span", { className: 'hig-position-side hig-position-leverage', "data-side": side, children: [" ", formatNumber(position.leverage, locale), "\u00D7"] }), known(position.size) && _jsxs(_Fragment, { children: [" \u00B7 ", _jsx(AnimatedNumberReadout, { value: position.size, options: { maximumFractionDigits: 6 } })] })] })] }), _jsxs("span", { className: 'hig-asset-row-amounts', children: [_jsx("strong", { "data-tone": pnlTone, children: _jsx(AnimatedNumberReadout, { value: position.pnl, options: { ...usd, signDisplay: 'exceptZero', maximumFractionDigits: 4 } }) }), _jsx("span", { children: _jsx(AnimatedNumberReadout, { value: position.pnlPercent, options: { style: 'percent', minimumFractionDigits: 2, maximumFractionDigits: 2, signDisplay: 'exceptZero' } }) })] })] })] });
39
+ const pnlFormat = { ...usd, signDisplay: 'exceptZero', maximumFractionDigits: 4, ...pnlOptions };
40
+ const content = (position, ids) => _jsxs(_Fragment, { children: [_jsx(PositionArt, { position: position }), _jsxs("span", { id: ids?.identity, className: 'hig-asset-row-identity', children: [position.badge ? _jsxs("span", { className: 'hig-position-name', children: [_jsx("strong", { children: position.name }), _jsx(Badge, { className: 'hig-position-badge', children: position.badge })] }) : _jsx("strong", { children: position.name }), _jsxs("span", { children: [_jsx("span", { className: 'hig-position-side', "data-side": side, "aria-hidden": 'true', children: side === 'long' ? '↑' : '↓' }), _jsx("span", { className: 'hig-sr-only', children: side === 'long' ? labels.long : labels.short }), position.leverage != null && _jsxs("span", { className: 'hig-position-side hig-position-leverage', "data-side": side, children: [" ", formatNumber(position.leverage, locale), "\u00D7"] }), known(position.size) && _jsxs(_Fragment, { children: [" \u00B7 ", _jsx(AnimatedNumberReadout, { value: position.size, options: { maximumFractionDigits: 6 } })] })] })] }), _jsxs("span", { id: ids?.amounts, className: 'hig-asset-row-amounts', children: [_jsx("strong", { "data-tone": pnlTone, children: _jsx(AnimatedNumberReadout, { value: position.pnl, options: pnlFormat }) }), _jsx("span", { children: _jsx(AnimatedNumberReadout, { value: position.pnlPercent, options: { style: 'percent', minimumFractionDigits: 2, maximumFractionDigits: 2, signDisplay: 'exceptZero' } }) })] })] });
41
+ return _jsxs("section", { ...rest, className: `hig-manage-position-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: labels.title, onBack: onBack, action: headerAction, headingId: headingId, stickyHeader: stickyHeader }), _jsxs("div", { className: 'hig-token-bars', children: [_jsx(BarMark, { surface: false, title: mode ?? labels.margin, description: corridor.share === null ? labels.toLiquidation('—') : _jsx(SwapNumber, { template: labels.toLiquidation, value: Number((corridor.share * 100).toFixed(1)), suffix: '%', options: { maximumFractionDigits: 1 } }), elements: [{ id: 'margin', label: labels.margin, value: margin, detail: formatNumber(margin, locale, present(usd)), tone: 'info' }, { id: 'notional', label: labels.notional, value: known(notional) ? Math.max(notional - margin, 0) : 0, detail: known(notional) ? formatNumber(notional, locale, present(usd)) : '—', tone: 'positive' }] }), _jsx(BarPnl, { surface: false, compact: true, side: side, entry: entry, mark: mark, liquidation: liquidation, labels: { liquidation: labels.liquidation, mark: labels.mark, entry: labels.entry }, priceOptions: priceOptions })] }), actions.length > 0 && _jsx(ListGroup, { className: 'hig-manage-actions', children: actions.map(action => _jsx(ListRow, { label: action.label, disabled: action.disabled, onSelect: action.onSelect, value: action.value == null ? undefined : _jsx("span", { className: 'hig-manage-action-value', "data-tone": action.tone, children: typeof action.value === 'string' ? action.value : _jsx(AnimatedNumberReadout, { ...figureProps(action.value) }) }) }, action.id)) }), position && (position.onSelect ? _jsx(PositionButton, { position: position, content: content }) : _jsx("div", { className: 'hig-asset-row hig-position-row', children: content(position) })), position?.caption && !position.onSelect && _jsx("p", { className: 'hig-position-caption', children: position.caption })] });
42
+ }
43
+ /** The position row as a button: named by the host's label followed by what it shows, so the figures are part of the name, and described by the caption. Without a label it is named by what it shows alone. Its own component, so the ids it needs exist only when it is drawn. */
44
+ function PositionButton({ position, content }) {
45
+ const name = useId(), identity = useId(), amounts = useId(), about = useId();
46
+ return _jsxs(_Fragment, { children: [_jsxs("button", { type: 'button', className: 'hig-asset-row hig-position-row', "aria-labelledby": position.label ? `${name} ${identity} ${amounts}` : undefined, "aria-describedby": position.caption ? about : undefined, onClick: position.onSelect, children: [position.label && _jsxs("span", { id: name, className: 'hig-sr-only', children: [position.label, ","] }), content(position, { identity, amounts }), _jsx(PressDecoration, { kind: 'row' })] }), position.caption && _jsx("p", { id: about, className: 'hig-position-caption', children: position.caption })] });
28
47
  }
@@ -1,16 +1,26 @@
1
1
  import React from 'react';
2
- interface MarketRowContent {
2
+ interface MarketRowContent extends Omit<React.HTMLAttributes<HTMLDivElement>, 'children' | 'onSelect'> {
3
3
  symbol: string;
4
4
  name: string;
5
- price: number | null;
6
- change: number | null; /** Intl display options, including a decimal style when the host omits a currency symbol. */
7
- priceOptions?: Intl.NumberFormatOptions; /** Percent-point display precision/sign; forwarded to Percent. */
8
- changeOptions?: Intl.NumberFormatOptions; /** Optional host-rendered market icon, favourite indicator/control and formatted volume. */
9
- icon?: React.ReactNode;
5
+ /** Leave out to draw no price column (no dash); `null` reads as unknown. */
6
+ price?: number | null;
7
+ /** Leave out to draw no change column (no dash); `null` reads as unknown. */
8
+ change?: number | null;
9
+ /** Intl display options, including a decimal style when the host omits a currency symbol. */ priceOptions?: Intl.NumberFormatOptions;
10
+ /** Percent-point display precision/sign; forwarded to Percent. */ changeOptions?: Intl.NumberFormatOptions;
11
+ /** Optional host-rendered market icon, favourite indicator/control and formatted volume. */ icon?: React.ReactNode;
10
12
  favorite?: React.ReactNode;
11
13
  volume?: React.ReactNode;
12
- className?: string;
13
- style?: React.CSSProperties;
14
+ /** A muted second line under the name, such as the maximum leverage. In action mode it is part of the button's name. */
15
+ detail?: React.ReactNode;
16
+ /** Host content on the trailing edge, after the figures, such as a held position's result. Not interactive inside an action row's layout unless it has its own name. */
17
+ trailing?: React.ReactNode;
18
+ /** The market in use: a check on the trailing edge and `aria-current` on the row's control (the row itself in presentation mode). */
19
+ selected?: boolean;
20
+ /** Dims the row; in action mode the name button is disabled. */
21
+ disabled?: boolean;
22
+ /** The row under a host's keyboard cursor, highlighted with the well fill. */
23
+ active?: boolean;
14
24
  }
15
25
  export type MarketRowProps = MarketRowContent & ({
16
26
  mode?: 'action';
@@ -21,5 +31,6 @@ export type MarketRowProps = MarketRowContent & ({
21
31
  onSelect?: never; /** Host market identity, such as symbol/name with its existing compact layout. */
22
32
  identity?: React.ReactNode;
23
33
  });
24
- export declare function MarketRow({ symbol, name, price, change, onSelect, priceOptions, changeOptions, mode, identity, icon, favorite, volume, className, style }: MarketRowProps): React.JSX.Element;
34
+ /** A market as one row: its name (a button, or the host's identity in presentation mode), price and change. Other attributes, pointer handlers and the ref reach the row's root. */
35
+ export declare const MarketRow: React.ForwardRefExoticComponent<MarketRowProps & React.RefAttributes<HTMLDivElement>>;
25
36
  export {};
@@ -1,8 +1,21 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Check } from '@bloxwap/icons/react/check';
4
+ import { forwardRef } from 'react';
3
5
  import { Button } from '../button.js';
4
6
  import { Usd, Percent } from '../data.js';
5
- export function MarketRow({ symbol, name, price, change, onSelect, priceOptions, changeOptions, mode = 'action', identity, icon, favorite, volume, className, style }) {
6
- const content = _jsxs(_Fragment, { children: [favorite !== undefined && _jsx("span", { className: 'hig-market-favorite', children: favorite }), icon !== undefined && _jsx("span", { className: 'hig-market-icon', children: icon }), mode === 'presentation' ? _jsx("span", { className: 'hig-market-name', children: identity === undefined ? _jsxs(_Fragment, { children: [name, " (", symbol, ")"] }) : identity }) : _jsxs(Button, { intent: 'ghost', onClick: onSelect, children: [name, " (", symbol, ")"] })] });
7
- return _jsxs("div", { className: `hig-row hig-market-row${className ? ` ${className}` : ''}`, style: style, "data-mode": mode, "data-has-volume": volume !== undefined || undefined, children: [_jsx("div", { className: 'hig-market-identity', children: content }), _jsx("span", { className: 'hig-market-price', children: _jsx(Usd, { value: price, options: priceOptions }) }), _jsx("span", { className: 'hig-market-change', children: _jsx(Percent, { value: change, options: changeOptions }) }), volume !== undefined && _jsx("span", { className: 'hig-market-volume', children: volume })] });
8
- }
7
+ const check = _jsx(Check, { size: 20, className: 'hig-market-check' });
8
+ /** A market as one row: its name (a button, or the host's identity in presentation mode), price and change. Other attributes, pointer handlers and the ref reach the row's root. */
9
+ export const MarketRow = forwardRef(function MarketRow({ symbol, name, price, change, onSelect, priceOptions, changeOptions, mode = 'action', identity, icon, favorite, volume, detail, trailing, selected, disabled, active, className, style, ...rest }, ref) {
10
+ // The name sits in its own span so an action row can truncate it on one line instead of wrapping.
11
+ const title = detail === undefined ? _jsxs("span", { className: 'hig-market-label', children: [name, " (", symbol, ")"] }) : _jsxs("span", { className: 'hig-market-text', children: [_jsxs("span", { className: 'hig-market-label', children: [name, " (", symbol, ")"] }), _jsx("span", { className: 'hig-market-detail', children: detail })] });
12
+ const current = selected ? 'true' : undefined;
13
+ const content = _jsxs(_Fragment, { children: [favorite !== undefined && _jsx("span", { className: 'hig-market-favorite', children: favorite }), icon !== undefined && _jsx("span", { className: 'hig-market-icon', children: icon }), mode === 'presentation' ? _jsx("span", { className: 'hig-market-name', children: identity === undefined ? title : identity }) : _jsx(Button, { intent: 'ghost', onClick: onSelect, disabled: disabled, "aria-current": current, children: title })] });
14
+ const hasTrailing = trailing !== undefined && trailing !== null && trailing !== false;
15
+ // The default three or four columns keep their grid; any other set of cells flows into as many columns as it has.
16
+ const flow = price === undefined || change === undefined || hasTrailing || !!selected || undefined;
17
+ // Presentation mode places each figure in its own grid column. An action row groups them so that, when the row is too narrow for
18
+ // everything, whole figures drop from the end (volume, then change, then price) instead of the name collapsing or cells overlapping.
19
+ const figures = price === undefined && change === undefined && volume === undefined ? null : _jsxs(_Fragment, { children: [price !== undefined && _jsx("span", { className: 'hig-market-price', children: _jsx(Usd, { value: price, options: priceOptions }) }), change !== undefined && _jsx("span", { className: 'hig-market-change', children: _jsx(Percent, { value: change, options: changeOptions }) }), volume !== undefined && _jsx("span", { className: 'hig-market-volume', children: volume })] });
20
+ return _jsxs("div", { ref: ref, ...rest, className: `hig-row hig-market-row${className ? ` ${className}` : ''}`, style: style, "data-mode": mode, "data-has-volume": volume !== undefined || undefined, "data-flow": flow, "data-selected": selected || undefined, "data-active": active || undefined, "data-disabled": disabled || undefined, "aria-current": mode === 'presentation' ? current : undefined, "aria-disabled": mode === 'presentation' && disabled ? true : undefined, children: [_jsx("div", { className: 'hig-market-identity', children: content }), mode === 'action' && figures !== null ? _jsx("span", { className: 'hig-market-figures', children: figures }) : figures, hasTrailing && _jsx("span", { className: 'hig-market-trailing', children: trailing }), selected && check] });
21
+ });
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type SettingAction } from './setting-switch.js';
2
3
  /** One kind of notification. Every word is host text. */
3
4
  export interface NotificationsItem {
4
5
  id: string;
@@ -7,17 +8,41 @@ export interface NotificationsItem {
7
8
  checked: boolean;
8
9
  onCheckedChange: (checked: boolean) => void;
9
10
  disabled?: boolean;
11
+ /** Always on and not changeable: shown on at full strength and read as unavailable. */
12
+ locked?: boolean;
13
+ /** Host content after the label, such as a badge. It is part of the switch's name. */
14
+ labelAccessory?: React.ReactNode;
15
+ /** Host words for the `labelAccessory`, read after the label and a pause in place of its content: `Push, New`. */
16
+ labelAccessoryLabel?: string;
17
+ /** A neutral line under the card, announced when it changes, for progress or a hint: Registering this device. */
18
+ hint?: string;
10
19
  /** Why turning it on failed, under the card: Push request timed out. It is announced when it appears. */
11
20
  error?: string;
21
+ /** A secondary action under the card, such as Open Settings after the permission was refused. `feedback: false` keeps the provider's press feedback off it. */
22
+ action?: SettingAction;
23
+ }
24
+ /** Notifications under one optional heading: Alert types. */
25
+ export interface NotificationsGroup {
26
+ id: string;
27
+ title?: string;
28
+ items: readonly NotificationsItem[];
12
29
  }
13
30
  export interface NotificationsBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
14
31
  /** Heading: Notifications. */
15
32
  title: string;
33
+ /** A muted line under the header that explains the screen. */
34
+ description?: string;
16
35
  /** One card each, in order. */
17
- items: readonly NotificationsItem[];
36
+ items?: readonly NotificationsItem[];
37
+ /** More cards under the items, in groups with an optional heading, 24 units apart. */
38
+ groups?: readonly NotificationsGroup[];
18
39
  onBack?: () => void;
19
40
  /** A control on the trailing edge of the header, usually an `IconButton`. */
20
41
  headerAction?: React.ReactNode;
42
+ /** `id` of the header's heading, so a host dialog or sheet can name itself with `aria-labelledby`. */
43
+ headingId?: string;
44
+ /** Pins the header to the top of the nearest scrolling container, transparent at rest and filled with `--hig-sticky-header-background` once content scrolls under it. */
45
+ stickyHeader?: boolean;
21
46
  }
22
47
  /** The notifications the viewer receives: each kind is a card with a switch and a line of explanation, and a failure to turn one on reads under its card. */
23
- export declare function NotificationsBlock({ title, items, onBack, headerAction, className, ...rest }: NotificationsBlockProps): React.JSX.Element;
48
+ export declare function NotificationsBlock({ title, description, items, groups, onBack, headerAction, stickyHeader, headingId, className, ...rest }: NotificationsBlockProps): React.JSX.Element;
@@ -1,8 +1,17 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId } from 'react';
4
+ import { Button } from '../button.js';
3
5
  import { ScreenHeader } from './screen-header.js';
4
6
  import { SettingSwitch } from './setting-switch.js';
7
+ function Item({ item }) {
8
+ return _jsxs("div", { className: 'hig-notifications-item', children: [_jsx("div", { className: 'hig-setting-card', children: _jsx(SettingSwitch, { label: item.label, description: item.description, checked: item.checked, disabled: item.disabled, locked: item.locked, labelAccessory: item.labelAccessory, labelAccessoryLabel: item.labelAccessoryLabel, onCheckedChange: item.onCheckedChange }) }), item.hint && _jsx("p", { role: 'status', className: 'hig-setting-hint', children: item.hint }), item.error && _jsx("p", { role: 'alert', className: 'hig-setting-error', children: item.error }), item.action && _jsx(Button, { className: 'hig-notifications-action', intent: 'secondary', fullWidth: true, disabled: item.action.disabled, suppressFeedback: item.action.feedback === false, onClick: item.action.onSelect, children: item.action.label })] });
9
+ }
10
+ function Group({ group }) {
11
+ const id = useId();
12
+ return _jsxs("section", { className: 'hig-notifications-group', "aria-labelledby": group.title ? id : undefined, children: [group.title && _jsx("div", { className: 'hig-signals-group-header', children: _jsx("h3", { id: id, children: group.title }) }), group.items.length > 0 && _jsx("div", { className: 'hig-setting-cards', children: group.items.map(item => _jsx(Item, { item: item }, item.id)) })] });
13
+ }
5
14
  /** The notifications the viewer receives: each kind is a card with a switch and a line of explanation, and a failure to turn one on reads under its card. */
6
- export function NotificationsBlock({ title, items, onBack, headerAction, className, ...rest }) {
7
- return _jsxs("section", { ...rest, className: `hig-settings-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: title, onBack: onBack, action: headerAction }), items.length > 0 && _jsx("div", { className: 'hig-setting-cards', children: items.map(item => _jsxs("div", { className: 'hig-notifications-item', children: [_jsx("div", { className: 'hig-setting-card', children: _jsx(SettingSwitch, { label: item.label, description: item.description, checked: item.checked, disabled: item.disabled, onCheckedChange: item.onCheckedChange }) }), item.error && _jsx("p", { role: 'alert', className: 'hig-setting-error', children: item.error })] }, item.id)) })] });
15
+ export function NotificationsBlock({ title, description, items = [], groups, onBack, headerAction, stickyHeader, headingId, className, ...rest }) {
16
+ return _jsxs("section", { ...rest, className: `hig-settings-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: title, onBack: onBack, action: headerAction, headingId: headingId, stickyHeader: stickyHeader }), description && _jsx("p", { className: 'hig-settings-description', children: description }), items.length > 0 && _jsx("div", { className: 'hig-setting-cards', children: items.map(item => _jsx(Item, { item: item }, item.id)) }), groups?.map(group => _jsx(Group, { group: group }, group.id))] });
8
17
  }
@@ -21,7 +21,30 @@ export interface PickerListProps {
21
21
  loading?: boolean;
22
22
  /** With a hardware pointer, focus the search field on mount so typing filters at once. */
23
23
  autoFocus?: boolean;
24
+ /** `false` leaves out the search field, for a short list. Defaults to `true`. */
25
+ search?: boolean;
26
+ /** Shows a token's balance when it is zero, where by default only a balance above zero is drawn. */
27
+ zeroBalances?: boolean;
28
+ /** A visible label over the search field, which then names it in place of the built-in hidden label. */
29
+ searchLabel?: string;
30
+ /** A ref to the search input, for example to focus it or register it with a host sheet. */
31
+ searchRef?: React.Ref<HTMLInputElement>;
32
+ /** Attributes for the search input, such as `name`, `autoComplete`, `data-1p-ignore` or `onFocus`/`onBlur`. The value and its change handler stay HIG's; a host `onKeyDown` runs before the list's arrow keys. */
33
+ searchInputProps?: PickerInputProps;
34
+ /** Host attributes for each token's row, such as `{'data-testid': \`token-${token.id}\`}`. HIG keeps the row's type, class, state, click and pointer handlers. */
35
+ tokenRowProps?: (token: SwapToken) => PickerRowProps;
24
36
  }
37
+ /** Host attributes for a picker's input: anything an `<input>` takes, including `data-*`, except the value and its change handler. */
38
+ export type PickerInputProps = Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'defaultValue' | 'onChange' | 'type' | 'children'> & {
39
+ [attribute: `data-${string}`]: string | number | boolean | undefined;
40
+ };
41
+ /** Host attributes for one token row (a `<button>`): `data-*`, `id`, `title` or ARIA descriptions. The row's own type, class, selected state and handlers stay HIG's. */
42
+ export type PickerRowProps = {
43
+ id?: string;
44
+ title?: string;
45
+ 'aria-describedby'?: string;
46
+ [attribute: `data-${string}`]: string | number | boolean | undefined;
47
+ };
25
48
  export interface FromPickerBlockProps extends PickerListProps {
26
49
  /** The connected wallet. Omit for a list with no wallet row at all. */
27
50
  wallet?: SwapWallet;
@@ -48,13 +71,19 @@ export interface ToPickerBlockProps extends Partial<PickerListProps> {
48
71
  addressPlaceholder?: string;
49
72
  /** Shows the scan button. HIG ships no scanner: the host opens its own and writes the result to `address`. */
50
73
  onScan?: () => void;
74
+ /** A visible label over the address field, which then names it in place of the built-in hidden “Recipient”. */
75
+ addressLabel?: string;
76
+ /** A ref to the address input, for example to focus it or register it with a host sheet. */
77
+ addressRef?: React.Ref<HTMLInputElement>;
78
+ /** Attributes for the address input, such as `name='recipient'`, `data-1p-ignore`, `data-lpignore`, a mono `className` or `onFocus`/`onBlur`. The value and its change handler stay HIG's. */
79
+ addressInputProps?: PickerInputProps;
51
80
  className?: string;
52
81
  }
53
82
  /**
54
83
  * Where the assets go. On its own it is a destination address field with a scan button. With `tokens` it adds the
55
84
  * searchable token list, with the chain filter or, with `chainFilter={false}`, without it.
56
85
  */
57
- export declare function ToPickerBlock({ address, onAddressChange, addressPlaceholder, onScan, className, tokens, onSelect, ...list }: ToPickerBlockProps): React.JSX.Element;
86
+ export declare function ToPickerBlock({ address, onAddressChange, addressPlaceholder, onScan, addressLabel, addressRef, addressInputProps, className, tokens, onSelect, ...list }: ToPickerBlockProps): React.JSX.Element;
58
87
  /** @deprecated Renamed `FromPickerBlock`. The old name keeps working until the next major release. */
59
88
  export declare const FromPicker: typeof FromPickerBlock;
60
89
  /** @deprecated Renamed `FromPickerBlockProps`. */
@@ -1,20 +1,36 @@
1
1
  "use client";
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useId, useMemo, useRef, useState } from 'react';
3
+ import { useCallback, useEffect, useId, useMemo, useRef, useState } from 'react';
4
4
  import * as en from '@bloxwap/hig/contracts/messages';
5
- import { useHIG } from '../provider.js';
5
+ import { PressDecoration, useHIG } from '../provider.js';
6
6
  import { Button, IconButton } from '../button.js';
7
- import { Input, SearchInput } from '../field.js';
7
+ import { Field, Input, SearchInput } from '../field.js';
8
8
  import { Filter } from '../selection.js';
9
9
  import { SwapIcon, SwapNumber, TokenIcon, usdNumber, addressGradient, chainsOf, fuzzyMatch, shortAddress } from './swap/shared.js';
10
- function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected = null, onSelect, loading, autoFocus, label }) {
10
+ /** A row shows a known balance above zero, or a zero one when the host asks for it. */
11
+ const showBalance = (token, zero) => token.balance != null && Number.isFinite(token.balance) && (token.balance > 0 || (!!zero && token.balance === 0));
12
+ /** The host's row attributes HIG accepts: `data-*` (except the row's own state), `id`, `title` and `aria-describedby`. */
13
+ const rowAttributes = (props) => Object.fromEntries(Object.entries(props ?? {}).filter(([key]) => (key.startsWith('data-') && key !== 'data-active' && key !== 'data-selected') || key === 'id' || key === 'title' || key === 'aria-describedby'));
14
+ /** One callback ref that sets each given ref. */
15
+ function useMergedRef(...refs) {
16
+ const latest = useRef(refs);
17
+ latest.current = refs;
18
+ return useCallback((node) => { for (const ref of latest.current) {
19
+ if (typeof ref === 'function')
20
+ ref(node);
21
+ else if (ref)
22
+ ref.current = node;
23
+ } }, []);
24
+ }
25
+ function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected = null, onSelect, loading, autoFocus, search: searchable = true, zeroBalances, searchLabel, searchRef, searchInputProps, tokenRowProps, label }) {
11
26
  const { messages } = useHIG();
12
27
  const id = useId();
13
28
  const [query, setQuery] = useState('');
14
29
  const [chainId, setChainId] = useState(null);
15
- const [active, setActive] = useState(0);
30
+ const [active, setActive] = useState(searchable ? 0 : -1);
16
31
  const list = useRef(null);
17
32
  const search = useRef(null);
33
+ const searchInput = useMergedRef(search, searchRef);
18
34
  useEffect(() => { if (autoFocus && window.matchMedia?.('(pointer: fine)').matches)
19
35
  search.current?.focus(); }, []);
20
36
  const options = useMemo(() => chains ?? chainsOf(tokens), [chains, tokens]);
@@ -29,7 +45,8 @@ function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected =
29
45
  return { rows: filtered, hotCount: 0 };
30
46
  return { rows: [...hot, ...filtered.filter(token => !hot.includes(token))], hotCount: hot.length };
31
47
  }, [tokens, hotTokenIds, query, chainId]);
32
- useEffect(() => { setActive(0); }, [query, chainId]);
48
+ // Without a search field there is no arrow-key cursor, so no row is highlighted until the pointer moves over one.
49
+ useEffect(() => { setActive(searchable ? 0 : -1); }, [query, chainId, searchable]);
33
50
  useEffect(() => { list.current?.querySelector('[data-active="true"]')?.scrollIntoView?.({ block: 'nearest' }); }, [active]);
34
51
  const onKeyDown = (event) => {
35
52
  if (event.key === 'ArrowDown') {
@@ -49,9 +66,12 @@ function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected =
49
66
  const filters = [{ value: '', label: messages.swapAllChains ?? en.swapAllChains }, ...options.map(chain => ({ value: String(chain.chainId), label: chain.name, icon: chain.icon }))];
50
67
  const row = (token, index) => {
51
68
  const isSelected = selected?.id === token.id;
52
- return _jsx("div", { role: 'listitem', children: _jsxs("button", { type: 'button', className: 'hig-swap-row', "data-active": index === active, "data-selected": isSelected || undefined, onClick: () => onSelect(token), onPointerMove: () => setActive(index), children: [_jsx(TokenIcon, { token: token }), _jsxs("span", { className: 'hig-swap-row-text', children: [_jsx("strong", { children: token.name }), _jsxs("span", { children: [token.chain, isSelected ? ' · ' + (messages.swapSelected ?? en.swapSelected) : ''] })] }), (token.balance ?? 0) > 0 && _jsxs("span", { className: 'hig-swap-row-balance', children: [_jsx("strong", { children: _jsx(SwapNumber, { value: token.balance, options: { maximumFractionDigits: 6 } }) }), (token.price ?? 0) > 0 && _jsx(SwapNumber, { ...usdNumber((token.balance ?? 0) * (token.price ?? 0)) })] })] }) }, token.id);
69
+ return _jsx("div", { role: 'listitem', children: _jsxs("button", { ...rowAttributes(tokenRowProps?.(token)), type: 'button', className: 'hig-swap-row', "data-active": index === active, "data-selected": isSelected || undefined, "aria-current": isSelected || undefined, onClick: () => onSelect(token), onPointerMove: () => setActive(index), children: [_jsx(TokenIcon, { token: token }), _jsxs("span", { className: 'hig-swap-row-text', children: [_jsx("strong", { children: token.name }), _jsxs("span", { children: [token.detail ?? token.chain, isSelected ? ' · ' + (messages.swapSelected ?? en.swapSelected) : ''] })] }), showBalance(token, zeroBalances) && _jsxs("span", { className: 'hig-swap-row-balance', children: [_jsx("strong", { children: _jsx(SwapNumber, { value: token.balance, options: { maximumFractionDigits: 6 }, suffix: token.unitsSuffix }) }), (token.price ?? 0) > 0 && _jsx(SwapNumber, { ...usdNumber((token.balance ?? 0) * (token.price ?? 0)) })] }), _jsx(PressDecoration, { kind: 'row' })] }) }, token.id);
53
70
  };
54
- return _jsxs(_Fragment, { children: [_jsx(SearchInput, { ref: search, "aria-label": messages.swapSearchTokens ?? en.swapSearchTokens, placeholder: messages.swapSearchTokens ?? en.swapSearchTokens, value: query, onChange: event => setQuery(event.target.value), onKeyDown: onKeyDown, enterKeyHint: 'search', autoComplete: 'off', autoCapitalize: 'none', autoCorrect: 'off', spellCheck: false }), chainFilter && options.length > 1 && _jsx(Filter, { label: messages.swapChains ?? en.swapChains, options: filters, value: chainId === null ? '' : String(chainId), onValueChange: next => setChainId(options.find(chain => String(chain.chainId) === next)?.chainId ?? null) }), _jsxs("div", { ref: list, className: 'hig-swap-list', "aria-busy": loading || undefined, children: [rows.length === 0 && _jsx("p", { className: 'hig-swap-empty', role: 'status', children: loading ? (messages.loading ?? en.loading) + '…' : messages.swapNoTokens ?? en.swapNoTokens }), hotCount > 0 && _jsxs("p", { className: 'hig-swap-section', id: `${id}-hot`, children: [_jsx(SwapIcon, { name: 'flame', size: 14 }), messages.swapHot ?? en.swapHot] }), hotCount > 0 && _jsx("div", { role: 'list', "aria-labelledby": `${id}-hot`, children: rows.slice(0, hotCount).map((token, index) => row(token, index)) }), hotCount > 0 && _jsx("p", { className: 'hig-swap-section', id: `${id}-all`, children: messages.swapAllTokens ?? en.swapAllTokens }), rows.length > hotCount && _jsx("div", { role: 'list', ...(hotCount > 0 ? { 'aria-labelledby': `${id}-all` } : { 'aria-label': label }), children: rows.slice(hotCount).map((token, index) => row(token, index + hotCount)) })] })] });
71
+ const searchName = messages.swapSearchTokens ?? en.swapSearchTokens;
72
+ const field = _jsx(SearchInput, { ref: searchInput, "aria-label": searchLabel ? undefined : searchName, placeholder: searchName, enterKeyHint: 'search', autoComplete: 'off', autoCapitalize: 'none', autoCorrect: 'off', spellCheck: false, ...searchInputProps, value: query, onChange: event => setQuery(event.target.value), onKeyDown: event => { searchInputProps?.onKeyDown?.(event); if (!event.defaultPrevented)
73
+ onKeyDown(event); } });
74
+ return _jsxs(_Fragment, { children: [searchable && (searchLabel ? _jsx(Field, { label: searchLabel, children: field }) : field), chainFilter && options.length > 1 && _jsx(Filter, { label: messages.swapChains ?? en.swapChains, options: filters, value: chainId === null ? '' : String(chainId), onValueChange: next => setChainId(options.find(chain => String(chain.chainId) === next)?.chainId ?? null) }), _jsxs("div", { ref: list, className: 'hig-swap-list', "aria-busy": loading || undefined, children: [rows.length === 0 && _jsx("p", { className: 'hig-swap-empty', role: 'status', children: loading ? (messages.loading ?? en.loading) + '…' : messages.swapNoTokens ?? en.swapNoTokens }), hotCount > 0 && _jsxs("p", { className: 'hig-swap-section', id: `${id}-hot`, children: [_jsx(SwapIcon, { name: 'flame', size: 14 }), messages.swapHot ?? en.swapHot] }), hotCount > 0 && _jsx("div", { role: 'list', "aria-labelledby": `${id}-hot`, children: rows.slice(0, hotCount).map((token, index) => row(token, index)) }), hotCount > 0 && _jsx("p", { className: 'hig-swap-section', id: `${id}-all`, children: messages.swapAllTokens ?? en.swapAllTokens }), rows.length > hotCount && _jsx("div", { role: 'list', ...(hotCount > 0 ? { 'aria-labelledby': `${id}-all` } : { 'aria-label': label }), children: rows.slice(hotCount).map((token, index) => row(token, index + hotCount)) })] })] });
55
75
  }
56
76
  /**
57
77
  * Where the assets come from. A connected wallet shows its address, with a disconnect button the host can leave out, above
@@ -70,10 +90,12 @@ export function FromPickerBlock({ wallet, onConnect, onDisconnect, generateAddre
70
90
  * Where the assets go. On its own it is a destination address field with a scan button. With `tokens` it adds the
71
91
  * searchable token list, with the chain filter or, with `chainFilter={false}`, without it.
72
92
  */
73
- export function ToPickerBlock({ address, onAddressChange, addressPlaceholder, onScan, className, tokens, onSelect, ...list }) {
93
+ export function ToPickerBlock({ address, onAddressChange, addressPlaceholder, onScan, addressLabel, addressRef, addressInputProps, className, tokens, onSelect, ...list }) {
74
94
  const { messages } = useHIG();
75
95
  const label = messages.swapTo ?? en.swapTo;
76
- return _jsxs("div", { className: `hig-picker${className ? ` ${className}` : ''}`, role: 'group', "aria-label": label, children: [onAddressChange && _jsxs("div", { className: 'hig-swap-wallet', children: [_jsx(Input, { "aria-label": messages.swapRecipient ?? en.swapRecipient, placeholder: addressPlaceholder ?? messages.swapRecipient ?? en.swapRecipient, value: address ?? '', onChange: event => onAddressChange(event.target.value), autoComplete: 'off', autoCapitalize: 'none', autoCorrect: 'off', spellCheck: false }), onScan && _jsx(IconButton, { intent: 'secondary', label: messages.swapScan ?? en.swapScan, onClick: onScan, children: _jsx(SwapIcon, { name: 'scan' }) })] }), tokens && onSelect && _jsx(TokenList, { ...list, tokens: tokens, onSelect: onSelect, label: label })] });
96
+ const recipient = messages.swapRecipient ?? en.swapRecipient;
97
+ const row = onAddressChange && _jsxs("div", { className: 'hig-swap-wallet', children: [_jsx(Input, { ref: addressRef, "aria-label": addressLabel ? undefined : recipient, placeholder: addressPlaceholder ?? recipient, autoComplete: 'off', autoCapitalize: 'none', autoCorrect: 'off', spellCheck: false, ...addressInputProps, value: address ?? '', onChange: event => onAddressChange(event.target.value) }), onScan && _jsx(IconButton, { intent: 'secondary', label: messages.swapScan ?? en.swapScan, onClick: onScan, children: _jsx(SwapIcon, { name: 'scan' }) })] });
98
+ return _jsxs("div", { className: `hig-picker${className ? ` ${className}` : ''}`, role: 'group', "aria-label": label, children: [row && (addressLabel ? _jsx(Field, { label: addressLabel, children: row }) : row), tokens && onSelect && _jsx(TokenList, { ...list, tokens: tokens, onSelect: onSelect, label: label })] });
77
99
  }
78
100
  /** @deprecated Renamed `FromPickerBlock`. The old name keeps working until the next major release. */
79
101
  export const FromPicker = FromPickerBlock;
@@ -1,25 +1,38 @@
1
1
  import React from 'react';
2
- /** A number the host supplies as a number so it updates place by place: `{value:0.53,options:{style:'currency',currency:'USD'}}`. `null` reads as unknown. */
3
- export interface PositionBlockFigure {
4
- value: number | null;
5
- options?: Intl.NumberFormatOptions;
6
- prefix?: string;
7
- suffix?: string;
8
- }
2
+ import { type Figure } from '../figure.js';
3
+ import { type HeaderCloseProps, type ScreenHeaderControlProps } from './screen-header.js';
4
+ /** A number the host supplies as a number so it updates place by place: `{value:0.53,options:{style:'currency',currency:'USD'}}`, or Leverage as `{value:40,suffix:'×'}`. `null` reads as unknown. `formattedValue` is the host's own text for it, still moving place by place. */
5
+ export type PositionBlockFigure = Figure;
9
6
  /** One line of the summary: Notional, Fee, Liquidation. `value` is host text (`2% of profit`) or a live figure. `tone` colours the value; the default is the text colour. */
10
7
  export interface PositionBlockDetail {
11
8
  id?: string;
12
9
  label: string;
13
10
  value: string | PositionBlockFigure;
14
11
  tone?: 'positive' | 'negative' | 'muted';
12
+ /** Draws the value struck through, for a charge that does not apply, and reads this host text after it: Waived. */
13
+ struck?: string;
14
+ /** Host content right after the label, such as a badge that explains the line. It may be interactive. */
15
+ labelAccessory?: React.ReactNode;
15
16
  }
16
- /** One setting of the position: Size, Leverage, Stop Loss. With `onSelect` the row opens the host's own view and shows a chevron. */
17
+ /** One setting of the position: Size, Leverage, Stop Loss. With `onSelect` the row opens the host's own view and shows a chevron; with `onCheckedChange` the row is a switch. */
17
18
  export interface PositionBlockRow {
18
19
  id: string;
19
20
  label: string;
20
- value?: string;
21
+ /** Host text on the trailing edge, or a live figure that updates place by place. */
22
+ value?: string | PositionBlockFigure;
21
23
  onSelect?: () => void;
22
24
  disabled?: boolean;
25
+ /** With `onCheckedChange`, the row is a switch named by its label, and the whole row toggles it. */
26
+ checked?: boolean;
27
+ onCheckedChange?: (checked: boolean) => void;
28
+ }
29
+ /** An action on the paper trading row's card, under the switch, such as collecting what the paper position earned. */
30
+ export interface PositionBlockFlagAction {
31
+ label: string;
32
+ onSelect: () => void;
33
+ intent?: 'primary' | 'secondary' | 'destructive';
34
+ busy?: boolean;
35
+ disabled?: boolean;
23
36
  }
24
37
  /** The paper trading switch. The host supplies its name, because HIG ships no trading terms. */
25
38
  export interface PositionBlockFlag {
@@ -27,6 +40,8 @@ export interface PositionBlockFlag {
27
40
  checked: boolean;
28
41
  onCheckedChange: (checked: boolean) => void;
29
42
  disabled?: boolean;
43
+ /** A button on the row's card, under the switch. */
44
+ action?: PositionBlockFlagAction;
30
45
  }
31
46
  export interface PositionBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
32
47
  /** Heading: Position. */
@@ -35,7 +50,7 @@ export interface PositionBlockProps extends Omit<React.HTMLAttributes<HTMLElemen
35
50
  details: readonly PositionBlockDetail[];
36
51
  /** One sentence under the summary, such as the minimum margin. */
37
52
  note?: string;
38
- /** Shows the paper trading switch as a row of its own above the settings. */
53
+ /** Shows the paper trading switch as a row of its own above the settings. The whole row toggles it. */
39
54
  paperTrade?: PositionBlockFlag;
40
55
  /** The settings, as groups of rows. Each group is one rounded container. */
41
56
  groups: readonly (readonly PositionBlockRow[])[];
@@ -44,6 +59,14 @@ export interface PositionBlockProps extends Omit<React.HTMLAttributes<HTMLElemen
44
59
  onBack?: () => void;
45
60
  /** A control on the trailing edge of the header in place of Close. */
46
61
  headerAction?: React.ReactNode;
62
+ /** `id` of the heading, so a dialog or sheet can name itself with `aria-labelledby`. */
63
+ headingId?: string;
64
+ /** Set true to pin the header to the top of the nearest scrolling container while the rest scrolls under it. It is transparent at rest and fills with `--hig-sticky-header-background` once content scrolls under it. */
65
+ stickyHeader?: boolean;
66
+ /** Attributes for the header's Back `<button>`. */
67
+ backProps?: ScreenHeaderControlProps;
68
+ /** Attributes for the header's Close `<button>`; `disabled` draws Close unavailable. */
69
+ closeProps?: HeaderCloseProps;
47
70
  }
48
71
  /** The position being opened or edited: a summary of what it costs and where it ends, an optional paper trading switch, and its settings as grouped rows that open the host's own views. */
49
- export declare function PositionBlock({ title, details, note, paperTrade, groups, onClose, onBack, headerAction, className, ...rest }: PositionBlockProps): React.JSX.Element;
72
+ export declare function PositionBlock({ title, details, note, paperTrade, groups, onClose, onBack, headerAction, headingId, stickyHeader, backProps, closeProps, className, ...rest }: PositionBlockProps): React.JSX.Element;
@@ -1,14 +1,25 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import * as en from '@bloxwap/hig/contracts/messages';
4
4
  import { useHIG } from '../provider.js';
5
+ import { Button } from '../button.js';
5
6
  import { Switch } from '../selection.js';
6
7
  import { ListGroup, ListRow } from '../list-group.js';
7
8
  import { AnimatedNumberReadout } from '../animated-number.js';
8
- import { ScreenHeader } from './screen-header.js';
9
- import { SwapIcon } from './swap/shared.js';
9
+ import { figureProps } from '../figure.js';
10
+ import { HeaderClose, ScreenHeader } from './screen-header.js';
11
+ const figure = (value) => typeof value === 'string' ? value : _jsx(AnimatedNumberReadout, { ...figureProps(value) });
12
+ /** A press anywhere on a switch row that is not on a control toggles the row's switch, through the switch itself so its change and feedback run once. */
13
+ function toggleRow(event) {
14
+ if (event.target.closest('a,button,input,label,select,textarea'))
15
+ return;
16
+ const input = event.currentTarget.querySelector('input[role="switch"]');
17
+ if (input && !input.disabled)
18
+ input.click();
19
+ }
10
20
  /** The position being opened or edited: a summary of what it costs and where it ends, an optional paper trading switch, and its settings as grouped rows that open the host's own views. */
11
- export function PositionBlock({ title, details, note, paperTrade, groups, onClose, onBack, headerAction, className, ...rest }) {
21
+ export function PositionBlock({ title, details, note, paperTrade, groups, onClose, onBack, headerAction, headingId, stickyHeader, backProps, closeProps, className, ...rest }) {
12
22
  const { messages } = useHIG();
13
- return _jsxs("section", { ...rest, className: `hig-position-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: title, onBack: onBack, action: headerAction ?? (onClose && _jsx("button", { type: 'button', className: 'hig-swap-back', "aria-label": messages.close ?? en.close, onClick: onClose, children: _jsx(SwapIcon, { name: 'close' }) })) }), details.length > 0 && _jsx("dl", { className: 'hig-position-details', children: details.map((detail, index) => _jsxs("div", { "data-tone": detail.tone, children: [_jsx("dt", { children: detail.label }), _jsx("dd", { className: 'hig-number', children: typeof detail.value === 'string' ? detail.value : _jsx(AnimatedNumberReadout, { ...detail.value }) })] }, detail.id ?? index)) }), note && _jsx("p", { className: 'hig-position-note', children: note }), (paperTrade || groups.some(group => group.length > 0)) && _jsxs("div", { className: 'hig-position-groups', children: [paperTrade && _jsx(ListGroup, { className: 'hig-position-flag', children: _jsx(ListRow, { label: paperTrade.label, disabled: paperTrade.disabled, trailing: _jsx(Switch, { label: paperTrade.label, checked: paperTrade.checked, disabled: paperTrade.disabled, onCheckedChange: paperTrade.onCheckedChange }) }) }), groups.map((group, index) => group.length > 0 && _jsx(ListGroup, { children: group.map(row => _jsx(ListRow, { label: row.label, value: row.value, onSelect: row.onSelect, disabled: row.disabled }, row.id)) }, index))] })] });
23
+ const flag = paperTrade && _jsx(ListRow, { label: paperTrade.label, disabled: paperTrade.disabled, onClick: toggleRow, trailing: _jsx(Switch, { label: paperTrade.label, checked: paperTrade.checked, disabled: paperTrade.disabled, onCheckedChange: paperTrade.onCheckedChange }) });
24
+ return _jsxs("section", { ...rest, className: `hig-position-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: title, onBack: onBack, backProps: backProps, headingId: headingId, stickyHeader: stickyHeader, action: headerAction ?? (onClose && _jsx(HeaderClose, { onClose: onClose, label: messages.close ?? en.close, closeProps: closeProps })) }), details.length > 0 && _jsx("dl", { className: 'hig-position-details', children: details.map((detail, index) => _jsxs("div", { "data-tone": detail.tone, children: [_jsxs("dt", { children: [detail.label, detail.labelAccessory != null && _jsx("span", { className: 'hig-position-label-accessory', children: detail.labelAccessory })] }), _jsx("dd", { className: 'hig-number', children: detail.struck ? _jsxs(_Fragment, { children: [_jsx("span", { className: 'hig-position-struck', children: figure(detail.value) }), _jsxs("span", { className: 'hig-sr-only', children: [" ", detail.struck] })] }) : figure(detail.value) })] }, detail.id ?? index)) }), note && _jsx("p", { className: 'hig-position-note', children: note }), (paperTrade || groups.some(group => group.length > 0)) && _jsxs("div", { className: 'hig-position-groups', children: [paperTrade && _jsx(ListGroup, { className: 'hig-position-flag', children: paperTrade.action ? _jsxs("div", { className: 'hig-position-flag-card', children: [flag, _jsx("div", { className: 'hig-position-flag-action', children: _jsx(Button, { fullWidth: true, intent: paperTrade.action.intent ?? 'primary', busy: paperTrade.action.busy, disabled: paperTrade.action.disabled, onClick: paperTrade.action.onSelect, children: paperTrade.action.label }) })] }) : flag }), groups.map((group, index) => group.length > 0 && _jsx(ListGroup, { children: group.map(row => row.onCheckedChange ? _jsx(ListRow, { label: row.label, value: row.value == null ? undefined : figure(row.value), disabled: row.disabled, onClick: toggleRow, trailing: _jsx(Switch, { label: row.label, checked: !!row.checked, disabled: row.disabled, onCheckedChange: row.onCheckedChange }) }, row.id) : _jsx(ListRow, { label: row.label, value: row.value == null || typeof row.value === 'string' ? row.value : figure(row.value), onSelect: row.onSelect, disabled: row.disabled }, row.id)) }, index))] })] });
14
25
  }