@bloxwap/hig 0.5.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/README.md +1 -1
  2. package/chart/README.md +1 -1
  3. package/contracts/README.md +1 -1
  4. package/contracts/dist/index.d.ts +16 -0
  5. package/contracts/dist/index.js +22 -0
  6. package/contracts/dist/messages.d.ts +37 -4
  7. package/contracts/dist/messages.js +13 -2
  8. package/feedback/README.md +1 -1
  9. package/native/README.md +1 -1
  10. package/native/dist/account-block.d.ts +92 -0
  11. package/native/dist/account-block.js +61 -0
  12. package/native/dist/animated-number-model.d.ts +7 -1
  13. package/native/dist/animated-number-model.js +50 -1
  14. package/native/dist/animated-number.d.ts +3 -1
  15. package/native/dist/animated-number.js +8 -5
  16. package/native/dist/asset-balance-row.d.ts +36 -0
  17. package/native/dist/asset-balance-row.js +26 -0
  18. package/native/dist/bar-mark.d.ts +57 -0
  19. package/native/dist/bar-mark.js +48 -0
  20. package/native/dist/bar-pnl.d.ts +50 -0
  21. package/native/dist/bar-pnl.js +60 -0
  22. package/native/dist/blocks.d.ts +38 -0
  23. package/native/dist/blocks.js +42 -0
  24. package/native/dist/button.js +3 -1
  25. package/native/dist/data.d.ts +1 -1
  26. package/native/dist/data.js +6 -4
  27. package/native/dist/field.d.ts +14 -5
  28. package/native/dist/field.js +33 -8
  29. package/native/dist/figure.d.ts +23 -0
  30. package/native/dist/figure.js +10 -0
  31. package/native/dist/icons.d.ts +8 -0
  32. package/native/dist/icons.js +4 -0
  33. package/native/dist/language-block.d.ts +35 -0
  34. package/native/dist/language-block.js +30 -0
  35. package/native/dist/list-group.d.ts +60 -0
  36. package/native/dist/list-group.js +85 -0
  37. package/native/dist/manage-position-block.d.ts +95 -0
  38. package/native/dist/manage-position-block.js +82 -0
  39. package/native/dist/market-row.d.ts +46 -0
  40. package/native/dist/market-row.js +30 -0
  41. package/native/dist/notifications-block.d.ts +53 -0
  42. package/native/dist/notifications-block.js +22 -0
  43. package/native/dist/pickers.d.ts +35 -5
  44. package/native/dist/pickers.js +21 -9
  45. package/native/dist/position-block.d.ts +107 -0
  46. package/native/dist/position-block.js +55 -0
  47. package/native/dist/profile-block.d.ts +66 -0
  48. package/native/dist/profile-block.js +48 -0
  49. package/native/dist/provider.d.ts +9 -3
  50. package/native/dist/provider.js +7 -3
  51. package/native/dist/radio-group.d.ts +9 -3
  52. package/native/dist/radio-group.js +4 -5
  53. package/native/dist/recipes.d.ts +6 -46
  54. package/native/dist/recipes.js +6 -33
  55. package/native/dist/reward-block.d.ts +122 -0
  56. package/native/dist/reward-block.js +53 -0
  57. package/native/dist/screen-header.d.ts +49 -0
  58. package/native/dist/screen-header.js +29 -0
  59. package/native/dist/selection.d.ts +2 -2
  60. package/native/dist/setting-header.d.ts +2 -0
  61. package/native/dist/setting-header.js +2 -0
  62. package/native/dist/setting-switch.d.ts +31 -0
  63. package/native/dist/setting-switch.js +20 -0
  64. package/native/dist/signals-block.d.ts +61 -0
  65. package/native/dist/signals-block.js +26 -0
  66. package/native/dist/sound-haptics-block.d.ts +66 -0
  67. package/native/dist/sound-haptics-block.js +32 -0
  68. package/native/dist/status.d.ts +6 -5
  69. package/native/dist/status.js +5 -5
  70. package/native/dist/sticky-header.d.ts +28 -0
  71. package/native/dist/sticky-header.js +21 -0
  72. package/native/dist/surface.d.ts +3 -1
  73. package/native/dist/surface.js +2 -1
  74. package/native/dist/{swap-panel.d.ts → swap-panel-block.d.ts} +8 -3
  75. package/native/dist/{swap-panel.js → swap-panel-block.js} +13 -8
  76. package/native/dist/swap-parts.d.ts +5 -3
  77. package/native/dist/swap-parts.js +2 -2
  78. package/native/dist/swap-shared.d.ts +6 -0
  79. package/native/dist/swap-sheet.d.ts +4 -4
  80. package/native/dist/swap-sheet.js +4 -4
  81. package/native/dist/swap-views.d.ts +1 -1
  82. package/native/dist/swap-views.js +9 -7
  83. package/native/dist/switch-row.d.ts +3 -2
  84. package/native/dist/switch-row.js +5 -3
  85. package/native/dist/switch.d.ts +4 -2
  86. package/native/dist/switch.js +3 -3
  87. package/native/dist/target-block.d.ts +110 -0
  88. package/native/dist/target-block.js +74 -0
  89. package/native/dist/token-action-block.d.ts +47 -0
  90. package/native/dist/token-action-block.js +28 -0
  91. package/native/dist/trade-history-detail-block.d.ts +84 -0
  92. package/native/dist/trade-history-detail-block.js +46 -0
  93. package/native/dist/trade-history-list-block.d.ts +110 -0
  94. package/native/dist/trade-history-list-block.js +64 -0
  95. package/native/dist/wallet-address-core.d.ts +25 -0
  96. package/native/dist/wallet-address-core.js +31 -0
  97. package/native/dist/wallet-address.d.ts +6 -10
  98. package/native/dist/wallet-address.js +16 -20
  99. package/native-fonts/README.md +1 -1
  100. package/og-fonts/README.md +1 -1
  101. package/package.json +266 -41
  102. package/react/README.md +1 -1
  103. package/react/dist/animated-number-model.d.ts +6 -0
  104. package/react/dist/animated-number-model.js +33 -0
  105. package/react/dist/animated-number.d.ts +5 -1
  106. package/react/dist/animated-number.js +12 -8
  107. package/react/dist/asset-balance-row.d.ts +35 -0
  108. package/react/dist/asset-balance-row.js +18 -0
  109. package/react/dist/bar-mark.d.ts +38 -0
  110. package/react/dist/bar-mark.js +23 -0
  111. package/react/dist/bar-pnl.d.ts +49 -0
  112. package/react/dist/bar-pnl.js +45 -0
  113. package/react/dist/blocks/account-block.d.ts +92 -0
  114. package/react/dist/blocks/account-block.js +62 -0
  115. package/react/dist/blocks/language-block.d.ts +36 -0
  116. package/react/dist/blocks/language-block.js +52 -0
  117. package/react/dist/blocks/manage-position-block.d.ts +93 -0
  118. package/react/dist/blocks/manage-position-block.js +47 -0
  119. package/react/dist/blocks/market-row.d.ts +36 -0
  120. package/react/dist/blocks/market-row.js +16 -0
  121. package/react/dist/blocks/notifications-block.d.ts +46 -0
  122. package/react/dist/blocks/notifications-block.js +17 -0
  123. package/react/dist/{recipes → blocks}/pickers.d.ts +32 -4
  124. package/react/dist/{recipes → blocks}/pickers.js +35 -11
  125. package/react/dist/blocks/position-block.d.ts +72 -0
  126. package/react/dist/blocks/position-block.js +25 -0
  127. package/react/dist/blocks/profile-block.d.ts +71 -0
  128. package/react/dist/blocks/profile-block.js +41 -0
  129. package/react/dist/blocks/reward-block.d.ts +120 -0
  130. package/react/dist/blocks/reward-block.js +34 -0
  131. package/react/dist/blocks/screen-header.d.ts +33 -0
  132. package/react/dist/blocks/screen-header.js +20 -0
  133. package/react/dist/blocks/setting-switch.d.ts +23 -0
  134. package/react/dist/blocks/setting-switch.js +12 -0
  135. package/react/dist/blocks/signals-block.d.ts +54 -0
  136. package/react/dist/blocks/signals-block.js +15 -0
  137. package/react/dist/blocks/sound-haptics-block.d.ts +59 -0
  138. package/react/dist/blocks/sound-haptics-block.js +22 -0
  139. package/react/dist/blocks/sticky-header.d.ts +9 -0
  140. package/react/dist/blocks/sticky-header.js +43 -0
  141. package/react/dist/blocks/swap/amount-card.js +8 -0
  142. package/react/dist/{recipes → blocks}/swap/picker.d.ts +1 -1
  143. package/react/dist/{recipes → blocks}/swap/picker.js +4 -4
  144. package/react/dist/{recipes → blocks}/swap/settings.js +2 -2
  145. package/react/dist/{recipes → blocks}/swap/shared.d.ts +8 -1
  146. package/react/dist/{recipes → blocks}/swap/shared.js +7 -4
  147. package/react/dist/{recipes/swap-panel.d.ts → blocks/swap-panel-block.d.ts} +8 -2
  148. package/react/dist/{recipes/swap-panel.js → blocks/swap-panel-block.js} +9 -7
  149. package/react/dist/{recipes → blocks}/swap-sheet.d.ts +4 -4
  150. package/react/dist/{recipes → blocks}/swap-sheet.js +4 -4
  151. package/react/dist/blocks/target-block.d.ts +103 -0
  152. package/react/dist/blocks/target-block.js +73 -0
  153. package/react/dist/blocks/token-action-block.d.ts +46 -0
  154. package/react/dist/blocks/token-action-block.js +21 -0
  155. package/react/dist/{recipes → blocks}/trade-entry.js +2 -2
  156. package/react/dist/blocks/trade-history-detail-block.d.ts +78 -0
  157. package/react/dist/blocks/trade-history-detail-block.js +17 -0
  158. package/react/dist/blocks/trade-history-list-block.d.ts +67 -0
  159. package/react/dist/blocks/trade-history-list-block.js +28 -0
  160. package/react/dist/blocks.d.ts +20 -0
  161. package/react/dist/blocks.js +21 -0
  162. package/react/dist/button.js +6 -4
  163. package/react/dist/data.js +3 -3
  164. package/react/dist/field.d.ts +14 -6
  165. package/react/dist/field.js +19 -8
  166. package/react/dist/figure.d.ts +23 -0
  167. package/react/dist/figure.js +12 -0
  168. package/react/dist/list-group.d.ts +59 -0
  169. package/react/dist/list-group.js +52 -0
  170. package/react/dist/provider.d.ts +40 -3
  171. package/react/dist/provider.js +63 -6
  172. package/react/dist/selection.d.ts +8 -2
  173. package/react/dist/selection.js +11 -6
  174. package/react/dist/styles.css +425 -5
  175. package/react/dist/surface.d.ts +5 -1
  176. package/react/dist/surface.js +1 -1
  177. package/react/dist/wallet-address-core.d.ts +23 -0
  178. package/react/dist/wallet-address-core.js +24 -0
  179. package/react/dist/wallet-address.d.ts +6 -12
  180. package/react/dist/wallet-address.js +5 -16
  181. package/tokens/README.md +1 -1
  182. package/react/dist/recipes/activity-list.d.ts +0 -8
  183. package/react/dist/recipes/activity-list.js +0 -6
  184. package/react/dist/recipes/balance-card.d.ts +0 -6
  185. package/react/dist/recipes/balance-card.js +0 -5
  186. package/react/dist/recipes/code-window.d.ts +0 -4
  187. package/react/dist/recipes/code-window.js +0 -4
  188. package/react/dist/recipes/market-row.d.ts +0 -25
  189. package/react/dist/recipes/market-row.js +0 -8
  190. package/react/dist/recipes/swap/amount-card.js +0 -7
  191. package/react/dist/recipes.d.ts +0 -10
  192. package/react/dist/recipes.js +0 -11
  193. /package/react/dist/{recipes → blocks}/install-command.d.ts +0 -0
  194. /package/react/dist/{recipes → blocks}/install-command.js +0 -0
  195. /package/react/dist/{recipes → blocks}/marketing-hero.d.ts +0 -0
  196. /package/react/dist/{recipes → blocks}/marketing-hero.js +0 -0
  197. /package/react/dist/{recipes → blocks}/swap/amount-card.d.ts +0 -0
  198. /package/react/dist/{recipes → blocks}/swap/settings.d.ts +0 -0
  199. /package/react/dist/{recipes → blocks}/trade-entry.d.ts +0 -0
@@ -0,0 +1,110 @@
1
+ import React from 'react';
2
+ import { type ScrollViewProps } from 'react-native';
3
+ /** What the target does: close in profit, or cap the loss. */
4
+ export type TargetKind = 'take-profit' | 'stop-loss';
5
+ /** How the target is expressed: profit or loss in dollars, a price, or a share of the position. */
6
+ export type TargetUnit = 'dollar' | 'price' | 'percent';
7
+ /** The three prices on the bar. */
8
+ export type TargetPrice = 'entry' | 'trigger';
9
+ /** Every trading word of the block. HIG's built-in strings hold no trading terms, so the host supplies them, translated; only Cancel has a built-in default. */
10
+ export interface TargetBlockLabels {
11
+ /** Heading: Take Profit, Stop Loss. */
12
+ title: string;
13
+ /** The confirming action: Set Take Profit. */
14
+ submit: string;
15
+ /** Defaults to the built-in Cancel. */
16
+ cancel?: string;
17
+ entry: string;
18
+ /** The price the order triggers at: If triggered. */
19
+ trigger: string;
20
+ /** Name of the unit control. */
21
+ unit: string;
22
+ units: Record<TargetUnit, string>;
23
+ /** The row that opens the host's own entry: Custom. */
24
+ custom: string;
25
+ /** Accessible name of the info button that shows `note`: How this order fills. Without it the note is always shown. */
26
+ info?: string;
27
+ }
28
+ export interface TargetBlockProps {
29
+ kind: TargetKind;
30
+ labels: TargetBlockLabels;
31
+ /** Title of the price card, the position the target belongs to: `BTC · Long 40×`. */
32
+ position?: string;
33
+ /** Trailing text of the price card, the order the target places: Take-limit, Stop-market. */
34
+ orderType?: string;
35
+ /** One sentence about how the order fills. With `labels.info` it opens in a popover from an info button on the trailing edge of the header; otherwise it is always shown under the headline figure. */
36
+ note?: string;
37
+ entry: number;
38
+ /** Price the order triggers at. Defaults to `value` when the unit is `price`; otherwise unknown until the host supplies it. */
39
+ trigger?: number | null;
40
+ unit: TargetUnit;
41
+ /** Units offered, in order. Defaults to all three; one unit hides the control. `{unit, disabled}` shows a unit that cannot be chosen now, dimmed. */
42
+ units?: readonly (TargetUnit | TargetUnitOption)[];
43
+ onUnitChange?: (unit: TargetUnit) => void;
44
+ /** The target in the current unit: signed dollars (2, -0.5), a price, or a signed fraction (0.05 reads +5%). `null` reads as unknown and disables the confirming action. */
45
+ value: number | null;
46
+ onValueChange?: (value: number) => void;
47
+ /** Quick choices in the current unit. The one equal to `value` is shown selected. `{value, disabled}` shows a choice that cannot be taken now, dimmed. */
48
+ presets?: readonly (number | TargetPreset)[];
49
+ /** Shows the Custom row; the host opens its own entry. */
50
+ onCustom?: () => void;
51
+ /** The value the host's own entry set, in the current unit. The Custom row then shows it on its trailing edge and reads as selected, and no quick choice does. Has no effect without `onCustom`; null keeps the row a toggle that reads as not selected. */
52
+ customValue?: number | null;
53
+ /** Format of prices. Defaults to US dollars. */
54
+ priceOptions?: Intl.NumberFormatOptions;
55
+ /** Set true to draw the prices inside a card: a surface fill, padding and radius. By default the title row, bar and readouts sit directly on the screen. */
56
+ surface?: boolean;
57
+ onSubmit: () => void;
58
+ /** Defaults to disabled while `value` is unknown. */
59
+ submitDisabled?: boolean;
60
+ busy?: boolean;
61
+ /** Shows Cancel beside the confirming action. */
62
+ onCancel?: () => void;
63
+ /** Shows Back on the leading edge of the header. */
64
+ onBack?: () => void;
65
+ /** A control on the trailing edge of the header, usually an IconButton. It takes the place of the info button, and the note is then always shown, unless `headerActionBesideInfo` is set. */
66
+ headerAction?: React.ReactNode;
67
+ /** Set true to keep the info button when `headerAction` is given: the info button comes first and `headerAction` sits on the trailing edge. */
68
+ headerActionBesideInfo?: boolean;
69
+ /** Sets `nativeID` on the title, so a sheet around the pane can name itself with `accessibilityLabelledBy` (Android). */
70
+ headingId?: string;
71
+ /** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container. */
72
+ stickyHeader?: boolean;
73
+ /** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill. */
74
+ stickyHeaderBackground?: string;
75
+ /** The scroll view used with `stickyHeader`, such as a sheet library's own. */
76
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
77
+ testID?: string;
78
+ }
79
+ /** A quick choice that can be shown dimmed. */
80
+ export interface TargetPreset {
81
+ value: number;
82
+ disabled?: boolean;
83
+ }
84
+ /** A unit that can be shown dimmed. */
85
+ export interface TargetUnitOption {
86
+ unit: TargetUnit;
87
+ disabled?: boolean;
88
+ }
89
+ /** The quick choices as `{value, disabled}`, whichever form the host gave. */
90
+ export declare function targetPresets(presets: readonly (number | TargetPreset)[]): TargetPreset[];
91
+ /** The units as `{unit, disabled}`, whichever form the host gave. */
92
+ export declare function targetUnits(units: readonly (TargetUnit | TargetUnitOption)[]): TargetUnitOption[];
93
+ /** Number format of a target in a unit. Dollars and percents carry their sign; `short` drops the cents of a whole dollar amount, for a preset. */
94
+ export declare function targetFormat(unit: TargetUnit, priceOptions?: Intl.NumberFormatOptions, short?: number): Intl.NumberFormatOptions;
95
+ /**
96
+ * Where each known price sits on the bar, as a fraction of its width from the low-price edge, the prices in price order, and
97
+ * the stretch (`from` to `to`) between them: the whole bar, from entry to the trigger.
98
+ * Without a trigger there is no stretch.
99
+ */
100
+ export declare function targetLayout({ entry, trigger }: {
101
+ entry: number;
102
+ trigger?: number | null;
103
+ }): {
104
+ positions: Partial<Record<TargetPrice, number>>;
105
+ order: TargetPrice[];
106
+ from: number;
107
+ to: number;
108
+ };
109
+ /** A take profit or a stop loss on one position as a screen: the target as the headline figure, a price card whose bar shows how far the price is from the trigger, the unit, the host's quick choices, and the confirming action. The bar is decorative; each price reads its label and value. */
110
+ export declare function TargetBlock({ kind, labels, position, orderType, note, entry, trigger, unit, units, onUnitChange, value, onValueChange, presets, onCustom, customValue, priceOptions, surface, onSubmit, submitDisabled, busy, onCancel, onBack, headerAction, headerActionBesideInfo, headingId, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: TargetBlockProps): React.JSX.Element;
@@ -0,0 +1,74 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { Pressable, View } from 'react-native';
4
+ import { formatNumber } from '@bloxwap/hig/contracts';
5
+ import { useColors, useFills, useHIG, useMessages, useNumberLocale, usePresentNumber } from './provider.js';
6
+ import { StickyHeaderLayout } from './sticky-header.js';
7
+ import { Surface, Text } from './surface.js';
8
+ import { Button, IconButton } from './button.js';
9
+ import { SegmentedControl } from './radio-group.js';
10
+ import { ChevronIcon, SeverityIcon } from './icons.js';
11
+ import { AnimatedNumberReadout } from './animated-number.js';
12
+ import { formatNumberReadout } from './animated-number-model.js';
13
+ /** The quick choices as `{value, disabled}`, whichever form the host gave. */
14
+ export function targetPresets(presets) { return presets.map(preset => typeof preset === 'number' ? { value: preset } : preset); }
15
+ /** The units as `{unit, disabled}`, whichever form the host gave. */
16
+ export function targetUnits(units) { return units.map(unit => typeof unit === 'string' ? { unit } : unit); }
17
+ const usd = { style: 'currency', currency: 'USD' };
18
+ const allUnits = ['dollar', 'price', 'percent'];
19
+ const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
20
+ const known = (value) => value != null && Number.isFinite(value);
21
+ /** Number format of a target in a unit. Dollars and percents carry their sign; `short` drops the cents of a whole dollar amount, for a preset. */
22
+ export function targetFormat(unit, priceOptions = usd, short) {
23
+ if (unit === 'price')
24
+ return priceOptions;
25
+ if (unit === 'percent')
26
+ return { style: 'percent', maximumFractionDigits: 2, signDisplay: 'exceptZero' };
27
+ return { ...usd, signDisplay: 'exceptZero', ...(short !== undefined && Number.isInteger(short) ? { maximumFractionDigits: 0 } : null) };
28
+ }
29
+ /**
30
+ * Where each known price sits on the bar, as a fraction of its width from the low-price edge, the prices in price order, and
31
+ * the stretch (`from` to `to`) between them: the whole bar, from entry to the trigger.
32
+ * Without a trigger there is no stretch.
33
+ */
34
+ export function targetLayout({ entry, trigger }) {
35
+ const values = {};
36
+ if (known(entry))
37
+ values.entry = entry;
38
+ if (known(trigger))
39
+ values.trigger = trigger;
40
+ const kinds = Object.keys(values), prices = kinds.map(kind => values[kind]);
41
+ if (!kinds.length)
42
+ return { positions: {}, order: [], from: 0.5, to: 0.5 };
43
+ const low = Math.min(...prices), span = Math.max(...prices) - low;
44
+ const positions = {};
45
+ for (const kind of kinds)
46
+ positions[kind] = span > 0 ? (values[kind] - low) / span : 0.5;
47
+ const rank = { entry: 0, trigger: 1 };
48
+ const order = [...kinds].sort((a, b) => values[a] - values[b] || rank[a] - rank[b]);
49
+ const start = positions.entry, end = positions.trigger;
50
+ return start === undefined || end === undefined ? { positions, order, from: 0.5, to: 0.5 } : { positions, order, from: Math.min(start, end), to: Math.max(start, end) };
51
+ }
52
+ /** A take profit or a stop loss on one position as a screen: the target as the headline figure, a price card whose bar shows how far the price is from the trigger, the unit, the host's quick choices, and the confirming action. The bar is decorative; each price reads its label and value. */
53
+ export function TargetBlock({ kind, labels, position, orderType, note, entry, trigger, unit, units = allUnits, onUnitChange, value, onValueChange, presets = [], onCustom, customValue, priceOptions = usd, surface = false, onSubmit, submitDisabled, busy, onCancel, onBack, headerAction, headerActionBesideInfo, headingId, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
54
+ const PriceCard = surface ? Surface : View;
55
+ const colors = useColors(), fills = useFills(), t = useMessages(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
56
+ const [open, setOpen] = useState(false);
57
+ const info = note && labels.info && (!headerAction || headerActionBesideInfo) ? labels.info : undefined;
58
+ // With the info button beside a host control, both header sides widen together so the title stays centred.
59
+ const pair = !!info && headerAction != null, side = pair ? 92 : 44;
60
+ const custom = onCustom && known(customValue) ? customValue : null, customText = custom === null ? null : formatNumber(custom, locale, present(targetFormat(unit, priceOptions)));
61
+ const target = trigger !== undefined ? trigger : unit === 'price' ? value : null;
62
+ const { positions, order, from, to } = targetLayout({ entry, trigger: target });
63
+ const prices = { entry, trigger: target };
64
+ const stop = kind === 'stop-loss', tone = stop ? colors.negative : colors.positive, intent = stop ? 'destructive' : 'primary';
65
+ const triggerLeads = (positions.trigger ?? 0) < (positions.entry ?? 0);
66
+ const align = (index) => order.length > 1 && index === order.length - 1 ? 'flex-end' : order.length === 3 && index === 1 ? 'center' : 'flex-start';
67
+ const part = (grow) => ({ flexGrow: grow, flexShrink: 1, flexBasis: 0, backgroundColor: fills.raised });
68
+ const sticky = !!stickyHeader;
69
+ const header = _jsxs(View, { testID: 'target-header', style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: side, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: 'target-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'target-title', nativeID: headingId, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: labels.title }), _jsx(View, { style: { minWidth: side, alignItems: 'flex-end' }, children: info ? (() => { const button = _jsx(IconButton, { intent: 'ghost', label: info, suppressFeedback: true, testID: 'target-info', accessibilityState: { expanded: open }, onPress: () => setOpen(!open), children: _jsx(SeverityIcon, { kind: 'info', color: colors.text }) }); return pair ? _jsxs(View, { testID: 'target-header-actions', style: { direction, flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [button, headerAction] }) : button; })() : headerAction })] });
70
+ const body = _jsxs(_Fragment, { children: [_jsx(View, { style: { alignItems: 'center', marginTop: 16 }, children: _jsx(AnimatedNumberReadout, { testID: 'target-amount', value: value, options: targetFormat(unit, priceOptions), style: { fontSize: 44, lineHeight: 50, fontWeight: '700', letterSpacing: -0.9, textAlign: 'center' } }) }), note && !info ? _jsx(Text, { testID: 'target-note', style: { color: colors.muted, fontSize: 14, lineHeight: 21, textAlign: 'center', marginTop: 16 }, children: note }) : null, _jsxs(PriceCard, { testID: 'target-prices', style: { gap: 12, marginTop: 16, minWidth: 0 }, children: [position || orderType ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [position ? _jsx(Text, { testID: 'target-position', accessibilityRole: 'header', style: { fontSize: 16, lineHeight: 24, fontWeight: '600', flexShrink: 1 }, children: position }) : _jsx(View, {}), orderType ? _jsx(Text, { testID: 'target-order-type', style: { color: colors.muted, fontSize: 14, lineHeight: 21, flexShrink: 1 }, children: orderType }) : null] }) : null, _jsxs(View, { ...hidden, testID: 'target-bar', style: { flexDirection: 'row', height: 24, borderRadius: 8, overflow: 'hidden' }, children: [_jsx(View, { style: part(from) }), to > from ? _jsx(View, { testID: 'target-move', style: { flexGrow: to - from, flexShrink: 1, flexBasis: 0, minWidth: 6, backgroundColor: tone, borderStartWidth: 3, borderEndWidth: 3, borderStartColor: triggerLeads ? tone : colors.text, borderEndColor: triggerLeads ? colors.text : tone } }) : null, _jsx(View, { style: part(1 - to) })] }), _jsx(View, { style: { flexDirection: 'row', justifyContent: 'space-between', gap: 12 }, children: order.map((price, index) => _jsxs(View, { accessible: true, accessibilityLabel: `${labels[price]}, ${formatNumberReadout(prices[price], locale, present(priceOptions)).text}`, testID: `target-${price}`, style: { alignItems: align(index), flexShrink: 1, minWidth: 0 }, children: [_jsx(View, { ...hidden, children: _jsx(AnimatedNumberReadout, { value: prices[price], options: priceOptions, tone: price === 'trigger' ? (stop ? 'negative' : 'positive') : 'text', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { color: colors.muted, fontSize: 12, lineHeight: 16 }, children: labels[price] })] }, price)) })] }), units.length > 1 ? _jsx(View, { testID: 'target-units', style: { marginTop: 16 }, children: _jsx(SegmentedControl, { label: labels.unit, options: targetUnits(units).map(option => ({ value: option.unit, label: labels.units[option.unit], disabled: option.disabled })), value: unit, onValueChange: next => onUnitChange?.(next) }) }) : null, onCustom && customText === null ? _jsxs(Pressable, { testID: 'target-custom', accessibilityRole: 'button', accessibilityState: customValue !== undefined ? { selected: false } : undefined, onPress: onCustom, style: ({ pressed }) => ({ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 48, paddingHorizontal: 16, borderRadius: 9999, backgroundColor: pressed ? fills.raised : fills.well, marginTop: 16 }), children: [_jsx(Text, { numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: labels.custom }), _jsx(View, { ...hidden, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }) : null, onCustom && customText !== null ? _jsxs(Pressable, { testID: 'target-custom', accessibilityRole: 'button', accessibilityLabel: `${labels.custom}, ${customText}`, accessibilityState: { selected: true }, onPress: onCustom, style: ({ pressed }) => ({ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12, minHeight: 48, paddingHorizontal: 14, borderRadius: 9999, borderWidth: 2, borderColor: tone, backgroundColor: pressed ? fills.raised : fills.well, marginTop: 16 }), children: [_jsx(Text, { ...hidden, numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: labels.custom }), _jsxs(View, { ...hidden, style: { direction, flexDirection: 'row', alignItems: 'center', gap: 6, flexShrink: 1 }, children: [_jsx(Text, { testID: 'target-custom-value', numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '500', color: tone }, children: customText }), _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] })] }) : null, presets.length > 0 ? _jsx(View, { testID: 'target-presets', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: targetPresets(presets).map(({ value: preset, disabled }) => { const selected = custom === null && preset === value; return _jsx(Button, { testID: `target-preset-${preset}`, intent: selected ? intent : 'secondary', disabled: disabled, accessibilityState: { selected }, onPress: () => onValueChange?.(preset), style: { flex: 1, alignSelf: 'auto', paddingHorizontal: 8 }, children: formatNumber(preset, locale, present(targetFormat(unit, priceOptions, preset))) }, preset); }) }) : null, info && open ? _jsx(Pressable, { testID: 'target-popover-dismiss', ...hidden, onPress: () => setOpen(false), style: { position: 'absolute', top: 0, bottom: 0, left: 0, right: 0, zIndex: 1 } }) : null, info && open ? _jsx(View, { testID: 'target-popover', accessibilityLiveRegion: 'polite', style: { position: 'absolute', top: sticky ? 4 : 64, ...(direction === 'rtl' ? { left: 16 } : { right: 16 }), maxWidth: 280, zIndex: 2, padding: 12, borderRadius: 14, backgroundColor: colors.nested }, children: _jsx(Text, { testID: 'target-note', style: { color: colors.text, fontSize: 14, lineHeight: 21 }, children: note }) }) : null, _jsxs(View, { testID: 'target-actions', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: [onCancel ? _jsx(Button, { testID: 'target-cancel', intent: 'secondary', onPress: onCancel, style: { flex: 1, alignSelf: 'auto' }, children: labels.cancel ?? t.cancel }) : null, _jsx(Button, { testID: 'target-submit', intent: intent, disabled: submitDisabled ?? value === null, busy: busy, onPress: onSubmit, style: { flex: 1, alignSelf: 'auto' }, children: labels.submit })] })] });
71
+ if (sticky)
72
+ return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'target-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
73
+ return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
74
+ }
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import type { HIGMessages } from '@bloxwap/hig/contracts/messages';
3
+ import { type BarMarkElement } from './bar-mark.js';
4
+ export type { BarMarkElement, BarMarkFigure } from './bar-mark.js';
5
+ /** The actions HIG names itself. */
6
+ export type TokenActionId = 'send' | 'receive' | 'stake' | 'unstake';
7
+ export interface TokenAction {
8
+ /** 'send' | 'receive' | 'stake' | 'unstake' take a built-in label; any other id needs `label`. */
9
+ id: TokenActionId | (string & {});
10
+ label?: string;
11
+ onSelect: () => void;
12
+ disabled?: boolean;
13
+ /** Defaults to `secondary`: the actions are equal choices. */
14
+ intent?: 'primary' | 'secondary' | 'destructive';
15
+ }
16
+ export interface TokenActionBlockProps {
17
+ /** Heading, usually the ticker: HYPE. */
18
+ symbol: string;
19
+ /** Title of the assets bar: Hyperliquid. Needed only with `assets`; the symbol stands in without it. */
20
+ name?: string;
21
+ /** Total holding in dollars, on the trailing edge of the assets bar. Defaults to the sum of the asset values; null reads as unknown. */
22
+ value?: number | null;
23
+ /** The holding in token units, for a token with no dollar value: with `value` left out or null it is drawn in place of the dollar total. */
24
+ units?: number | null;
25
+ /** Host text after the units, such as ` BLOX`. */
26
+ unitsSuffix?: string;
27
+ /** Format of the units; default `{maximumFractionDigits:6}`. */
28
+ unitsOptions?: Intl.NumberFormatOptions;
29
+ /** Where the token is held: Staked, Core, Paper. Leave it out to draw no assets bar. */
30
+ assets?: readonly BarMarkElement[];
31
+ /** The chains the token sits on. Leave it out to draw no chains bar. */
32
+ chains?: readonly BarMarkElement[];
33
+ /** Title of the chains bar. Defaults to the built-in "Chains". */
34
+ chainsTitle?: string;
35
+ actions: readonly TokenAction[];
36
+ /** Shows Back on the leading edge of the header. */
37
+ onBack?: () => void;
38
+ /** A control on the trailing edge of the header, usually an IconButton. */
39
+ headerAction?: React.ReactNode;
40
+ /** A line under the actions, for example why some are missing. `noteTone` tints it as in SwapPanelBlock. */
41
+ note?: React.ReactNode;
42
+ noteTone?: 'muted' | 'warning' | 'negative';
43
+ testID?: string;
44
+ }
45
+ /** An action's text: its own `label`, else the built-in name of its id, else the id. */
46
+ export declare const tokenActionLabel: (action: TokenAction, messages: Partial<HIGMessages>) => string;
47
+ export declare function TokenActionBlock({ symbol, name, value, units, unitsSuffix, unitsOptions, assets, chains, chainsTitle, actions, onBack, headerAction, note, noteTone, testID }: TokenActionBlockProps): React.JSX.Element;
@@ -0,0 +1,28 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { formatNumber } from '@bloxwap/hig/contracts';
4
+ import { withAlpha } from '@bloxwap/hig/tokens';
5
+ import * as en from '@bloxwap/hig/contracts/messages';
6
+ import { useColors, useHIG, useMessages, useNumberLocale } from './provider.js';
7
+ import { Text } from './surface.js';
8
+ import { Button, IconButton } from './button.js';
9
+ import { ChevronIcon } from './icons.js';
10
+ import { AnimatedNumberReadout } from './animated-number.js';
11
+ import { figureProps } from './figure.js';
12
+ import { BarMark, BarMarkFigureContext } from './bar-mark.js';
13
+ const usd = { style: 'currency', currency: 'USD' };
14
+ const unitsFormat = { maximumFractionDigits: 6 };
15
+ const held = (value) => Number.isFinite(value) && value > 0;
16
+ /** An action's text: its own `label`, else the built-in name of its id, else the id. */
17
+ export const tokenActionLabel = (action, messages) => action.label ?? (action.id === 'send' ? messages.swapActionSend ?? en.swapActionSend : action.id === 'receive' ? messages.receive ?? en.receive : action.id === 'stake' ? messages.stake ?? en.stake : action.id === 'unstake' ? messages.unstake ?? en.unstake : action.id);
18
+ /** One token as a screen: a header, where it is held, which chains it sits on, then what the user can do with it. */
19
+ /** Legend figures inside the block move place by place, like its total. */
20
+ const animatedFigure = (figure, { testID }) => _jsx(AnimatedNumberReadout, { ...figureProps(figure), tone: 'faint', testID: testID, style: { fontSize: 14, lineHeight: 21 } });
21
+ export function TokenActionBlock({ symbol, name, value, units, unitsSuffix, unitsOptions = unitsFormat, assets, chains, chainsTitle, actions, onBack, headerAction, note, noteTone = 'muted', testID }) {
22
+ const colors = useColors(), t = useMessages(), { direction } = useHIG(), locale = useNumberLocale();
23
+ const total = value !== undefined ? value : (assets ?? []).reduce((sum, asset) => sum + (held(asset.value) ? asset.value : 0), 0);
24
+ // With no dollar value the units are the headline, as an AccountBlock row headlines them.
25
+ const headline = units !== undefined && value == null ? _jsx(AnimatedNumberReadout, { value: units, options: unitsOptions, suffix: unitsSuffix, tone: 'muted', testID: 'token-units', style: { fontSize: 14, lineHeight: 21 } }, 'units') : _jsx(AnimatedNumberReadout, { value: total, options: usd, tone: 'muted', testID: 'token-value', style: { fontSize: 14, lineHeight: 21 } }, 'value');
26
+ const tone = noteTone === 'warning' ? colors.warning : noteTone === 'negative' ? colors.negative : null;
27
+ return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsxs(View, { testID: 'token-header', style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: 'token-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'token-title', accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: symbol }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] }), assets || chains ? _jsx(BarMarkFigureContext.Provider, { value: animatedFigure, children: _jsxs(View, { testID: 'token-bars', style: { gap: 20, marginTop: 16, paddingHorizontal: 4 }, children: [assets ? _jsx(BarMark, { testID: 'token-assets', surface: false, title: name ?? symbol, elements: assets, description: headline }) : null, chains ? _jsx(BarMark, { testID: 'token-chains', surface: false, title: chainsTitle ?? t.swapChains, elements: chains, description: formatNumber(chains.filter(chain => held(chain.value)).length, locale) }) : null] }) }) : null, actions.length > 0 ? _jsx(View, { testID: 'token-actions', style: { gap: 8, marginTop: 16 }, children: actions.map(action => _jsx(Button, { testID: `token-action-${action.id}`, fullWidth: true, intent: action.intent ?? 'secondary', disabled: action.disabled, onPress: action.onSelect, children: tokenActionLabel(action, t) }, action.id)) }) : null, note != null && note !== false ? _jsx(View, { testID: 'token-note', style: [{ marginTop: actions.length > 0 ? 8 : 16 }, tone ? { paddingVertical: 12, paddingHorizontal: 16, borderRadius: 16, backgroundColor: withAlpha(tone, 0.1) } : { paddingHorizontal: 4 }], children: _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: tone ?? colors.muted }, children: note }) }) : null] });
28
+ }
@@ -0,0 +1,84 @@
1
+ import React from 'react';
2
+ import { View, type ScrollViewProps } from 'react-native';
3
+ import type { AssetArtwork } from './asset-balance-row.js';
4
+ export type { AssetArtwork } from './asset-balance-row.js';
5
+ /** The trading words of the block. HIG's built-in strings hold no trading terms, so the host supplies them, translated. */
6
+ export interface TradeHistoryDetailLabels {
7
+ title: string;
8
+ /** Names the figure for assistive technology: Net PnL. It is not drawn; the signed figure and the line under it carry the meaning on screen. */
9
+ netPnl: string;
10
+ /** Names of the two prices under the bar. Needed with `entry` and `exit`. */
11
+ entry?: string;
12
+ exit?: string;
13
+ /** `+2.84% on margin`: receives the formatted percent. */
14
+ onMargin: (percent: string) => string;
15
+ long: string;
16
+ short: string;
17
+ }
18
+ /** One label and value row. A number is formatted with `options` between `prefix` and `suffix` and updates place by place; a string is drawn as given. */
19
+ export interface TradeHistoryDetail {
20
+ label: string;
21
+ value: string | number;
22
+ options?: Intl.NumberFormatOptions;
23
+ prefix?: string;
24
+ suffix?: string;
25
+ /** With a number `value`: host-formatted text drawn and read in place of Intl's, still moving place by place. */
26
+ formattedValue?: string;
27
+ }
28
+ export interface TradeHistoryAction {
29
+ id: string;
30
+ label: string;
31
+ onSelect: () => void;
32
+ intent?: 'primary' | 'secondary';
33
+ disabled?: boolean;
34
+ busy?: boolean;
35
+ }
36
+ export interface TradeHistoryDetailBlockProps {
37
+ labels: TradeHistoryDetailLabels;
38
+ /** Asset name: Amazon. */
39
+ name: string;
40
+ icon?: AssetArtwork;
41
+ /** Short ticker for the fallback disc when there is no `icon`: BTC. Without it the disc shows the first letters of the name. */
42
+ symbol?: string;
43
+ side: 'long' | 'short';
44
+ /** 20 reads `20×`. */
45
+ leverage?: number;
46
+ /** A short muted qualifier after the leverage, read with it: current. */
47
+ leverageNote?: string;
48
+ /** Net profit and loss in dollars. `null` reads as unknown. */
49
+ pnl: number | null;
50
+ /** Format of the headline result. Defaults to signed US dollars with up to four decimals. The provider's `numberFormat` is merged under it. */
51
+ pnlOptions?: Intl.NumberFormatOptions;
52
+ /** Return on margin as a fraction: 0.0284 reads +2.84%. */
53
+ pnlPercent?: number | null;
54
+ /** Format of the return on margin. Defaults to a signed percent with two decimals. */
55
+ percentOptions?: Intl.NumberFormatOptions;
56
+ /** One muted sentence under the details, such as that part of the record is missing. */
57
+ note?: string;
58
+ /** Short host text in a badge beside the title: Demo. */
59
+ badge?: string;
60
+ /** Ref to a View around the summary (the asset line, the headline figure and the return), for a host that captures it as an image. Without it the summary has no wrapper. */
61
+ summaryRef?: React.Ref<View>;
62
+ /** Entry and exit prices. With both, one bar runs from entry to exit in the result colour, with the two prices under it, in place of two rows. */
63
+ entry?: number;
64
+ exit?: number;
65
+ /** Format of the two prices. Defaults to US dollars. */
66
+ priceOptions?: Intl.NumberFormatOptions;
67
+ details: readonly TradeHistoryDetail[];
68
+ actions?: readonly TradeHistoryAction[];
69
+ /** Shows Back on the leading edge of the header. */
70
+ onBack?: () => void;
71
+ /** A control on the trailing edge of the header, usually an IconButton. */
72
+ headerAction?: React.ReactNode;
73
+ /** Fills the View drawn with `summaryRef`, so an image captured from it is not transparent: `true` for the background role, or a colour such as the sheet's `useColors().overlay`. */
74
+ summaryBackground?: boolean | string;
75
+ /** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container. */
76
+ stickyHeader?: boolean;
77
+ /** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill. */
78
+ stickyHeaderBackground?: string;
79
+ /** The scroll view used with `stickyHeader`, such as a sheet library's own. */
80
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
81
+ testID?: string;
82
+ }
83
+ /** The full record of one closed trade, drawn on the screen without cards because none of it is pressable: the asset with its side and leverage on one line, the net profit and loss with its return on margin, a bar from the entry price to the exit price, the host's other figures as a compact grid, and the host's actions side by side. */
84
+ export declare function TradeHistoryDetailBlock({ labels, name, icon, symbol, side, leverage, leverageNote, pnl, pnlOptions, pnlPercent, percentOptions, entry, exit, priceOptions, details, note, badge, summaryRef, summaryBackground, actions, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: TradeHistoryDetailBlockProps): React.JSX.Element;
@@ -0,0 +1,46 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Image, View } from 'react-native';
3
+ import { useColors, useFills, useHIG, useNumberLocale } from './provider.js';
4
+ import { Text } from './surface.js';
5
+ import { BarPnl } from './bar-pnl.js';
6
+ import { Button } from './button.js';
7
+ import { ScreenHeader } from './screen-header.js';
8
+ import { StickyHeaderLayout } from './sticky-header.js';
9
+ import { AnimatedNumberReadout } from './animated-number.js';
10
+ import { formatNumberReadout } from './animated-number-model.js';
11
+ const pnlUsd = { style: 'currency', currency: 'USD', signDisplay: 'exceptZero', maximumFractionDigits: 4 };
12
+ const pnlShare = { style: 'percent', minimumFractionDigits: 2, maximumFractionDigits: 2, signDisplay: 'exceptZero' };
13
+ const gearing = { maximumFractionDigits: 6 };
14
+ const numberMark = '', unknown = '—', times = '×', up = '↑', down = '↓';
15
+ const avatar = 24, empty = '';
16
+ const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
17
+ const known = (value) => value != null && Number.isFinite(value);
18
+ /** A host sentence with one live number in it. The words keep their translated order, the number updates place by place, and the whole sentence is the accessible reading. Without a value the sentence is plain text. */
19
+ function Sentence({ template, text, value, options, tone, testID }) {
20
+ const colors = useColors(), { direction } = useHIG();
21
+ const type = { fontSize: 14, lineHeight: 21 }, words = { ...type, color: colors[tone] };
22
+ const reading = template(text), parts = template(numberMark).split(numberMark);
23
+ if (value === null || parts.length !== 2)
24
+ return _jsx(Text, { testID: testID, style: { ...words, textAlign: 'center' }, children: reading });
25
+ return _jsxs(View, { accessible: true, accessibilityLabel: reading, testID: testID, style: { direction, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', flexShrink: 1 }, children: [parts[0] ? _jsx(Text, { accessible: false, style: words, children: parts[0] }) : null, _jsx(AnimatedNumberReadout, { value: value, options: options, tone: tone, style: type }), parts[1] ? _jsx(Text, { accessible: false, style: words, children: parts[1] }) : null] });
26
+ }
27
+ /** The full record of one closed trade, drawn on the screen without cards because none of it is pressable: the asset with its side and leverage on one line, the net profit and loss with its return on margin, a bar from the entry price to the exit price, the host's other figures as a compact grid, and the host's actions side by side. */
28
+ export function TradeHistoryDetailBlock({ labels, name, icon, symbol, side, leverage, leverageNote, pnl, pnlOptions = pnlUsd, pnlPercent, percentOptions = pnlShare, entry, exit, priceOptions, details, note, badge, summaryRef, summaryBackground, actions = [], onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
29
+ const colors = useColors(), fills = useFills(), { direction } = useHIG(), locale = useNumberLocale();
30
+ const long = side === 'long', word = long ? labels.long : labels.short, tint = long ? colors.up : colors.down;
31
+ const tone = known(pnl) && pnl > 0 ? 'up' : known(pnl) && pnl < 0 ? 'down' : 'text';
32
+ const turns = known(leverage) ? formatNumberReadout(leverage, locale, gearing).text + times : null;
33
+ const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
34
+ const art = typeof icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: icon }, style: shape }) : _jsx(View, { style: shape, children: icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 9, lineHeight: 12, fontWeight: '600', color: colors.muted }, children: symbol ?? name.slice(0, 3) }) });
35
+ const meta = { fontSize: 14, lineHeight: 20 };
36
+ // The summary gets a wrapper only when the host asks for a ref to capture it, so the default tree is unchanged.
37
+ const fill = summaryBackground === true ? colors.background : typeof summaryBackground === 'string' && summaryBackground ? summaryBackground : undefined;
38
+ const wrap = (summary) => summaryRef ? _jsx(View, { ref: summaryRef, collapsable: false, testID: 'trade-summary', style: fill ? { backgroundColor: fill } : undefined, children: summary }) : summary;
39
+ // Three figures to a line: a small label over its value.
40
+ const rows = details.map(detail => _jsxs(View, { testID: `trade-detail-${detail.label}`, style: { width: '33.333%', paddingEnd: 8, gap: 2 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 12, lineHeight: 16, color: colors.muted }, children: detail.label }), typeof detail.value === 'number' ? _jsx(AnimatedNumberReadout, { value: detail.value, options: detail.options, prefix: detail.prefix, suffix: detail.suffix, formattedValue: detail.formattedValue, animateFormatted: !!detail.formattedValue, tone: 'text', style: { fontSize: 15, lineHeight: 22, fontWeight: '600' } }) : _jsx(Text, { style: { fontSize: 15, lineHeight: 22, fontWeight: '600', color: colors.text }, children: detail.value })] }, detail.label));
41
+ const header = _jsx(ScreenHeader, { testID: 'trade', title: labels.title, badge: badge, onBack: onBack, action: headerAction });
42
+ const body = _jsxs(_Fragment, { children: [wrap(_jsxs(_Fragment, { children: [_jsxs(View, { testID: 'trade-asset', accessible: true, accessibilityLabel: [name, word, turns, leverageNote].filter(Boolean).join(', '), style: { direction, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8, marginTop: 16 }, children: [_jsx(View, { ...hidden, children: art }), _jsx(Text, { ...hidden, numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: name }), _jsx(View, { ...hidden, children: _jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [_jsx(Text, { testID: 'trade-side-arrow', style: { ...meta, fontWeight: '600', color: tint }, children: long ? up : down }), _jsx(Text, { testID: 'trade-side', style: { ...meta, fontWeight: '600', color: tint, textTransform: 'uppercase' }, children: word }), turns ? _jsx(Text, { testID: 'trade-leverage', style: { ...meta, color: colors.muted }, children: turns }) : null, leverageNote ? _jsx(Text, { testID: 'trade-leverage-note', style: { ...meta, color: colors.muted }, children: leverageNote }) : null] }) })] }), _jsxs(View, { testID: 'trade-pnl', style: { alignItems: 'center', gap: 4, marginTop: 8 }, children: [_jsx(AnimatedNumberReadout, { testID: 'trade-pnl-value', label: labels.netPnl, value: pnl, options: pnlOptions, tone: tone, style: { fontSize: 40, lineHeight: 48, fontWeight: '700' } }), pnlPercent !== undefined ? _jsx(Sentence, { testID: 'trade-pnl-percent', template: labels.onMargin, text: known(pnlPercent) ? formatNumberReadout(pnlPercent, locale, percentOptions).text : unknown, value: known(pnlPercent) ? pnlPercent : null, options: percentOptions, tone: tone }) : null] })] })), known(entry) && known(exit) ? _jsx(View, { style: { marginTop: 20, paddingHorizontal: 4 }, children: _jsx(BarPnl, { testID: 'trade-bar', surface: false, fit: true, side: side, entry: entry, mark: exit, labels: { entry: labels.entry ?? empty, mark: labels.exit ?? empty, liquidation: empty }, priceOptions: priceOptions }) }) : null, details.length > 0 ? _jsx(View, { testID: 'trade-details', style: { direction, flexDirection: 'row', flexWrap: 'wrap', rowGap: 16, marginTop: 20, paddingHorizontal: 4 }, children: rows }) : null, note ? _jsx(Text, { testID: 'trade-note', style: { marginTop: 16, paddingHorizontal: 4, fontSize: 14, lineHeight: 21, color: colors.muted }, children: note }) : null, actions.length > 0 ? _jsx(View, { testID: 'trade-actions', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: actions.map(action => _jsx(View, { style: { flex: 1, minWidth: 0 }, children: _jsx(Button, { fullWidth: true, testID: `trade-action-${action.id}`, intent: action.intent ?? 'secondary', disabled: action.disabled, busy: action.busy, onPress: action.onSelect, children: action.label }) }, action.id)) }) : null] });
43
+ if (stickyHeader)
44
+ return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'trade-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
45
+ return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
46
+ }
@@ -0,0 +1,110 @@
1
+ import React from 'react';
2
+ import { type NativeScrollEvent, type NativeSyntheticEvent, type ScrollViewProps, type ViewStyle } from 'react-native';
3
+ import type { AssetArtwork } from './asset-balance-row.js';
4
+ /** The words of the block. They are trading terms, so the host supplies them; HIG ships none. */
5
+ export interface TradeHistoryListLabels {
6
+ /** Heading of the screen: History. */
7
+ title: string;
8
+ long: string;
9
+ short: string;
10
+ /** Shown in place of the rows when there are no trades. */
11
+ empty: string;
12
+ /** A second line under `empty`, in the muted colour: Closed trades appear here. */
13
+ emptyDescription?: string;
14
+ }
15
+ /** One closed trade. */
16
+ export interface TradeHistoryItem {
17
+ id: string;
18
+ /** Asset name: Amazon. */
19
+ name: string;
20
+ /** Short ticker for the fallback disc when there is no `icon`: BTC. Without it the disc shows the first letters of the name. */
21
+ symbol?: string;
22
+ /** Round artwork: an image URL or a host element. Without it the row shows `symbol` or the first letters of the name. */
23
+ icon?: AssetArtwork;
24
+ side: 'long' | 'short';
25
+ /** 20 reads `20×`. */
26
+ leverage?: number;
27
+ /** A short muted qualifier after the leverage, read with it: current. Use it when the leverage was not recorded with the trade. */
28
+ leverageNote?: string;
29
+ /** Net profit and loss in dollars. `null` reads as unknown. */
30
+ pnl: number | null;
31
+ /** Host-formatted age or time of the close, shown under the result: `2d`. */
32
+ time?: string;
33
+ /** Small muted host text before the age, such as the wallet the trade came from: `0x22…22`. */
34
+ tag?: string;
35
+ /** Format of this trade's result, in place of the block's `pnlOptions`, for a host whose decimal ladder depends on the amount. */
36
+ pnlOptions?: Intl.NumberFormatOptions;
37
+ }
38
+ /**
39
+ * What `renderList` receives, shaped for FlatList so `{...list}` spreads onto it: the trades and helpers that draw them exactly
40
+ * as the block does. With `listChrome` it also carries everything around them, so the list holds the whole screen and a sheet
41
+ * that sizes itself to its content measures the list alone.
42
+ */
43
+ export interface TradeHistoryListRender {
44
+ trades: readonly TradeHistoryItem[];
45
+ /** Draws one row; the signature matches FlatList's `renderItem`. */
46
+ renderItem: (info: {
47
+ item: TradeHistoryItem;
48
+ }) => React.ReactElement;
49
+ keyExtractor: (trade: TradeHistoryItem) => string;
50
+ /** The 8dp gap between rows, for `ItemSeparatorComponent`. */
51
+ ItemSeparatorComponent: React.ComponentType;
52
+ /** With `listChrome`: the header (unless it is pinned with `stickyHeader`) and the `notice`, 16dp above the first row. `null` when there is neither. */
53
+ ListHeaderComponent?: React.ReactElement | null;
54
+ /** With `listChrome`: the `footer`, 16dp under the last row. `null` without one. */
55
+ ListFooterComponent?: React.ReactElement | null;
56
+ /** With `listChrome`: the block's 16dp inset around the rows, header and footer. */
57
+ contentContainerStyle?: ViewStyle;
58
+ /** With `stickyHeader`: reports the list's offset so the pinned header fills once rows scroll under it. */
59
+ onScroll?: (event: NativeSyntheticEvent<NativeScrollEvent>) => void;
60
+ scrollEventThrottle?: number;
61
+ }
62
+ export interface TradeHistoryListBlockProps {
63
+ labels: TradeHistoryListLabels;
64
+ /** Closed trades, in the order shown. The host sorts and pages them. */
65
+ trades: readonly TradeHistoryItem[];
66
+ /** Makes each row a button that reports its trade, usually to open its detail, and shows the disclosure chevron. */
67
+ onSelect?: (trade: TradeHistoryItem) => void;
68
+ /** Shows Back on the leading edge of the header. */
69
+ onBack?: () => void;
70
+ /** A control on the trailing edge of the header, usually an IconButton. */
71
+ headerAction?: React.ReactNode;
72
+ /** Format of the result. Defaults to signed US dollars at four significant digits: `+$1.412`, `+$17.90`, `-$0.6878`. The provider's `numberFormat` is merged under it. */
73
+ pnlOptions?: Intl.NumberFormatOptions;
74
+ /** Draws rows of skeletons in place of the trades while the host loads them. */
75
+ loading?: boolean;
76
+ /** Host text that names the skeleton rows for assistive technology: Loading history. Without it they are only marked busy. */
77
+ loadingLabel?: string;
78
+ /** Why the trades could not load, in place of the rows, in the negative colour and announced. */
79
+ error?: string;
80
+ /** Host content under the header, above the rows: a partial-history notice or a mode banner. */
81
+ notice?: React.ReactNode;
82
+ /** Host content under the rows: paging, a spinner for the next page, a note. */
83
+ footer?: React.ReactNode;
84
+ /**
85
+ * Draws the rows through the host's own list, so a long history does not mount every row at once:
86
+ * `renderList={list => <FlatList data={list.trades} {...list} initialNumToRender={10}/>}`. The header, notice and footer stay
87
+ * fixed around the list in the block's inset, and the block fills its parent (`flex: 1`), so place it in a bounded container
88
+ * such as a sheet body, not inside a ScrollView.
89
+ */
90
+ renderList?: (list: TradeHistoryListRender) => React.ReactNode;
91
+ /**
92
+ * With `renderList`: hands the list the header, notice, footer and inset as well (`ListHeaderComponent`, `ListFooterComponent`,
93
+ * `contentContainerStyle`), so they scroll with the rows, a spread FlatList holds the whole screen and a sheet that sizes itself
94
+ * to its content measures the list alone. The block then adds no padding of its own. Spread the whole object.
95
+ */
96
+ listChrome?: boolean;
97
+ /** Keeps the header pinned while the rows scroll, transparent at rest and filled once rows scroll under it. Without `renderList` the block becomes its own scroll view; with it the header stays above the host's list, which reports its offset through `onScroll`. Place it in a bounded container. */
98
+ stickyHeader?: boolean;
99
+ /** Fill behind the pinned header once rows scroll under it. Defaults to the background role; in a sheet pass the sheet's fill. */
100
+ stickyHeaderBackground?: string;
101
+ /** The scroll view used with `stickyHeader` without `renderList`, such as a sheet library's own. */
102
+ scrollComponent?: React.ComponentType<ScrollViewProps>;
103
+ testID?: string;
104
+ }
105
+ /** How a row reads its side: `Short 20×`, or `Short` without leverage. */
106
+ export declare const tradeHistorySide: (trade: Pick<TradeHistoryItem, 'side' | 'leverage'> & {
107
+ leverageNote?: string;
108
+ }, labels: Pick<TradeHistoryListLabels, 'long' | 'short'>, locale?: string) => string;
109
+ /** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the market direction colour, and the net result in the market direction colour over its age. */
110
+ export declare function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions, loading, loadingLabel, error, notice, footer, renderList, listChrome, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: TradeHistoryListBlockProps): React.JSX.Element;
@@ -0,0 +1,64 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Image, Pressable, View } from 'react-native';
3
+ import { formatNumber } from '@bloxwap/hig/contracts';
4
+ import { useColors, useFills, useHIG, useNumberLocale, usePresentNumber } from './provider.js';
5
+ import { Text } from './surface.js';
6
+ import { ChevronIcon } from './icons.js';
7
+ import { ScreenHeader } from './screen-header.js';
8
+ import { StickyHeaderLayout, stickyHeaderFill, useStickyHeaderScroll } from './sticky-header.js';
9
+ import { AnimatedNumberReadout } from './animated-number.js';
10
+ const pnlFormat = { style: 'currency', currency: 'USD', signDisplay: 'exceptZero', minimumSignificantDigits: 4, maximumSignificantDigits: 4 };
11
+ /** How a row reads its side: `Short 20×`, or `Short` without leverage. */
12
+ export const tradeHistorySide = (trade, labels, locale) => `${trade.side === 'long' ? labels.long : labels.short}${trade.leverage != null ? ` ${formatNumber(trade.leverage, locale)}×` : ''}${trade.leverageNote ? ` ${trade.leverageNote}` : ''}`;
13
+ const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
14
+ const avatar = 40, skeletons = [0, 1, 2, 3], dot = '·';
15
+ const keyOf = (trade) => trade.id;
16
+ function Gap() { return _jsx(View, { style: { height: 8 } }); }
17
+ /** Points up; a short turns it over. */
18
+ function Arrow({ color, down }) { return _jsxs(View, { style: { width: 12, height: 14, alignItems: 'center', transform: down ? [{ rotate: '180deg' }] : undefined }, children: [_jsx(View, { style: { position: 'absolute', top: 1, width: 7, height: 7, borderLeftWidth: 1.75, borderTopWidth: 1.75, borderColor: color, transform: [{ rotate: '45deg' }] } }), _jsx(View, { style: { width: 1.75, height: 14, borderRadius: 1, backgroundColor: color } })] }); }
19
+ /** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the market direction colour, and the net result in the market direction colour over its age. */
20
+ export function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions = pnlFormat, loading, loadingLabel, error, notice, footer, renderList, listChrome, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
21
+ const colors = useColors(), fills = useFills(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
22
+ const listScroll = useStickyHeaderScroll();
23
+ const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
24
+ const row = (pressed) => ({ flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 56, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 28, backgroundColor: pressed ? fills.raised : fills.well });
25
+ const meta = { fontSize: 14, lineHeight: 20, color: colors.muted };
26
+ const draw = (trade) => {
27
+ const side = trade.side === 'long' ? colors.up : colors.down, result = trade.pnlOptions ?? pnlOptions;
28
+ const reading = [trade.name, tradeHistorySide(trade, labels, locale), formatNumber(trade.pnl, locale, present(result)), trade.tag, trade.time].filter(Boolean).join(', ');
29
+ const content = _jsxs(_Fragment, { children: [_jsx(View, { ...hidden, children: typeof trade.icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: trade.icon }, style: shape }) : _jsx(View, { style: shape, children: trade.icon ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: trade.symbol ?? trade.name.slice(0, 3) }) }) }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: trade.name }), _jsxs(View, { testID: testID ? `${testID}-${trade.id}-side` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [_jsx(Arrow, { color: side, down: trade.side === 'short' }), trade.leverage != null ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, fontWeight: '600', color: side }, children: `${formatNumber(trade.leverage, locale)}×` }) : null, trade.leverageNote ? _jsx(Text, { testID: testID ? `${testID}-${trade.id}-leverage-note` : undefined, numberOfLines: 1, style: { ...meta, flexShrink: 1 }, children: trade.leverageNote }) : null] })] }), _jsxs(View, { ...hidden, style: trade.tag ? { alignItems: 'flex-end', justifyContent: 'center', flexShrink: 1 } : { alignItems: 'flex-end', justifyContent: 'center' }, children: [_jsx(AnimatedNumberReadout, { value: trade.pnl, options: result, tone: trade.pnl == null || trade.pnl === 0 ? 'text' : trade.pnl > 0 ? 'up' : 'down', testID: testID ? `${testID}-${trade.id}-pnl` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }), trade.tag ? _jsxs(View, { testID: testID ? `${testID}-${trade.id}-meta` : undefined, style: { direction, flexDirection: 'row', alignItems: 'center', gap: 4, flexShrink: 1 }, children: [_jsx(Text, { numberOfLines: 1, style: { ...meta, flexShrink: 1 }, children: trade.tag }), trade.time ? _jsxs(_Fragment, { children: [_jsx(Text, { style: meta, children: dot }), _jsx(Text, { style: meta, children: trade.time })] }) : null] })
30
+ : trade.time ? _jsx(Text, { style: meta, children: trade.time }) : null] })] });
31
+ return onSelect ? _jsxs(Pressable, { testID: testID ? `${testID}-${trade.id}` : undefined, accessibilityRole: 'button', accessibilityLabel: reading, onPress: () => onSelect(trade), style: ({ pressed }) => row(pressed), children: [content, _jsx(View, { ...hidden, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }, trade.id)
32
+ : _jsx(View, { testID: testID ? `${testID}-${trade.id}` : undefined, accessible: true, accessibilityLabel: reading, style: row(false), children: content }, trade.id);
33
+ };
34
+ const plain = { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20 };
35
+ const body = loading ? _jsx(View, { testID: testID ? `${testID}-loading` : undefined, accessible: !!loadingLabel, accessibilityLabel: loadingLabel, accessibilityState: { busy: true }, style: { gap: 8 }, children: skeletons.map(index => _jsx(View, { style: { minHeight: 56, borderRadius: 28, backgroundColor: fills.raised } }, index)) })
36
+ : error ? _jsx(Text, { testID: testID ? `${testID}-error` : undefined, accessibilityRole: 'alert', accessibilityLiveRegion: 'polite', style: { ...plain, color: colors.negative }, children: error })
37
+ : trades.length === 0 ? (labels.emptyDescription ? _jsxs(View, { testID: testID ? `${testID}-empty` : undefined, accessible: true, accessibilityLabel: `${labels.empty}, ${labels.emptyDescription}`, style: { paddingVertical: 32, gap: 4 }, children: [_jsx(Text, { style: { ...plain, paddingVertical: 0, fontWeight: '600', color: colors.text }, children: labels.empty }), _jsx(Text, { style: { ...plain, paddingVertical: 0, color: colors.muted }, children: labels.emptyDescription })] }) : _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, style: { ...plain, color: colors.muted }, children: labels.empty }))
38
+ : null;
39
+ const header = _jsx(ScreenHeader, { testID: testID, title: labels.title, onBack: onBack, action: headerAction });
40
+ const noticeView = notice != null && notice !== false ? _jsx(View, { testID: testID ? `${testID}-notice` : undefined, style: { gap: 8 }, children: notice }) : null;
41
+ const footerView = footer != null && footer !== false ? _jsx(View, { testID: testID ? `${testID}-footer` : undefined, style: { gap: 8 }, children: footer }) : null;
42
+ let hosted = null;
43
+ if (!body && renderList) {
44
+ const scroll = stickyHeader ? { onScroll: listScroll.onScroll, scrollEventThrottle: listScroll.scrollEventThrottle } : null;
45
+ const base = { trades, renderItem: ({ item }) => draw(item), keyExtractor: keyOf, ItemSeparatorComponent: Gap, ...scroll };
46
+ // listChrome: the list holds the whole screen, with header and notice above the rows, the footer under them, and the block's inset around both.
47
+ const top = stickyHeader ? noticeView : _jsxs(_Fragment, { children: [header, noticeView] });
48
+ const list = renderList(listChrome ? { ...base,
49
+ ListHeaderComponent: stickyHeader && !noticeView ? null : _jsx(View, { style: { direction, gap: 16, paddingBottom: 16 }, children: top }),
50
+ ListFooterComponent: footerView ? _jsx(View, { style: { direction, paddingTop: 16 }, children: footerView }) : null,
51
+ contentContainerStyle: { padding: 16 } } : base);
52
+ hosted = _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { flex: 1 }, children: list });
53
+ const pinned = stickyHeader ? _jsx(View, { testID: testID ? `${testID}-sticky-header` : undefined, style: [{ paddingHorizontal: 16, paddingTop: 16 }, stickyHeaderFill(listScroll.scrolled, stickyHeaderBackground ?? colors.background)], children: header }) : null;
54
+ if (listChrome)
55
+ return _jsxs(View, { testID: testID, style: { direction, flex: 1 }, children: [pinned, hosted] });
56
+ // Pinned without listChrome: the header fills over the block's own stack, which keeps the notice, the list and the footer as before.
57
+ if (stickyHeader)
58
+ return _jsxs(View, { testID: testID, style: { direction, flex: 1 }, children: [pinned, _jsxs(View, { style: { padding: 16, gap: 16, flex: 1 }, children: [noticeView, hosted, footerView] })] });
59
+ }
60
+ const rows = body ?? hosted ?? _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { gap: 8 }, children: trades.map(draw) });
61
+ if (stickyHeader)
62
+ return _jsxs(StickyHeaderLayout, { testID: testID, headerTestID: testID ? `${testID}-sticky-header` : undefined, header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, bodyStyle: { direction, gap: 16, paddingTop: 16 }, children: [noticeView, rows, footerView] });
63
+ return _jsxs(View, { testID: testID, style: renderList ? { direction, padding: 16, gap: 16, flex: 1 } : { direction, padding: 16, gap: 16 }, children: [header, noticeView, rows, footerView] });
64
+ }