@bloxwap/hig 0.8.1 → 0.9.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 (102) hide show
  1. package/README.md +1 -0
  2. package/chart/README.md +3 -4
  3. package/chart/dist/altimeter-burst.d.ts +2 -2
  4. package/chart/dist/altimeter-burst.js +8 -7
  5. package/chart/dist/altimeter-chart.d.ts +13 -3
  6. package/chart/dist/altimeter-chart.js +37 -12
  7. package/chart/dist/altimeter-core.d.ts +21 -0
  8. package/chart/dist/altimeter-core.js +13 -0
  9. package/chart/dist/altimeter-targets.d.ts +3 -2
  10. package/chart/dist/altimeter-targets.js +7 -7
  11. package/chart/dist/index.d.ts +2 -2
  12. package/chart/dist/outcome-chart.d.ts +4 -2
  13. package/chart/dist/outcome-chart.js +9 -6
  14. package/chart/dist/outcome-model.d.ts +14 -1
  15. package/chart/dist/outcome-model.js +12 -4
  16. package/contracts/README.md +1 -1
  17. package/contracts/dist/login.d.ts +34 -0
  18. package/contracts/dist/login.js +43 -0
  19. package/contracts/dist/messages.d.ts +1 -1
  20. package/feedback/README.md +1 -1
  21. package/native/README.md +1 -1
  22. package/native/dist/address-readout.d.ts +9 -0
  23. package/native/dist/address-readout.js +22 -0
  24. package/native/dist/animated-number.js +3 -1
  25. package/native/dist/blocks.d.ts +5 -2
  26. package/native/dist/blocks.js +5 -2
  27. package/native/dist/chart.d.ts +20 -0
  28. package/native/dist/chart.js +161 -0
  29. package/native/dist/claim-reward-block.d.ts +22 -0
  30. package/native/dist/claim-reward-block.js +16 -0
  31. package/native/dist/confirm-block.d.ts +1 -5
  32. package/native/dist/confirm-block.js +5 -16
  33. package/native/dist/data.d.ts +1 -1
  34. package/native/dist/data.js +3 -1
  35. package/native/dist/deposit-block.d.ts +19 -0
  36. package/native/dist/deposit-block.js +20 -0
  37. package/native/dist/gesture-sheet.js +1 -1
  38. package/native/dist/language-block.js +1 -1
  39. package/native/dist/login-block.d.ts +4 -0
  40. package/native/dist/login-block.js +22 -0
  41. package/native/dist/manage-position-block.d.ts +7 -0
  42. package/native/dist/manage-position-block.js +29 -28
  43. package/native/dist/modal-radius.d.ts +2 -0
  44. package/native/dist/modal-radius.js +2 -0
  45. package/native/dist/overlay.d.ts +6 -2
  46. package/native/dist/overlay.js +7 -5
  47. package/native/dist/positions-block.d.ts +28 -0
  48. package/native/dist/positions-block.js +15 -0
  49. package/native/dist/screen-header.d.ts +3 -1
  50. package/native/dist/screen-header.js +2 -2
  51. package/native/dist/status.js +3 -2
  52. package/native/dist/{swap-panel-block.d.ts → swap-block.d.ts} +10 -6
  53. package/native/dist/{swap-panel-block.js → swap-block.js} +5 -3
  54. package/native/dist/swap-sheet.d.ts +3 -3
  55. package/native/dist/swap-sheet.js +3 -3
  56. package/native/dist/token-action-block.d.ts +1 -1
  57. package/native/dist/token-action-block.js +2 -1
  58. package/native-fonts/README.md +1 -1
  59. package/og-fonts/README.md +1 -1
  60. package/package.json +76 -21
  61. package/react/README.md +1 -1
  62. package/react/dist/blocks/address-readout.d.ts +9 -0
  63. package/react/dist/blocks/address-readout.js +16 -0
  64. package/react/dist/blocks/claim-reward-block.d.ts +22 -0
  65. package/react/dist/blocks/claim-reward-block.js +10 -0
  66. package/react/dist/blocks/confirm-block.d.ts +1 -5
  67. package/react/dist/blocks/confirm-block.js +3 -13
  68. package/react/dist/blocks/deposit-block.d.ts +19 -0
  69. package/react/dist/blocks/deposit-block.js +18 -0
  70. package/react/dist/blocks/login-block.d.ts +16 -0
  71. package/react/dist/blocks/login-block.js +29 -0
  72. package/react/dist/blocks/manage-position-block.d.ts +7 -0
  73. package/react/dist/blocks/manage-position-block.js +9 -4
  74. package/react/dist/blocks/positions-block.d.ts +28 -0
  75. package/react/dist/blocks/positions-block.js +14 -0
  76. package/react/dist/blocks/{swap-panel-block.d.ts → swap-block.d.ts} +10 -6
  77. package/react/dist/blocks/{swap-panel-block.js → swap-block.js} +5 -3
  78. package/react/dist/blocks/swap-sheet.d.ts +3 -3
  79. package/react/dist/blocks/swap-sheet.js +3 -3
  80. package/react/dist/blocks/token-action-block.d.ts +1 -1
  81. package/react/dist/blocks/token-action-block.js +2 -1
  82. package/react/dist/blocks.d.ts +5 -2
  83. package/react/dist/blocks.js +5 -2
  84. package/react/dist/gesture-sheet.js +6 -2
  85. package/react/dist/overlay.d.ts +1 -29
  86. package/react/dist/overlay.js +3 -31
  87. package/react/dist/popover.d.ts +30 -0
  88. package/react/dist/popover.js +34 -0
  89. package/react/dist/styles.css +186 -33
  90. package/tokens/README.md +1 -1
  91. package/tokens/assets/onramps/apple-pay.svg +33 -0
  92. package/tokens/assets/onramps/bank.svg +98 -0
  93. package/tokens/assets/onramps/blink.svg +37 -0
  94. package/tokens/assets/onramps/cashapp.svg +33 -0
  95. package/tokens/assets/onramps/crypto.svg +121 -0
  96. package/tokens/assets/onramps/exchange.svg +105 -0
  97. package/tokens/dist/deposit-icons.d.ts +1 -0
  98. package/tokens/dist/deposit-icons.js +28 -0
  99. package/native/dist/explainer-block.d.ts +0 -91
  100. package/native/dist/explainer-block.js +0 -34
  101. package/react/dist/blocks/explainer-block.d.ts +0 -80
  102. package/react/dist/blocks/explainer-block.js +0 -20
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ /** The address as the two rows the block draws: split at the middle, with `anchor` on the characters people compare, the first 4 (6 when it starts with `0x`) and the last 4. An address too short to have a middle is all anchor. */
3
+ export declare function confirmAddressRows(address: string): {
4
+ text: string;
5
+ anchor: boolean;
6
+ }[][];
7
+ export declare function AddressReadout({ address }: {
8
+ address: string;
9
+ }): React.JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { Platform } from 'react-native';
4
+ import { useColors, useHIG } from './provider.js';
5
+ import { Text } from './surface.js';
6
+ /** The address as the two rows the block draws: split at the middle, with `anchor` on the characters people compare, the first 4 (6 when it starts with `0x`) and the last 4. An address too short to have a middle is all anchor. */
7
+ export function confirmAddressRows(address) {
8
+ const characters = Array.from(address), head = address.startsWith('0x') ? 6 : 4, tail = characters.length - 4, split = Math.ceil(characters.length / 2);
9
+ return [characters.slice(0, split), characters.slice(split)].map((row, rowIndex) => {
10
+ const parts = [];
11
+ row.forEach((character, index) => { const position = rowIndex * split + index, anchor = position < head || position >= tail, last = parts[parts.length - 1]; if (last && last.anchor === anchor)
12
+ last.text += character;
13
+ else
14
+ parts.push({ text: character, anchor }); });
15
+ return parts;
16
+ });
17
+ }
18
+ export function AddressReadout({ address }) {
19
+ const colors = useColors(), { monoFontFamily } = useHIG();
20
+ const type = { fontFamily: monoFontFamily ?? Platform.select({ ios: 'Menlo', default: 'monospace' }), fontSize: 15, lineHeight: 22 };
21
+ return _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1.2, style: { ...type, writingDirection: 'ltr', textAlign: 'left' }, children: confirmAddressRows(address).map((row, index) => _jsxs(React.Fragment, { children: [index > 0 ? '\n' : null, row.map((part, offset) => _jsx(Text, { maxFontSizeMultiplier: 1.2, style: { ...type, color: part.anchor ? colors.text : colors.muted, fontWeight: part.anchor ? '700' : '500' }, children: part.text }, offset))] }, index)) });
22
+ }
@@ -10,7 +10,7 @@ import { tokens } from '@bloxwap/hig/tokens';
10
10
  import { createNumberFlowRoll, createNumberReelModel, formatNumberReadout, numberFlowReelOffset, numberReelPlace, numberReelPlaces, numberTrendDirection, safeNumberLayout, sampleReelEasing } from './animated-number-model.js';
11
11
  import { useColors, useHIG, useNumberLocale } from './provider.js';
12
12
  import { detectScript, Text } from './surface.js';
13
- const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign']);
13
+ const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign', 'textDecorationLine', 'textDecorationColor', 'textDecorationStyle']);
14
14
  // Android Fabric reads colour 0 as "unset", so 'transparent' (0x00000000) drew the hidden reading in the default
15
15
  // black under the reels. Clear white is non-zero there and still invisible.
16
16
  const hiddenColor = '#ffffff00';
@@ -181,6 +181,8 @@ export function AnimatedNumberReadout({ value, options: requested, formattedValu
181
181
  const previousValue = useRef(value), directionTrend = numberTrendDirection(trend, previousValue.current, value);
182
182
  useEffect(() => { previousValue.current = value; }, [value]);
183
183
  const typography = Object.fromEntries(Object.entries(StyleSheet.flatten(style) ?? {}).filter(([key]) => numberTypographyKeys.has(key)));
184
+ if (typography.fontSize !== undefined && typography.lineHeight === undefined)
185
+ typography.lineHeight = undefined;
184
186
  const color = colors[tone === 'positive' || tone === 'negative' || tone === 'warning' || tone === 'muted' || tone === 'faint' || tone === 'up' || tone === 'down' ? tone : 'text'];
185
187
  const textStyle = [typography, { color, fontVariant: ['tabular-nums'] }];
186
188
  const script = detectScript(`${reading.text}${staleSuffix}`, locale);
@@ -21,6 +21,8 @@ export declare function MarketingHero({ title, description, href, cta }: {
21
21
  cta: string;
22
22
  }): React.JSX.Element;
23
23
  export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow, type AccountBlockProps, type AccountAsset, type AccountSection, type AccountOrder, type AccountRowsOptions, type AssetArtwork, type AssetBalanceRowProps } from './account-block.js';
24
+ export { LoginBlock, type LoginBlockProps, type LoginProvider } from './login-block.js';
25
+ export { DepositBlock, type DepositBlockProps, type DepositMethod } from './deposit-block.js';
24
26
  export { LanguageBlock, filterLanguages, type LanguageBlockProps, type LanguageOption } from './language-block.js';
25
27
  export { TokenActionBlock, tokenActionLabel, type TokenActionBlockProps, type TokenAction, type TokenActionId } from './token-action-block.js';
26
28
  export { ManagePositionBlock, positionCorridor, type ManagePositionBlockProps, type ManagePositionBlockLabels, type ManagePositionBlockAction, type ManagePositionBlockSummary, type ManagePositionBlockFigure, type ManagePositionIcon } from './manage-position-block.js';
@@ -37,7 +39,8 @@ export { NotificationsBlock, type NotificationsBlockProps, type NotificationsIte
37
39
  export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps, type PickerInputProps, type PickerRowProps, SwapHostContext } from './pickers.js';
38
40
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
39
41
  export { SwapAmountCard, SwapPill, type SwapAmountCardProps, type SwapPillProps } from './swap-amount-card.js';
40
- export { SwapPanelBlock, SwapPanel, swapAction, type SwapPanelBlockProps, type SwapPanelProps, type SwapToken, type SwapArtwork, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapFigure, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-panel-block.js';
42
+ export { SwapBlock, SwapPanelBlock, SwapPanel, swapAction, type SwapBlockProps, type SwapPanelBlockProps, type SwapPanelProps, type SwapToken, type SwapArtwork, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapFigure, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-block.js';
41
43
  export { ConfirmBlock, type ConfirmBlockProps, type ConfirmDetail, type ConfirmTertiaryAction } from './confirm-block.js';
42
44
  export { PresetPickerBlock, type PresetPickerBlockProps, type PresetPickerCustom, type PresetPickerAdjustable } from './preset-picker-block.js';
43
- export { ExplainerBlock, type ExplainerBlockProps, type ExplainerSection, type ExplainerAction, type ExplainerTone } from './explainer-block.js';
45
+ export { PositionsBlock, type PositionsBlockProps, type OpenPosition } from './positions-block.js';
46
+ export { ClaimRewardBlock, type ClaimRewardBlockProps } from './claim-reward-block.js';
@@ -25,6 +25,8 @@ export function InstallCommand({ command, onCopy }) {
25
25
  }
26
26
  export function MarketingHero({ title, description, href, cta }) { return _jsxs(Stack, { children: [_jsx(Heading, { children: title }), _jsx(Text, { children: description }), _jsx(Link, { href: href, children: cta })] }); }
27
27
  export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow } from './account-block.js';
28
+ export { LoginBlock } from './login-block.js';
29
+ export { DepositBlock } from './deposit-block.js';
28
30
  export { LanguageBlock, filterLanguages } from './language-block.js';
29
31
  export { TokenActionBlock, tokenActionLabel } from './token-action-block.js';
30
32
  export { ManagePositionBlock, positionCorridor } from './manage-position-block.js';
@@ -41,7 +43,8 @@ export { NotificationsBlock } from './notifications-block.js';
41
43
  export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, SwapHostContext } from './pickers.js';
42
44
  export { SwapKeypad, SwapCapsule } from './swap-parts.js';
43
45
  export { SwapAmountCard, SwapPill } from './swap-amount-card.js';
44
- export { SwapPanelBlock, SwapPanel, swapAction } from './swap-panel-block.js';
46
+ export { SwapBlock, SwapPanelBlock, SwapPanel, swapAction } from './swap-block.js';
45
47
  export { ConfirmBlock } from './confirm-block.js';
46
48
  export { PresetPickerBlock } from './preset-picker-block.js';
47
- export { ExplainerBlock } from './explainer-block.js';
49
+ export { PositionsBlock } from './positions-block.js';
50
+ export { ClaimRewardBlock } from './claim-reward-block.js';
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { type ViewProps } from 'react-native';
3
+ import { bitcoinPrice, type AltimeterFeed, type AltimeterPosition, type AltimeterTarget, type TargetLabelInsets } from '@bloxwap/hig/chart/altimeter-core';
4
+ export { bitcoinPrice, type AltimeterFeed, type AltimeterPosition, type AltimeterTarget, type TargetLabelInsets };
5
+ export interface AltimeterChartProps extends Omit<ViewProps, 'children'> {
6
+ summary: string;
7
+ price?: number | null;
8
+ feed?: AltimeterFeed;
9
+ height?: number;
10
+ priceOptions?: Intl.NumberFormatOptions;
11
+ position?: AltimeterPosition;
12
+ targets?: readonly AltimeterTarget[];
13
+ /** Top and bottom clearance for target text only. Defaults to 8 per edge. */
14
+ targetLabelInsets?: TargetLabelInsets;
15
+ degen?: boolean;
16
+ /** @deprecated Use degen. */
17
+ dgen?: boolean;
18
+ }
19
+ /** Native SVG price ladder, scrolling trail and position readout. Stops drawing and unsubscribes in the background. */
20
+ export declare function AltimeterChart({ summary, price, feed, height, priceOptions, position, targets, targetLabelInsets, dgen, degen, ...view }: AltimeterChartProps): React.JSX.Element;
@@ -0,0 +1,161 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useEffect, useId, useMemo, useRef, useState } from 'react';
3
+ import { AppState, View } from 'react-native';
4
+ import Svg, { Circle, Defs, G, Line, LinearGradient, Path, Rect, Stop, Text as SvgText } from 'react-native-svg';
5
+ import { tokens } from '@bloxwap/hig/tokens';
6
+ import { ALTIMETER_BURST_COOLDOWN_MS, ALTIMETER_FLOW_PX, ALTIMETER_SAMPLE_MS, ALTIMETER_TICK_PX, bitcoinPrice, gridPhase, labelDecimalsFor, ladderPrices, priceTween, smoothTrail, sparkGeometry, targetCrossings, targetLayout, tickSpacingFor, trailPoints, validTargets } from '@bloxwap/hig/chart/altimeter-core';
7
+ import { useColors, useHIG, useMessages, useNumberLocale } from './provider.js';
8
+ import { Text } from './surface.js';
9
+ export { bitcoinPrice };
10
+ const noTargets = [];
11
+ const validPrice = (p) => p != null && Number.isFinite(p) && p > 0;
12
+ const emptyFrame = { now: 0, display: NaN, mark: null, spacing: 1, anchor: 0, ticks: [], levels: new Map() };
13
+ function BurstEffect({ burst, now, x, y, width }) {
14
+ const progress = Math.min(1, (now - burst.start) / (tokens.motion.base * 2));
15
+ const travel = 1 - (1 - progress) ** 3;
16
+ const color = burst.color;
17
+ return _jsxs(G, { opacity: Math.min(1, (1 - progress) * 3), children: [progress < .5 && _jsx(Rect, { x: x - width / 2 - 10 * travel, y: y - 18 - 8 * travel, width: width + 20 * travel, height: 36 + 16 * travel, rx: 24, fill: "none", stroke: color, strokeWidth: 2, opacity: 1 - progress * 2 }), Array.from({ length: 24 }, (_, i) => {
18
+ const { dx, dy, distance, size } = sparkGeometry(i, burst.direction);
19
+ const cx = x + dx * (width / 2 - 3 + distance * travel), cy = y + dy * (15 + distance * travel);
20
+ return _jsxs(G, { children: [_jsx(Circle, { cx: cx, cy: cy, r: size, fill: color, opacity: .25 }), _jsx(Circle, { cx: cx, cy: cy, r: size / 2, fill: color })] }, i);
21
+ })] });
22
+ }
23
+ /** Native SVG price ladder, scrolling trail and position readout. Stops drawing and unsubscribes in the background. */
24
+ export function AltimeterChart({ summary, price, feed = bitcoinPrice, height = 320, priceOptions, position, targets = noTargets, targetLabelInsets, dgen, degen = dgen ?? false, ...view }) {
25
+ const colors = useColors(), { reducedMotion, monoFontFamily } = useHIG(), messages = useMessages(), locale = useNumberLocale();
26
+ const [width, setWidth] = useState(0), [frame, setFrame] = useState(emptyFrame), [stale, setStale] = useState(false);
27
+ const [active, setActive] = useState(AppState.currentState == null || AppState.currentState === 'active');
28
+ useEffect(() => { const sub = AppState.addEventListener('change', state => setActive(state === 'active')); return () => sub.remove(); }, []);
29
+ const levels = useMemo(() => validTargets(targets), [targets]);
30
+ const controlled = price !== undefined, latest = useRef(null);
31
+ const settings = useRef({ width, height, reducedMotion, degen, levels, targetLabelInsets });
32
+ useEffect(() => { settings.current = { width, height, reducedMotion, degen, levels, targetLabelInsets }; if (controlled)
33
+ latest.current = validPrice(price) ? price : null; }, [width, height, reducedMotion, degen, levels, targetLabelInsets, controlled, price]);
34
+ useEffect(() => {
35
+ if (controlled || !active) {
36
+ setStale(false);
37
+ return;
38
+ }
39
+ let alive = true, deadline;
40
+ const expire = () => { if (alive) {
41
+ latest.current = null;
42
+ setStale(true);
43
+ } };
44
+ const arm = () => { clearTimeout(deadline); deadline = setTimeout(expire, 30_000); };
45
+ latest.current = null;
46
+ setStale(false);
47
+ arm();
48
+ const stop = feed(p => { if (alive && validPrice(p)) {
49
+ latest.current = p;
50
+ setStale(false);
51
+ arm();
52
+ } }, expire);
53
+ return () => { alive = false; clearTimeout(deadline); stop(); };
54
+ }, [controlled, controlled ? undefined : feed, active]);
55
+ const hasSize = width > 0 && height > 0;
56
+ useEffect(() => {
57
+ if (!active || !hasSize)
58
+ return;
59
+ let raf = 0, last = -Infinity, sampled = -Infinity, lastBurst = -Infinity, previous = NaN, anchor = NaN, spacing = 0;
60
+ let ticks = [], burst;
61
+ const tween = priceTween(), layout = targetLayout(), crossings = targetCrossings();
62
+ const step = (now) => {
63
+ raf = requestAnimationFrame(step);
64
+ const { width, height, reducedMotion, levels, degen, targetLabelInsets } = settings.current, mark = latest.current;
65
+ // Bound SVG commits to 30 Hz. Reduced motion needs only the price sample cadence.
66
+ if (now - last < (reducedMotion ? ALTIMETER_SAMPLE_MS : 1000 / 30) - 1)
67
+ return;
68
+ const gap = now - last > 2000;
69
+ last = now;
70
+ if (gap || mark == null) {
71
+ ticks = [];
72
+ sampled = -Infinity;
73
+ tween.reset();
74
+ crossings.reset();
75
+ layout.reset();
76
+ burst = undefined;
77
+ }
78
+ const display = mark == null ? NaN : tween.update(mark, now, reducedMotion || gap);
79
+ if (mark != null) {
80
+ if (!spacing || Math.abs(display - anchor) > 40 * spacing) {
81
+ spacing = tickSpacingFor(display);
82
+ anchor = Math.round(display / spacing) * spacing;
83
+ }
84
+ if (now - sampled >= ALTIMETER_SAMPLE_MS) {
85
+ const keep = width / ALTIMETER_FLOW_PX * 1000 + 2000;
86
+ if (!ticks.length)
87
+ ticks = [{ t: now - keep, p: display }];
88
+ ticks = [...ticks, { t: now, p: display }];
89
+ while (ticks.length > 2 && ticks[1].t < now - keep)
90
+ ticks.shift();
91
+ sampled = now;
92
+ }
93
+ const hit = crossings.update(display, levels).at(-1);
94
+ if (hit && degen && !reducedMotion && now - lastBurst >= ALTIMETER_BURST_COOLDOWN_MS) {
95
+ burst = { start: now, direction: display > previous ? 'up' : 'down', color: hit.color };
96
+ lastBurst = now;
97
+ }
98
+ }
99
+ if (!degen || reducedMotion || (burst && now - burst.start >= tokens.motion.base * 2))
100
+ burst = undefined;
101
+ previous = display;
102
+ setFrame({ now, mark, display, anchor, spacing, ticks, levels: layout.update(levels, display, spacing, height, now, reducedMotion || gap, targetLabelInsets), burst });
103
+ };
104
+ raf = requestAnimationFrame(step);
105
+ return () => cancelAnimationFrame(raf);
106
+ }, [active, hasSize, controlled, controlled ? undefined : feed]);
107
+ const { now, display, mark, spacing, anchor, ticks } = frame, center = height / 2;
108
+ const digits = labelDecimalsFor(spacing, display);
109
+ const optionsKey = JSON.stringify(priceOptions ?? {});
110
+ const format = useMemo(() => new Intl.NumberFormat(locale, { style: 'currency', currency: 'USD', minimumFractionDigits: digits, maximumFractionDigits: digits, ...priceOptions }), [locale, digits, optionsKey]);
111
+ const pnlFormat = useMemo(() => new Intl.NumberFormat(locale, { style: 'currency', currency: priceOptions?.currency ?? 'USD', signDisplay: 'exceptZero' }), [locale, priceOptions?.currency]);
112
+ const percent = useMemo(() => new Intl.NumberFormat(locale, { style: 'percent', minimumFractionDigits: 2, maximumFractionDigits: 2, signDisplay: 'exceptZero' }), [locale]);
113
+ const capsule = position?.capsule;
114
+ const value = typeof capsule === 'object' ? capsule.returnRatio : capsule === 'pnl' ? position?.pnl : mark;
115
+ const reading = value != null && Number.isFinite(value) ? (typeof capsule === 'object' ? percent : capsule === 'pnl' ? pnlFormat : format).format(value) : '—';
116
+ const tone = (n) => !Number.isFinite(n) || n === 0 ? colors.muted : n > 0 ? colors.positive : colors.negative;
117
+ const pillColor = position ? tone(position.pnl) : colors.action;
118
+ const basis = position?.breakEvenPrice;
119
+ const lineColor = position ? tone(mark != null && validPrice(basis) ? (mark - basis) * (position.side === 'short' ? -1 : 1) : 0) : colors.action;
120
+ const pillWidth = Math.min(Math.max(0, width - 8), Math.max(110, reading.length * 10 + 20)), end = Math.max(0, width - 8 - pillWidth);
121
+ const yFor = (p) => center - (p - display) / spacing * ALTIMETER_TICK_PX;
122
+ const points = trailPoints(ticks, now, 18, end, yFor), parts = [];
123
+ smoothTrail(points, { moveTo: (x, y) => parts.push(`M${x} ${y}`), lineTo: (x, y) => parts.push(`L${x} ${y}`), bezierCurveTo: (a, b, c, d, x, y) => parts.push(`C${a} ${b} ${c} ${d} ${x} ${y}`) });
124
+ const last = points.at(-1);
125
+ if (last) {
126
+ const dx = (end - last[0]) / 3;
127
+ parts.push(`C${last[0] + dx} ${last[1]} ${end - dx} ${center} ${end} ${center}`);
128
+ }
129
+ const trail = parts.join(' '), basisY = validPrice(basis) ? yFor(basis) : center;
130
+ const grid = useMemo(() => {
131
+ const marks = [];
132
+ for (let x = 25; x < width + 54; x += 50)
133
+ for (let y = 25; y < height + 3; y += 50)
134
+ marks.push(`M${x - 3} ${y}h6M${x} ${y - 3}v6`);
135
+ return marks.join(' ');
136
+ }, [width, height]);
137
+ const reach = (center / ALTIMETER_TICK_PX + 1) * spacing;
138
+ // Labels and Intl formatting change only when the visible tick range or its format changes.
139
+ const low = Math.floor((display - reach - anchor) / spacing), high = Math.ceil((display + reach - anchor) / spacing);
140
+ const ladder = useMemo(() => Number.isFinite(low) && Number.isFinite(high)
141
+ ? ladderPrices(anchor, spacing, anchor + low * spacing, anchor + high * spacing).map(price => ({ price, label: format.format(price) }))
142
+ : [], [anchor, spacing, low, high, format]);
143
+ const targetTexts = useMemo(() => new Map(levels.map(level => [level.id, [level.label, format.format(level.price)].filter(Boolean).join(' ')])), [levels, format]);
144
+ const bounds = Array.from(frame.levels.values());
145
+ const id = useId().replace(/[^a-zA-Z0-9_-]/g, ''), fade = 'trail' + id, shade = 'basis' + id;
146
+ const status = stale ? messages.stale : messages.loadingChart;
147
+ const label = [summary, mark == null ? status : reading, ...targetTexts.values()].join('. ');
148
+ const burst = degen && !reducedMotion ? frame.burst : undefined;
149
+ const shake = burst && now - burst.start < tokens.motion.base ? Math.sin((now - burst.start) / 18) * 3 * (1 - (now - burst.start) / tokens.motion.base) : 0;
150
+ return _jsxs(View, { ...view, children: [_jsx(Text, { children: summary }), _jsx(View, { accessible: true, accessibilityLabel: label, accessibilityRole: "image", onLayout: e => setWidth(e.nativeEvent.layout.width), style: { height, overflow: 'hidden', borderRadius: tokens.radius.xl, backgroundColor: colors.background }, children: width > 0 && _jsxs(Svg, { width: width, height: height, accessible: false, children: [_jsxs(Defs, { children: [_jsxs(LinearGradient, { id: fade, gradientUnits: "userSpaceOnUse", x1: 18, x2: end, y1: 0, y2: 0, children: [_jsx(Stop, { offset: 0, stopColor: lineColor, stopOpacity: 0 }), _jsx(Stop, { offset: 1, stopColor: lineColor })] }), validPrice(display) && validPrice(basis) && basisY !== center && _jsxs(LinearGradient, { id: shade, gradientUnits: "userSpaceOnUse", x1: 0, x2: 0, y1: center, y2: Math.min(height, Math.max(0, basisY)), children: [_jsx(Stop, { offset: 0, stopColor: lineColor, stopOpacity: .5 }), _jsx(Stop, { offset: 1, stopColor: lineColor, stopOpacity: 0 })] })] }), _jsx(Path, { d: grid, translateX: reducedMotion ? 0 : gridPhase(now), stroke: colors.nested, fill: "none" }), ladder.map(({ price: p, label }) => {
151
+ const y = yFor(p), covered = bounds.some(l => l.labelTop != null && y + 7 > l.labelTop - 2 && y - 7 < l.labelTop + 20);
152
+ return _jsxs(G, { opacity: .75, children: [_jsx(Path, { d: `M10 ${y}h8M${width - 18} ${y}h8`, stroke: colors.muted }), !covered && _jsx(SvgText, { x: width - 32, y: y + 4, textAnchor: "end", fontFamily: monoFontFamily, fontSize: 13, fill: colors.muted, children: label })] }, p);
153
+ }), trail && validPrice(basis) && basisY !== center ? _jsx(Path, { d: `${trail}L${end} ${basisY}L${points[0][0]} ${basisY}Z`, fill: `url(#${shade})` }) : null, trail ? _jsx(Path, { d: trail, stroke: `url(#${fade})`, strokeWidth: 2.5, fill: "none" }) : null, levels.map(l => {
154
+ const pos = frame.levels.get(l.id);
155
+ if (!pos)
156
+ return null;
157
+ const color = l.color ?? colors.action;
158
+ return _jsxs(G, { children: [!pos.pinned && _jsx(Line, { x1: 0, x2: width, y1: pos.y, y2: pos.y, stroke: color, strokeDasharray: "3 4" }), l.label && pos.labelTop != null && _jsx(SvgText, { x: width - 8, y: pos.labelTop + 14, textAnchor: "end", fontSize: 12, fill: color, children: targetTexts.get(l.id) })] }, l.id);
159
+ }), mark == null ? _jsx(SvgText, { x: width / 2, y: center, textAnchor: "middle", fill: colors.muted, children: status }) :
160
+ _jsxs(G, { translateX: shake, children: [_jsx(Rect, { x: end, y: center - 18, width: pillWidth, height: 36, rx: 18, fill: colors.background, stroke: pillColor }), _jsx(SvgText, { x: end + pillWidth / 2, y: center + 5, textAnchor: "middle", fontFamily: monoFontFamily, fontSize: 16, fontWeight: "600", fill: pillColor, children: reading })] }), burst && _jsx(BurstEffect, { burst: { ...burst, color: burst.color ?? colors.action }, now: now, x: end + pillWidth / 2, y: center, width: pillWidth })] }) })] });
161
+ }
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ export interface ClaimRewardBlockProps {
3
+ amount: number;
4
+ symbol: string;
5
+ walletAddress: string;
6
+ chain: string;
7
+ details?: readonly {
8
+ label: string;
9
+ value: string;
10
+ }[];
11
+ labels: {
12
+ title: string;
13
+ claim: string;
14
+ cancel: string;
15
+ wallet: string;
16
+ chain: string;
17
+ };
18
+ /** Open the host's confirmation screen for this prize. */
19
+ onClaim: () => void;
20
+ onCancel: () => void;
21
+ }
22
+ export declare function ClaimRewardBlock({ amount, symbol, walletAddress, chain, details, labels, onClaim, onCancel }: ClaimRewardBlockProps): React.JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ import { AnimatedNumberReadout } from './animated-number.js';
4
+ import { Button } from './button.js';
5
+ import { ScreenHeader } from './screen-header.js';
6
+ import { Stack, Text } from './surface.js';
7
+ import { AddressReadout } from './address-readout.js';
8
+ export function ClaimRewardBlock({ amount, symbol, walletAddress, chain, details, labels, onClaim, onCancel }) {
9
+ const disabled = !Number.isFinite(amount) || amount <= 0 || !walletAddress.trim() || !chain.trim();
10
+ const info = [
11
+ ...(details ?? []),
12
+ { label: labels.wallet, value: walletAddress, address: true },
13
+ { label: labels.chain, value: chain },
14
+ ];
15
+ return _jsxs(Stack, { children: [_jsx(ScreenHeader, { title: labels.title }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'baseline', justifyContent: 'center', flexWrap: 'wrap', gap: 8 }, children: [_jsx(AnimatedNumberReadout, { value: amount, options: { maximumFractionDigits: 6 }, style: { fontSize: 44, lineHeight: 50, fontWeight: '700' } }), _jsx(Text, { tone: "muted", style: { fontSize: 24, fontWeight: '600' }, children: symbol })] }), _jsx(View, { style: { gap: 12, paddingHorizontal: 4 }, children: info.map(detail => _jsxs(View, { accessible: true, accessibilityLabel: `${detail.label}, ${detail.value}`, style: { flexDirection: 'row', flexWrap: 'wrap', alignItems: 'baseline', justifyContent: 'space-between', gap: 8 }, children: [_jsx(Text, { tone: "muted", children: detail.label }), _jsx(View, { style: { marginStart: 'auto', maxWidth: '100%' }, children: detail.address ? _jsx(AddressReadout, { address: walletAddress }) : _jsx(Text, { children: detail.value }) })] }, detail.label)) }), _jsxs(View, { style: { flexDirection: 'row', gap: 8 }, children: [_jsx(Button, { style: { flex: 1 }, intent: "secondary", onPress: onCancel, children: labels.cancel }), _jsx(Button, { style: { flex: 1 }, disabled: disabled, onPress: onClaim, children: labels.claim })] })] });
16
+ }
@@ -89,10 +89,6 @@ export interface ConfirmBlockProps {
89
89
  /** Prefix of the test IDs: `<testID>-header`, `-amount`, `-symbol`, `-to`, `-network`, `-detail-<index>`, `-body`, `-point-<index>`, `-warning`, `-confirm`, `-cancel` and `-tertiary`. Defaults to `confirm`. `confirmTestID`, `cancelTestID` and `tertiaryAction.testID` replace the last three one by one. */
90
90
  testID?: string;
91
91
  }
92
- /** The address as the two rows the block draws: split at the middle, with `anchor` on the characters people compare, the first 4 (6 when it starts with `0x`) and the last 4. An address too short to have a middle is all anchor. */
93
- export declare function confirmAddressRows(address: string): {
94
- text: string;
95
- anchor: boolean;
96
- }[][];
92
+ export { confirmAddressRows } from './address-readout.js';
97
93
  /** The last look before a send: the amount as the headline, where it goes and on which network, a warning that it cannot be taken back, then Cancel and Confirm side by side. Without an amount, address or network it confirms anything else, such as signing out or deleting an account: the header, `children`, then the actions. */
98
94
  export declare function ConfirmBlock({ amount, symbol, amountOptions, amountLabel, address, network, details, oneLineDetails, children, points, confirmIntent, tertiaryAction, title, warningTitle, warning, notice, onConfirm, confirmLabel, busy, confirmDisabled, cancelWhileBusy, backWhileBusy, onCancel, cancelLabel, cancelDisabled, confirmTestID, cancelTestID, onBack, backProps, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, headingId, testID }: ConfirmBlockProps): React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React from 'react';
3
- import { Platform, View } from 'react-native';
2
+ import { AddressReadout } from './address-readout.js';
3
+ import { View } from 'react-native';
4
4
  import { withAlpha } from '@bloxwap/hig/tokens';
5
5
  import { useColors, useHIG, useMessages } from './provider.js';
6
6
  import { Text } from './surface.js';
@@ -8,25 +8,14 @@ import { Button } from './button.js';
8
8
  import { AnimatedNumberReadout } from './animated-number.js';
9
9
  import { ScreenHeader } from './screen-header.js';
10
10
  import { StickyHeaderLayout } from './sticky-header.js';
11
+ export { confirmAddressRows } from './address-readout.js';
11
12
  const amountFormat = { maximumFractionDigits: 6 };
12
- /** The address as the two rows the block draws: split at the middle, with `anchor` on the characters people compare, the first 4 (6 when it starts with `0x`) and the last 4. An address too short to have a middle is all anchor. */
13
- export function confirmAddressRows(address) {
14
- const characters = Array.from(address), head = address.startsWith('0x') ? 6 : 4, tail = characters.length - 4, split = Math.ceil(characters.length / 2);
15
- return [characters.slice(0, split), characters.slice(split)].map((row, rowIndex) => {
16
- const parts = [];
17
- row.forEach((character, index) => { const position = rowIndex * split + index, anchor = position < head || position >= tail, last = parts[parts.length - 1]; if (last && last.anchor === anchor)
18
- last.text += character;
19
- else
20
- parts.push({ text: character, anchor }); });
21
- return parts;
22
- });
23
- }
24
13
  /** The last look before a send: the amount as the headline, where it goes and on which network, a warning that it cannot be taken back, then Cancel and Confirm side by side. Without an amount, address or network it confirms anything else, such as signing out or deleting an account: the header, `children`, then the actions. */
25
14
  export function ConfirmBlock({ amount, symbol, amountOptions = amountFormat, amountLabel, address, network, details, oneLineDetails, children, points, confirmIntent = 'primary', tertiaryAction, title, warningTitle, warning, notice, onConfirm, confirmLabel, busy, confirmDisabled, cancelWhileBusy, backWhileBusy, onCancel, cancelLabel, cancelDisabled, confirmTestID, cancelTestID, onBack, backProps, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, headingId, testID = 'confirm' }) {
26
15
  // What busy holds besides the confirming action: Back, Cancel and the tertiary action, unless the host lets them leave the wait (Back alone with backWhileBusy).
27
16
  const held = !!busy && !cancelWhileBusy;
28
17
  const backHeld = held && !backWhileBusy;
29
- const colors = useColors(), t = useMessages(), { direction, monoFontFamily } = useHIG();
18
+ const colors = useColors(), t = useMessages(), { direction } = useHIG();
30
19
  const id = (part) => `${testID}-${part}`;
31
20
  const note = warning === undefined ? (address !== undefined ? t.sendWarning(symbol ?? '', network ?? '') : null) : warning;
32
21
  // Read-only lines, each read as one: "To, 0x…".
@@ -36,7 +25,7 @@ export function ConfirmBlock({ amount, symbol, amountOptions = amountFormat, amo
36
25
  const one = !!oneLineDetails && part !== toPart, lines = one ? 1 : undefined;
37
26
  return _jsxs(View, { accessible: true, accessibilityLabel: spoken !== undefined || typeof value === 'string' || typeof value === 'number' ? `${label}, ${spoken ?? value}` : undefined, style: { direction, flexDirection: 'row', alignItems: 'baseline', justifyContent: 'space-between', gap: 12 }, children: [_jsx(Text, { numberOfLines: lines, style: { ...(one ? { flexShrink: 0 } : null), fontSize: 16, lineHeight: 24, color: colors.muted }, children: label }), one || typeof value === 'string' || typeof value === 'number' ? _jsx(Text, { testID: id(part), numberOfLines: lines, ellipsizeMode: one ? 'tail' : undefined, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '500', textAlign: 'right', color: colors.text }, children: value }) : _jsx(View, { testID: id(part), style: { flexShrink: 1 }, children: value })] }, part);
38
27
  };
39
- const toPart = 'to', networkPart = 'network', mono = monoFontFamily ?? Platform.select({ ios: 'Menlo', default: 'monospace' }), type = { fontFamily: mono, fontSize: 15, lineHeight: 22 }, shown = address === undefined ? null : _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1.2, style: { ...type, writingDirection: 'ltr', textAlign: 'left' }, children: confirmAddressRows(address).map((row, index) => _jsxs(React.Fragment, { children: [index > 0 ? '\n' : null, row.map((part, offset) => _jsx(Text, { maxFontSizeMultiplier: 1.2, style: { ...type, color: part.anchor ? colors.text : colors.muted, fontWeight: part.anchor ? '700' : '500' }, children: part.text }, offset))] }, index)) }), lines = [...(address !== undefined ? [line(toPart, t.sendTo, shown, address)] : []), ...(network !== undefined ? [line(networkPart, t.sendNetwork, network)] : []), ...(details ?? []).map((detail, index) => line(`detail-${index}`, detail.label, detail.value, detail.valueLabel))];
28
+ const toPart = 'to', networkPart = 'network', shown = address === undefined ? null : _jsx(AddressReadout, { address: address }), lines = [...(address !== undefined ? [line(toPart, t.sendTo, shown, address)] : []), ...(network !== undefined ? [line(networkPart, t.sendNetwork, network)] : []), ...(details ?? []).map((detail, index) => line(`detail-${index}`, detail.label, detail.value, detail.valueLabel))];
40
29
  const header = _jsx(ScreenHeader, { title: title ?? t.confirmSend, onBack: onBack, backDisabled: backHeld, backProps: backProps, action: headerAction, headingId: headingId, testID: testID });
41
30
  const hasBody = (children != null && children !== false) || !!points?.length;
42
31
  const tertiaryInert = held || !!tertiaryAction?.disabled;
@@ -3,7 +3,7 @@ import { type StyleProp, type TextStyle } from 'react-native';
3
3
  /** `up`/`down` are market direction (rising/long/gain, falling/short/loss) and follow `HIGProvider marketColors`; `positive`/`negative` stay success/error. */
4
4
  export type NumberTone = 'text' | 'positive' | 'negative' | 'warning' | 'muted' | 'faint' | 'up' | 'down';
5
5
  /** Typography only: semantic tone owns colour and numeric glyphs remain tabular. */
6
- export type NumberReadoutStyle = Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'textAlign'>;
6
+ export type NumberReadoutStyle = Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'textAlign' | 'textDecorationLine' | 'textDecorationColor' | 'textDecorationStyle'>;
7
7
  export interface NumberProps {
8
8
  value: number | null | undefined;
9
9
  options?: Intl.NumberFormatOptions; /** Host-owned display text for a finite value. Empty text falls back to locale formatting; never parse this text for submission. */
@@ -8,7 +8,7 @@ import * as en from '@bloxwap/hig/contracts/messages';
8
8
  import { useColors, useHIG, useNumberLocale } from './provider.js';
9
9
  import { Text, Surface, Separator } from './surface.js';
10
10
  import { Button } from './button.js';
11
- const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign']);
11
+ const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign', 'textDecorationLine', 'textDecorationColor', 'textDecorationStyle']);
12
12
  export function NumberReadout({ value, options, formattedValue, stale, label, tone = 'text', style, testID, maxFontSizeMultiplier, prefix, suffix }) {
13
13
  const { messages, numberFormat } = useHIG();
14
14
  const locale = useNumberLocale();
@@ -17,6 +17,8 @@ export function NumberReadout({ value, options, formattedValue, stale, label, to
17
17
  const staleSuffix = stale ? ` ${messages.stale ?? en.stale}` : '';
18
18
  // Keep the same boundary for untyped hosts and registered/array styles: no raw colour, glyph or layout overrides.
19
19
  const typography = Object.fromEntries(Object.entries(StyleSheet.flatten(style) ?? {}).filter(([key]) => numberTypographyKeys.has(key)));
20
+ if (typography.fontSize !== undefined && typography.lineHeight === undefined)
21
+ typography.lineHeight = undefined;
20
22
  const color = colors[tone === 'positive' || tone === 'negative' || tone === 'warning' || tone === 'muted' || tone === 'faint' || tone === 'up' || tone === 'down' ? tone : 'text'];
21
23
  return _jsxs(Text, { accessibilityLabel: label ? `${label}: ${reading}${staleSuffix}` : undefined, testID: testID, maxFontSizeMultiplier: maxFontSizeMultiplier, style: [typography, { color, fontVariant: ['tabular-nums'] }], children: [reading, staleSuffix] });
22
24
  }
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ export interface DepositMethod {
3
+ id: string;
4
+ label: string;
5
+ description: string;
6
+ /** Optional artwork for a custom method or a replacement for its built-in icon. */
7
+ icon?: React.ReactNode;
8
+ disabled?: boolean;
9
+ }
10
+ export interface DepositBlockProps {
11
+ title?: string;
12
+ description?: string;
13
+ methods: readonly DepositMethod[];
14
+ onSelect: (method: DepositMethod) => void;
15
+ onBack?: () => void;
16
+ headerAction?: React.ReactNode;
17
+ headingId?: string;
18
+ }
19
+ export declare function DepositBlock({ title, description, methods, onSelect, onBack, headerAction, headingId }: DepositBlockProps): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { QrCode } from '@bloxwap/icons/native/qr-code';
3
+ import { depositIcon } from '@bloxwap/hig/tokens/deposit-icons';
4
+ import { View } from 'react-native';
5
+ import { SvgXml } from 'react-native-svg';
6
+ import { useColors, useMessages } from './provider.js';
7
+ import { Text } from './surface.js';
8
+ import { ListGroup, ListRow } from './list-group.js';
9
+ import { ScreenHeader } from './screen-header.js';
10
+ export function DepositBlock({ title, description, methods, onSelect, onBack, headerAction, headingId }) {
11
+ const messages = useMessages();
12
+ const colors = useColors();
13
+ const qr = methods.find(method => method.id === 'qr');
14
+ const orderedMethods = qr ? [qr, ...methods.filter(method => method.id !== 'qr')] : methods;
15
+ return _jsxs(View, { style: { gap: 12 }, children: [_jsx(ScreenHeader, { title: title ?? messages.deposit, onBack: onBack, action: headerAction, headingId: headingId }), description && _jsx(Text, { style: { color: colors.muted, fontSize: 14, textAlign: 'center' }, children: description }), _jsx(ListGroup, { children: orderedMethods.map(method => {
16
+ const svg = depositIcon(method.id);
17
+ const leading = method.icon ?? (method.id === 'qr' ? _jsx(View, { style: { width: 44, height: 44, borderRadius: 10, backgroundColor: colors.background, alignItems: "center", justifyContent: "center" }, children: _jsx(QrCode, { size: 24, color: colors.text }) }) : svg && _jsx(SvgXml, { xml: svg, width: 44, height: 44 }));
18
+ return _jsx(ListRow, { leading: leading, label: method.label, description: method.description, disabled: method.disabled, onSelect: () => onSelect(method) }, method.id);
19
+ }) })] });
20
+ }
@@ -154,7 +154,7 @@ export function GestureSheet({ open, onOpenChange, title, description, children,
154
154
  const sheetFill = useMemo(() => ({ backgroundColor: colors.overlay, borderRadius: tokens.radius.xl, boxShadow: '0 -8px 32px #0008' }), [colors.overlay]);
155
155
  const sheetBackground = useMemo(() => backgroundStyle ? [sheetFill, backgroundStyle] : sheetFill, [sheetFill, backgroundStyle]);
156
156
  const sheetIndicator = useMemo(() => { const fill = { backgroundColor: colors.action }; return handleIndicatorStyle ? [fill, handleIndicatorStyle] : fill; }, [colors.action, handleIndicatorStyle]);
157
- const backendProps = { accessible: false, accessibilityLabel: title, index: presentation === 'inline' && !open ? -1 : presented.current ? Math.max(0, Math.min(activeIndex.current, detentCount - 1)) : startingIndex, snapPoints: enableDynamicSizing ? undefined : backendSnapPoints, enableDynamicSizing, maxDynamicContentSize: enableDynamicSizing ? maxDynamicContentSize : undefined, enableContentPanningGesture, enablePanDownToClose: dismissible, topInset: topInset ?? insets.top, bottomInset: bottomInset ?? insets.bottom, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, overrideReduceMotion: env.reducedMotion ? ReduceMotion.Always : ReduceMotion.System, animateOnMount, animationConfigs, backdropComponent: backdropComponent === undefined ? backdrop : backdropComponent, handleComponent, handleStyle, backgroundComponent, containerStyle, backgroundStyle: sheetBackground, handleIndicatorStyle: sheetIndicator, onChange: handleChange };
157
+ const backendProps = { style: { marginLeft: 8 + insets.left, marginRight: 8 + insets.right }, accessible: false, accessibilityLabel: title, index: presentation === 'inline' && !open ? -1 : presented.current ? Math.max(0, Math.min(activeIndex.current, detentCount - 1)) : startingIndex, snapPoints: enableDynamicSizing ? undefined : backendSnapPoints, enableDynamicSizing, maxDynamicContentSize: enableDynamicSizing ? maxDynamicContentSize : undefined, enableContentPanningGesture, enablePanDownToClose: dismissible, topInset: topInset ?? insets.top, bottomInset: bottomInset ?? insets.bottom, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, overrideReduceMotion: env.reducedMotion ? ReduceMotion.Always : ReduceMotion.System, animateOnMount, animationConfigs, backdropComponent: backdropComponent === undefined ? backdrop : backdropComponent, handleComponent, handleStyle, backgroundComponent, containerStyle, backgroundStyle: sheetBackground, handleIndicatorStyle: sheetIndicator, onChange: handleChange };
158
158
  const lifted = raised ? _jsx(Raised, { children: content }) : content;
159
159
  return presentation === 'inline' ? _jsx(BottomSheet, { ...backendProps, ref: inline, accessibilityElementsHidden: !open, importantForAccessibility: open ? 'auto' : 'no-hide-descendants', onClose: handleSettledClose, children: lifted }) : _jsx(BottomSheetModal, { ...backendProps, ref: sheet, enableDismissOnClose: true, stackBehavior: 'push', onDismiss: handleSettledClose, children: lifted });
160
160
  }
@@ -28,7 +28,7 @@ export function LanguageBlock({ title, onBack, headerAction, languages, value =
28
28
  const body = _jsxs(_Fragment, { children: [description ? _jsx(Text, { testID: testID ? `${testID}-description` : undefined, style: { paddingHorizontal: 4, fontSize: 14, lineHeight: 21, color: colors.muted }, children: description }) : null, search ? _jsx(SearchInput, { testID: testID ? `${testID}-search` : undefined, accessibilityLabel: t.searchLanguages, placeholder: t.searchLanguages, value: query, onChangeText: setQuery, returnKeyType: 'search', autoCapitalize: 'none', autoCorrect: false, spellCheck: false }) : null, rows.length === 0 ? _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, accessibilityLiveRegion: 'polite', style: { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20, color: colors.muted }, children: t.noResults }) :
29
29
  _jsx(View, { testID: testID ? `${testID}-list` : undefined, accessibilityRole: 'radiogroup', accessibilityLabel: heading, style: { gap: 4 }, children: rows.map(language => {
30
30
  const selected = language.code === value;
31
- return _jsxs(Pressable, { testID: testID ? `${testID}-${language.code}` : undefined, accessibilityRole: 'radio', accessibilityState: disabled ? { checked: selected, disabled: true } : { checked: selected }, accessibilityLabel: [language.name, language.description].filter(Boolean).join(', '), accessibilityLanguage: language.code, disabled: disabled, onPress: () => onSelect(language), style: disabled ? ({ pressed }) => ({ ...row(pressed), opacity: 0.5 }) : ({ pressed }) => row(pressed), children: [_jsx(View, { ...hidden, children: typeof language.flag === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: language.flag }, style: shape }) : _jsx(View, { style: shape, children: language.flag ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: language.code.slice(0, 2).toUpperCase() }) }) }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: language.name }), language.description ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: language.description }) : null] }), selected ? _jsx(Check, { size: 20, color: colors.text, testID: testID ? `${testID}-check` : undefined }) : null] }, language.code);
31
+ return _jsxs(Pressable, { testID: testID ? `${testID}-${language.code}` : undefined, accessibilityRole: 'radio', accessibilityState: disabled ? { checked: selected, disabled: true } : { checked: selected }, accessibilityLabel: [language.name, language.description].filter(Boolean).join(', '), accessibilityLanguage: language.code, disabled: disabled, onPress: () => onSelect(language), style: disabled ? ({ pressed }) => ({ ...row(pressed), opacity: 0.5 }) : ({ pressed }) => row(pressed), children: [_jsx(View, { ...hidden, children: typeof language.flag === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: language.flag }, style: shape }) : _jsx(View, { style: shape, children: language.flag ?? _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: language.code.slice(0, 2).toUpperCase() }) }) }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text }, children: language.name }), language.description ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: language.description }) : null] }), selected ? _jsx(Check, { size: 20, color: colors.positive, testID: testID ? `${testID}-check` : undefined }) : null] }, language.code);
32
32
  }) })] });
33
33
  // The sticky layout puts the header and the body in separate views, so the body's first gap is its top padding.
34
34
  if (stickyHeader)
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { type LoginBlockProps } from '@bloxwap/hig/contracts/login';
3
+ export type { LoginBlockProps, LoginProvider } from '@bloxwap/hig/contracts/login';
4
+ export declare function LoginBlock({ onLogin, onClose, lastUsed, disabled, analyticsEnabled, onAnalyticsChange, labels, termsUrl, privacyUrl }: LoginBlockProps): React.JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { View } from 'react-native';
4
+ import Svg, { Path } from 'react-native-svg';
5
+ import { HeaderClose, ScreenHeader } from './screen-header.js';
6
+ import { Switch } from './switch.js';
7
+ import { Dialog } from './overlay.js';
8
+ import { SeverityIcon } from './icons.js';
9
+ import { ListRow } from './list-group.js';
10
+ import { Badge } from './status.js';
11
+ import { Text } from './surface.js';
12
+ import { Button, Link } from './button.js';
13
+ import { useColors } from './provider.js';
14
+ import { loginProviders, loginArtwork, loginCopy, loginTermsUrl, loginPrivacyUrl } from '@bloxwap/hig/contracts/login';
15
+ export function LoginBlock({ onLogin, onClose, lastUsed, disabled, analyticsEnabled, onAnalyticsChange, labels, termsUrl = loginTermsUrl, privacyUrl = loginPrivacyUrl }) {
16
+ const copy = { ...loginCopy, ...labels };
17
+ const colors = useColors();
18
+ const [infoOpen, setInfoOpen] = React.useState(false);
19
+ const infoTrigger = React.useRef(null);
20
+ const linkStyle = { color: colors.muted, textDecorationLine: 'underline' };
21
+ return _jsxs(View, { style: { gap: 16 }, children: [_jsx(ScreenHeader, { title: copy.title, action: _jsx(HeaderClose, { label: copy.close, onClose: onClose }) }), _jsx(View, { style: { gap: 8 }, children: loginProviders.map(provider => _jsx(View, { style: { borderRadius: 16, overflow: 'hidden' }, children: _jsx(ListRow, { label: copy[provider], disabled: disabled, disclosure: "none", onSelect: () => onLogin(provider), leading: _jsx(Svg, { width: 20, height: 20, viewBox: "0 0 24 24", children: loginArtwork[provider].map(path => _jsx(Path, { d: path.d, fill: path.fill ?? colors.text }, path.d)) }), accessibilityLabel: lastUsed === provider ? `${copy[provider]}, ${copy.lastUsed}` : copy[provider], trailing: lastUsed === provider ? _jsx(Badge, { tone: "positive", children: copy.lastUsed }) : undefined }) }, provider)) }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center' }, children: [_jsx(Text, { style: { flexShrink: 1 }, children: copy.analytics }), _jsx(Button, { ref: infoTrigger, intent: "ghost", contentMode: "custom", accessibilityLabel: copy.analyticsInfo, style: { width: 44, paddingHorizontal: 0 }, onPress: () => setInfoOpen(true), children: _jsx(SeverityIcon, { kind: "info", color: colors.muted }) }), _jsx(View, { style: { marginStart: 'auto' }, children: _jsx(Switch, { hideLabel: true, label: copy.analytics, checked: analyticsEnabled, onCheckedChange: onAnalyticsChange }) })] }), _jsx(Dialog, { open: infoOpen, onOpenChange: setInfoOpen, title: copy.analyticsInfo, closeLabel: copy.close, returnFocusRef: infoTrigger, children: _jsx(Text, { children: copy.description }) }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'center', flexWrap: 'wrap', gap: 16 }, children: [_jsx(Link, { href: termsUrl, contentMode: "custom", children: _jsx(Text, { style: linkStyle, children: copy.terms }) }), _jsx(Link, { href: privacyUrl, contentMode: "custom", children: _jsx(Text, { style: linkStyle, children: copy.privacy }) })] })] });
22
+ }
@@ -98,5 +98,12 @@ export declare function positionCorridor({ side, entry, mark, liquidation }: {
98
98
  drawdown: number;
99
99
  share: number | null;
100
100
  };
101
+ export declare function PositionSummaryRow({ position, side, labels, pnlOptions, disclosure }: {
102
+ position: ManagePositionBlockSummary;
103
+ side: 'long' | 'short';
104
+ labels: Pick<ManagePositionBlockLabels, 'long' | 'short'>;
105
+ pnlOptions?: Intl.NumberFormatOptions;
106
+ disclosure?: boolean;
107
+ }): React.JSX.Element;
101
108
  /** One open position as a screen: margin and notional under the share left before liquidation, then the liquidation, mark and entry prices as a `BarPnl`, what can be done, and the position itself. Both bars are drawn without a card, because nothing in them can be pressed. */
102
109
  export declare function ManagePositionBlock({ labels, mode, side, entry, mark, liquidation, margin, notional, priceOptions, actions, position, pnlOptions, onBack, headerAction, headingId, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: ManagePositionBlockProps): React.JSX.Element;