@bloxwap/hig 0.5.2 → 0.6.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.
- package/README.md +1 -1
- package/chart/README.md +1 -1
- package/contracts/README.md +1 -1
- package/contracts/dist/messages.d.ts +31 -4
- package/contracts/dist/messages.js +11 -2
- package/feedback/README.md +1 -1
- package/native/README.md +1 -1
- package/native/dist/account-block.d.ts +46 -0
- package/native/dist/account-block.js +28 -0
- package/native/dist/asset-balance-row.d.ts +20 -0
- package/native/dist/asset-balance-row.js +21 -0
- package/native/dist/bar-mark.d.ts +45 -0
- package/native/dist/bar-mark.js +34 -0
- package/native/dist/bar-pnl.d.ts +50 -0
- package/native/dist/bar-pnl.js +59 -0
- package/native/dist/blocks.d.ts +44 -0
- package/native/dist/{recipes.js → blocks.js} +19 -9
- package/native/dist/field.d.ts +0 -1
- package/native/dist/field.js +0 -1
- package/native/dist/icons.d.ts +8 -0
- package/native/dist/icons.js +4 -0
- package/native/dist/language-block.d.ts +31 -0
- package/native/dist/language-block.js +30 -0
- package/native/dist/list-group.d.ts +26 -0
- package/native/dist/list-group.js +27 -0
- package/native/dist/manage-position-block.d.ts +69 -0
- package/native/dist/manage-position-block.js +57 -0
- package/native/dist/notifications-block.d.ts +25 -0
- package/native/dist/notifications-block.js +14 -0
- package/native/dist/pickers.d.ts +12 -4
- package/native/dist/pickers.js +6 -2
- package/native/dist/position-block.d.ts +51 -0
- package/native/dist/position-block.js +21 -0
- package/native/dist/profile-block.d.ts +42 -0
- package/native/dist/profile-block.js +28 -0
- package/native/dist/reward-block.d.ts +83 -0
- package/native/dist/reward-block.js +35 -0
- package/native/dist/setting-header.d.ts +8 -0
- package/native/dist/setting-header.js +11 -0
- package/native/dist/setting-switch.d.ts +18 -0
- package/native/dist/setting-switch.js +17 -0
- package/native/dist/signals-block.d.ts +37 -0
- package/native/dist/signals-block.js +16 -0
- package/native/dist/sound-haptics-block.d.ts +39 -0
- package/native/dist/sound-haptics-block.js +21 -0
- package/native/dist/{swap-panel.d.ts → swap-panel-block.d.ts} +6 -2
- package/native/dist/{swap-panel.js → swap-panel-block.js} +4 -2
- package/native/dist/swap-sheet.d.ts +4 -4
- package/native/dist/swap-sheet.js +4 -4
- package/native/dist/swap-views.d.ts +1 -1
- package/native/dist/swap-views.js +4 -4
- package/native/dist/target-block.d.ts +83 -0
- package/native/dist/target-block.js +61 -0
- package/native/dist/token-action-block.d.ts +39 -0
- package/native/dist/token-action-block.js +20 -0
- package/native/dist/trade-history-detail-block.d.ts +59 -0
- package/native/dist/trade-history-detail-block.js +38 -0
- package/native/dist/trade-history-list-block.d.ts +44 -0
- package/native/dist/trade-history-list-block.js +29 -0
- package/native-fonts/README.md +1 -1
- package/og-fonts/README.md +1 -1
- package/package.json +246 -41
- package/react/README.md +1 -1
- package/react/dist/asset-balance-row.d.ts +19 -0
- package/react/dist/asset-balance-row.js +10 -0
- package/react/dist/bar-mark.d.ts +35 -0
- package/react/dist/bar-mark.js +21 -0
- package/react/dist/bar-pnl.d.ts +49 -0
- package/react/dist/bar-pnl.js +45 -0
- package/react/dist/blocks/account-block.d.ts +46 -0
- package/react/dist/blocks/account-block.js +27 -0
- package/react/dist/blocks/language-block.d.ts +32 -0
- package/react/dist/blocks/language-block.js +51 -0
- package/react/dist/blocks/manage-position-block.d.ts +67 -0
- package/react/dist/blocks/manage-position-block.js +28 -0
- package/react/dist/blocks/notifications-block.d.ts +23 -0
- package/react/dist/blocks/notifications-block.js +8 -0
- package/react/dist/{recipes → blocks}/pickers.d.ts +12 -4
- package/react/dist/{recipes → blocks}/pickers.js +6 -2
- package/react/dist/blocks/position-block.d.ts +49 -0
- package/react/dist/blocks/position-block.js +14 -0
- package/react/dist/blocks/profile-block.d.ts +48 -0
- package/react/dist/blocks/profile-block.js +15 -0
- package/react/dist/blocks/reward-block.d.ts +81 -0
- package/react/dist/blocks/reward-block.js +24 -0
- package/react/dist/blocks/screen-header.d.ts +9 -0
- package/react/dist/blocks/screen-header.js +12 -0
- package/react/dist/blocks/setting-switch.d.ts +10 -0
- package/react/dist/blocks/setting-switch.js +8 -0
- package/react/dist/blocks/signals-block.d.ts +35 -0
- package/react/dist/blocks/signals-block.js +15 -0
- package/react/dist/blocks/sound-haptics-block.d.ts +37 -0
- package/react/dist/blocks/sound-haptics-block.js +18 -0
- package/react/dist/{recipes → blocks}/swap/picker.d.ts +1 -1
- package/react/dist/{recipes → blocks}/swap/picker.js +4 -4
- package/react/dist/{recipes → blocks}/swap/shared.d.ts +1 -0
- package/react/dist/{recipes → blocks}/swap/shared.js +1 -0
- package/react/dist/{recipes/swap-panel.d.ts → blocks/swap-panel-block.d.ts} +6 -2
- package/react/dist/{recipes/swap-panel.js → blocks/swap-panel-block.js} +3 -1
- package/react/dist/{recipes → blocks}/swap-sheet.d.ts +4 -4
- package/react/dist/{recipes → blocks}/swap-sheet.js +4 -4
- package/react/dist/blocks/target-block.d.ts +81 -0
- package/react/dist/blocks/target-block.js +65 -0
- package/react/dist/blocks/token-action-block.d.ts +37 -0
- package/react/dist/blocks/token-action-block.js +18 -0
- package/react/dist/{recipes → blocks}/trade-entry.js +2 -2
- package/react/dist/blocks/trade-history-detail-block.d.ts +58 -0
- package/react/dist/blocks/trade-history-detail-block.js +16 -0
- package/react/dist/blocks/trade-history-list-block.d.ts +43 -0
- package/react/dist/blocks/trade-history-list-block.js +21 -0
- package/react/dist/blocks.d.ts +20 -0
- package/react/dist/blocks.js +21 -0
- package/react/dist/field.d.ts +0 -2
- package/react/dist/field.js +0 -2
- package/react/dist/list-group.d.ts +26 -0
- package/react/dist/list-group.js +20 -0
- package/react/dist/styles.css +270 -5
- package/tokens/README.md +1 -1
- package/native/dist/recipes.d.ts +0 -46
- package/react/dist/recipes/activity-list.d.ts +0 -8
- package/react/dist/recipes/activity-list.js +0 -6
- package/react/dist/recipes/balance-card.d.ts +0 -6
- package/react/dist/recipes/balance-card.js +0 -5
- package/react/dist/recipes/code-window.d.ts +0 -4
- package/react/dist/recipes/code-window.js +0 -4
- package/react/dist/recipes.d.ts +0 -10
- package/react/dist/recipes.js +0 -11
- /package/react/dist/{recipes → blocks}/install-command.d.ts +0 -0
- /package/react/dist/{recipes → blocks}/install-command.js +0 -0
- /package/react/dist/{recipes → blocks}/market-row.d.ts +0 -0
- /package/react/dist/{recipes → blocks}/market-row.js +0 -0
- /package/react/dist/{recipes → blocks}/marketing-hero.d.ts +0 -0
- /package/react/dist/{recipes → blocks}/marketing-hero.js +0 -0
- /package/react/dist/{recipes → blocks}/swap/amount-card.d.ts +0 -0
- /package/react/dist/{recipes → blocks}/swap/amount-card.js +0 -0
- /package/react/dist/{recipes → blocks}/swap/settings.d.ts +0 -0
- /package/react/dist/{recipes → blocks}/swap/settings.js +0 -0
- /package/react/dist/{recipes → blocks}/trade-entry.d.ts +0 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { 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 } from './provider.js';
|
|
6
|
+
import { Surface, Text } from './surface.js';
|
|
7
|
+
import { Button, IconButton } from './button.js';
|
|
8
|
+
import { SegmentedControl } from './radio-group.js';
|
|
9
|
+
import { ChevronIcon, SeverityIcon } from './icons.js';
|
|
10
|
+
import { AnimatedNumberReadout } from './animated-number.js';
|
|
11
|
+
import { formatNumberReadout } from './animated-number-model.js';
|
|
12
|
+
const usd = { style: 'currency', currency: 'USD' };
|
|
13
|
+
const allUnits = ['dollar', 'price', 'percent'];
|
|
14
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
15
|
+
const known = (value) => value != null && Number.isFinite(value);
|
|
16
|
+
/** 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. */
|
|
17
|
+
export function targetFormat(unit, priceOptions = usd, short) {
|
|
18
|
+
if (unit === 'price')
|
|
19
|
+
return priceOptions;
|
|
20
|
+
if (unit === 'percent')
|
|
21
|
+
return { style: 'percent', maximumFractionDigits: 2, signDisplay: 'exceptZero' };
|
|
22
|
+
return { ...usd, signDisplay: 'exceptZero', ...(short !== undefined && Number.isInteger(short) ? { maximumFractionDigits: 0 } : null) };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 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
|
|
26
|
+
* the stretch (`from` to `to`) between them: the whole bar, from entry to the trigger.
|
|
27
|
+
* Without a trigger there is no stretch.
|
|
28
|
+
*/
|
|
29
|
+
export function targetLayout({ entry, trigger }) {
|
|
30
|
+
const values = {};
|
|
31
|
+
if (known(entry))
|
|
32
|
+
values.entry = entry;
|
|
33
|
+
if (known(trigger))
|
|
34
|
+
values.trigger = trigger;
|
|
35
|
+
const kinds = Object.keys(values), prices = kinds.map(kind => values[kind]);
|
|
36
|
+
if (!kinds.length)
|
|
37
|
+
return { positions: {}, order: [], from: 0.5, to: 0.5 };
|
|
38
|
+
const low = Math.min(...prices), span = Math.max(...prices) - low;
|
|
39
|
+
const positions = {};
|
|
40
|
+
for (const kind of kinds)
|
|
41
|
+
positions[kind] = span > 0 ? (values[kind] - low) / span : 0.5;
|
|
42
|
+
const rank = { entry: 0, trigger: 1 };
|
|
43
|
+
const order = [...kinds].sort((a, b) => values[a] - values[b] || rank[a] - rank[b]);
|
|
44
|
+
const start = positions.entry, end = positions.trigger;
|
|
45
|
+
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) };
|
|
46
|
+
}
|
|
47
|
+
/** 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. */
|
|
48
|
+
export function TargetBlock({ kind, labels, position, orderType, note, entry, trigger, unit, units = allUnits, onUnitChange, value, onValueChange, presets = [], onCustom, priceOptions = usd, surface = false, onSubmit, submitDisabled, busy, onCancel, onBack, headerAction, testID }) {
|
|
49
|
+
const PriceCard = surface ? Surface : View;
|
|
50
|
+
const colors = useColors(), fills = useFills(), t = useMessages(), { direction, locale } = useHIG();
|
|
51
|
+
const [open, setOpen] = useState(false);
|
|
52
|
+
const info = note && labels.info && !headerAction ? labels.info : undefined;
|
|
53
|
+
const target = trigger !== undefined ? trigger : unit === 'price' ? value : null;
|
|
54
|
+
const { positions, order, from, to } = targetLayout({ entry, trigger: target });
|
|
55
|
+
const prices = { entry, trigger: target };
|
|
56
|
+
const stop = kind === 'stop-loss', tone = stop ? colors.negative : colors.positive, intent = stop ? 'destructive' : 'primary';
|
|
57
|
+
const triggerLeads = (positions.trigger ?? 0) < (positions.entry ?? 0);
|
|
58
|
+
const align = (index) => order.length > 1 && index === order.length - 1 ? 'flex-end' : order.length === 3 && index === 1 ? 'center' : 'flex-start';
|
|
59
|
+
const part = (grow) => ({ flexGrow: grow, flexShrink: 1, flexBasis: 0, backgroundColor: fills.raised });
|
|
60
|
+
return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsxs(View, { testID: 'target-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: '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', 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: 44, alignItems: 'flex-end' }, children: info ? _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 }) }) : headerAction })] }), _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, 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: units.map(option => ({ value: option, label: labels.units[option] })), value: unit, onValueChange: next => onUnitChange?.(next) }) }) : null, onCustom ? _jsxs(Pressable, { testID: 'target-custom', accessibilityRole: 'button', 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, presets.length > 0 ? _jsx(View, { testID: 'target-presets', style: { direction, flexDirection: 'row', gap: 8, marginTop: 16 }, children: presets.map(preset => _jsx(Button, { testID: `target-preset-${preset}`, intent: preset === value ? intent : 'secondary', accessibilityState: { selected: preset === value }, onPress: () => onValueChange?.(preset), style: { flex: 1, alignSelf: 'auto', paddingHorizontal: 8 }, children: formatNumber(preset, locale, 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: 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 })] })] });
|
|
61
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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 } 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. */
|
|
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
|
+
/** Where the token is held: Staked, Core, Paper. */
|
|
24
|
+
assets: readonly BarMarkElement[];
|
|
25
|
+
/** The chains the token sits on. */
|
|
26
|
+
chains: readonly BarMarkElement[];
|
|
27
|
+
/** Title of the chains bar. Defaults to the built-in "Chains". */
|
|
28
|
+
chainsTitle?: string;
|
|
29
|
+
actions: readonly TokenAction[];
|
|
30
|
+
/** Shows Back on the leading edge of the header. */
|
|
31
|
+
onBack?: () => void;
|
|
32
|
+
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
33
|
+
headerAction?: React.ReactNode;
|
|
34
|
+
testID?: string;
|
|
35
|
+
}
|
|
36
|
+
/** An action's text: its own `label`, else the built-in name of its id, else the id. */
|
|
37
|
+
export declare const tokenActionLabel: (action: TokenAction, messages: Partial<HIGMessages>) => string;
|
|
38
|
+
/** One token as a screen: a header, where it is held, which chains it sits on, then what the user can do with it. */
|
|
39
|
+
export declare function TokenActionBlock({ symbol, name, value, assets, chains, chainsTitle, actions, onBack, headerAction, testID }: TokenActionBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 * as en from '@bloxwap/hig/contracts/messages';
|
|
5
|
+
import { useColors, useHIG, useMessages } from './provider.js';
|
|
6
|
+
import { Text } from './surface.js';
|
|
7
|
+
import { Button, IconButton } from './button.js';
|
|
8
|
+
import { ChevronIcon } from './icons.js';
|
|
9
|
+
import { AnimatedNumberReadout } from './animated-number.js';
|
|
10
|
+
import { BarMark } from './bar-mark.js';
|
|
11
|
+
const usd = { style: 'currency', currency: 'USD' };
|
|
12
|
+
const held = (value) => Number.isFinite(value) && value > 0;
|
|
13
|
+
/** An action's text: its own `label`, else the built-in name of its id, else the id. */
|
|
14
|
+
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);
|
|
15
|
+
/** One token as a screen: a header, where it is held, which chains it sits on, then what the user can do with it. */
|
|
16
|
+
export function TokenActionBlock({ symbol, name, value, assets, chains, chainsTitle, actions, onBack, headerAction, testID }) {
|
|
17
|
+
const colors = useColors(), t = useMessages(), { direction, locale } = useHIG();
|
|
18
|
+
const total = value !== undefined ? value : assets.reduce((sum, asset) => sum + (held(asset.value) ? asset.value : 0), 0);
|
|
19
|
+
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 })] }), _jsxs(View, { testID: 'token-bars', style: { gap: 20, marginTop: 16, paddingHorizontal: 4 }, children: [_jsx(BarMark, { testID: 'token-assets', surface: false, title: name, elements: assets, description: _jsx(AnimatedNumberReadout, { value: total, options: usd, tone: 'muted', testID: 'token-value', style: { fontSize: 14, lineHeight: 21 } }) }), _jsx(BarMark, { testID: 'token-chains', surface: false, title: chainsTitle ?? t.swapChains, elements: chains, description: formatNumber(chains.filter(chain => held(chain.value)).length, locale) })] }), 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] });
|
|
20
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AssetArtwork } from './asset-balance-row.js';
|
|
3
|
+
export type { AssetArtwork } from './asset-balance-row.js';
|
|
4
|
+
/** The trading words of the block. HIG's built-in strings hold no trading terms, so the host supplies them, translated. */
|
|
5
|
+
export interface TradeHistoryDetailLabels {
|
|
6
|
+
title: string;
|
|
7
|
+
/** 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. */
|
|
8
|
+
netPnl: string;
|
|
9
|
+
/** Names of the two prices under the bar. Needed with `entry` and `exit`. */
|
|
10
|
+
entry?: string;
|
|
11
|
+
exit?: string;
|
|
12
|
+
/** `+2.84% on margin`: receives the formatted percent. */
|
|
13
|
+
onMargin: (percent: string) => string;
|
|
14
|
+
long: string;
|
|
15
|
+
short: string;
|
|
16
|
+
}
|
|
17
|
+
/** 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. */
|
|
18
|
+
export interface TradeHistoryDetail {
|
|
19
|
+
label: string;
|
|
20
|
+
value: string | number;
|
|
21
|
+
options?: Intl.NumberFormatOptions;
|
|
22
|
+
prefix?: string;
|
|
23
|
+
suffix?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface TradeHistoryAction {
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
onSelect: () => void;
|
|
29
|
+
intent?: 'primary' | 'secondary';
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
busy?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface TradeHistoryDetailBlockProps {
|
|
34
|
+
labels: TradeHistoryDetailLabels;
|
|
35
|
+
/** Asset name: Amazon. */
|
|
36
|
+
name: string;
|
|
37
|
+
icon?: AssetArtwork;
|
|
38
|
+
side: 'long' | 'short';
|
|
39
|
+
/** 20 reads `20×`. */
|
|
40
|
+
leverage?: number;
|
|
41
|
+
/** Net profit and loss in dollars. `null` reads as unknown. */
|
|
42
|
+
pnl: number | null;
|
|
43
|
+
/** Return on margin as a fraction: 0.0284 reads +2.84%. */
|
|
44
|
+
pnlPercent?: number | null;
|
|
45
|
+
/** 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. */
|
|
46
|
+
entry?: number;
|
|
47
|
+
exit?: number;
|
|
48
|
+
/** Format of the two prices. Defaults to US dollars. */
|
|
49
|
+
priceOptions?: Intl.NumberFormatOptions;
|
|
50
|
+
details: readonly TradeHistoryDetail[];
|
|
51
|
+
actions?: readonly TradeHistoryAction[];
|
|
52
|
+
/** Shows Back on the leading edge of the header. */
|
|
53
|
+
onBack?: () => void;
|
|
54
|
+
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
55
|
+
headerAction?: React.ReactNode;
|
|
56
|
+
testID?: string;
|
|
57
|
+
}
|
|
58
|
+
/** 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. */
|
|
59
|
+
export declare function TradeHistoryDetailBlock({ labels, name, icon, side, leverage, pnl, pnlPercent, entry, exit, priceOptions, details, actions, onBack, headerAction, testID }: TradeHistoryDetailBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Image, View } from 'react-native';
|
|
3
|
+
import { useColors, useFills, useHIG, useMessages } from './provider.js';
|
|
4
|
+
import { Text } from './surface.js';
|
|
5
|
+
import { BarPnl } from './bar-pnl.js';
|
|
6
|
+
import { Button, IconButton } from './button.js';
|
|
7
|
+
import { ChevronIcon } from './icons.js';
|
|
8
|
+
import { AnimatedNumberReadout } from './animated-number.js';
|
|
9
|
+
import { formatNumberReadout } from './animated-number-model.js';
|
|
10
|
+
const pnlUsd = { style: 'currency', currency: 'USD', signDisplay: 'exceptZero', maximumFractionDigits: 4 };
|
|
11
|
+
const pnlShare = { style: 'percent', minimumFractionDigits: 2, maximumFractionDigits: 2, signDisplay: 'exceptZero' };
|
|
12
|
+
const gearing = { maximumFractionDigits: 6 };
|
|
13
|
+
const numberMark = '', unknown = '—', times = '×', up = '↑', down = '↓';
|
|
14
|
+
const avatar = 24, empty = '';
|
|
15
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
16
|
+
const known = (value) => value != null && Number.isFinite(value);
|
|
17
|
+
/** 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. */
|
|
18
|
+
function Sentence({ template, text, value, options, tone, testID }) {
|
|
19
|
+
const colors = useColors(), { direction } = useHIG();
|
|
20
|
+
const type = { fontSize: 14, lineHeight: 21 }, words = { ...type, color: colors[tone] };
|
|
21
|
+
const reading = template(text), parts = template(numberMark).split(numberMark);
|
|
22
|
+
if (value === null || parts.length !== 2)
|
|
23
|
+
return _jsx(Text, { testID: testID, style: { ...words, textAlign: 'center' }, children: reading });
|
|
24
|
+
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] });
|
|
25
|
+
}
|
|
26
|
+
/** 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. */
|
|
27
|
+
export function TradeHistoryDetailBlock({ labels, name, icon, side, leverage, pnl, pnlPercent, entry, exit, priceOptions, details, actions = [], onBack, headerAction, testID }) {
|
|
28
|
+
const colors = useColors(), fills = useFills(), t = useMessages(), { direction, locale } = useHIG();
|
|
29
|
+
const long = side === 'long', word = long ? labels.long : labels.short, tint = long ? colors.up : colors.down;
|
|
30
|
+
const tone = known(pnl) && pnl > 0 ? 'up' : known(pnl) && pnl < 0 ? 'down' : 'text';
|
|
31
|
+
const turns = known(leverage) ? formatNumberReadout(leverage, locale, gearing).text + times : null;
|
|
32
|
+
const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
|
|
33
|
+
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: name.slice(0, 3) }) });
|
|
34
|
+
const meta = { fontSize: 14, lineHeight: 20 };
|
|
35
|
+
// Three figures to a line: a small label over its value.
|
|
36
|
+
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, 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));
|
|
37
|
+
return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsxs(View, { testID: 'trade-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: 'trade-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'trade-title', 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: 44, alignItems: 'flex-end' }, children: headerAction })] }), _jsxs(View, { testID: 'trade-asset', accessible: true, accessibilityLabel: [name, word, turns].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] }) })] }), _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: pnlUsd, 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, pnlShare).text : unknown, value: known(pnlPercent) ? pnlPercent : null, options: pnlShare, 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, 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] });
|
|
38
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { AssetArtwork } from './asset-balance-row.js';
|
|
3
|
+
/** The words of the block. They are trading terms, so the host supplies them; HIG ships none. */
|
|
4
|
+
export interface TradeHistoryListLabels {
|
|
5
|
+
/** Heading of the screen: History. */
|
|
6
|
+
title: string;
|
|
7
|
+
long: string;
|
|
8
|
+
short: string;
|
|
9
|
+
/** Shown in place of the rows when there are no trades. */
|
|
10
|
+
empty: string;
|
|
11
|
+
}
|
|
12
|
+
/** One closed trade. */
|
|
13
|
+
export interface TradeHistoryItem {
|
|
14
|
+
id: string;
|
|
15
|
+
/** Asset name: Amazon. */
|
|
16
|
+
name: string;
|
|
17
|
+
/** Round artwork: an image URL or a host element. Without it the row shows the first letters of the name. */
|
|
18
|
+
icon?: AssetArtwork;
|
|
19
|
+
side: 'long' | 'short';
|
|
20
|
+
/** 20 reads `20×`. */
|
|
21
|
+
leverage?: number;
|
|
22
|
+
/** Net profit and loss in dollars. `null` reads as unknown. */
|
|
23
|
+
pnl: number | null;
|
|
24
|
+
/** Host-formatted age or time of the close, shown under the result: `2d`. */
|
|
25
|
+
time?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface TradeHistoryListBlockProps {
|
|
28
|
+
labels: TradeHistoryListLabels;
|
|
29
|
+
/** Closed trades, in the order shown. The host sorts and pages them. */
|
|
30
|
+
trades: readonly TradeHistoryItem[];
|
|
31
|
+
/** Makes each row a button that reports its trade, usually to open its detail, and shows the disclosure chevron. */
|
|
32
|
+
onSelect?: (trade: TradeHistoryItem) => void;
|
|
33
|
+
/** Shows Back on the leading edge of the header. */
|
|
34
|
+
onBack?: () => void;
|
|
35
|
+
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
36
|
+
headerAction?: React.ReactNode;
|
|
37
|
+
/** Format of the result. Defaults to signed US dollars at four significant digits: `+$1.412`, `+$17.90`, `-$0.6878`. */
|
|
38
|
+
pnlOptions?: Intl.NumberFormatOptions;
|
|
39
|
+
testID?: string;
|
|
40
|
+
}
|
|
41
|
+
/** How a row reads its side: `Short 20×`, or `Short` without leverage. */
|
|
42
|
+
export declare const tradeHistorySide: (trade: Pick<TradeHistoryItem, 'side' | 'leverage'>, labels: Pick<TradeHistoryListLabels, 'long' | 'short'>, locale?: string) => string;
|
|
43
|
+
/** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the direction colour, and the net result in the result colour over its age. */
|
|
44
|
+
export declare function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions, testID }: TradeHistoryListBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,29 @@
|
|
|
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, useMessages } from './provider.js';
|
|
5
|
+
import { Text } from './surface.js';
|
|
6
|
+
import { IconButton } from './button.js';
|
|
7
|
+
import { ChevronIcon } from './icons.js';
|
|
8
|
+
import { AnimatedNumberReadout } from './animated-number.js';
|
|
9
|
+
const pnlFormat = { style: 'currency', currency: 'USD', signDisplay: 'exceptZero', minimumSignificantDigits: 4, maximumSignificantDigits: 4 };
|
|
10
|
+
/** How a row reads its side: `Short 20×`, or `Short` without leverage. */
|
|
11
|
+
export const tradeHistorySide = (trade, labels, locale) => `${trade.side === 'long' ? labels.long : labels.short}${trade.leverage != null ? ` ${formatNumber(trade.leverage, locale)}×` : ''}`;
|
|
12
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
13
|
+
const avatar = 40;
|
|
14
|
+
/** Points up; a short turns it over. */
|
|
15
|
+
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 } })] }); }
|
|
16
|
+
/** A history of closed trades as one screen: a header, then one row per trade with the asset, its side and leverage in the direction colour, and the net result in the result colour over its age. */
|
|
17
|
+
export function TradeHistoryListBlock({ labels, trades, onSelect, onBack, headerAction, pnlOptions = pnlFormat, testID }) {
|
|
18
|
+
const colors = useColors(), fills = useFills(), t = useMessages(), { direction, locale } = useHIG();
|
|
19
|
+
const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
|
|
20
|
+
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 });
|
|
21
|
+
return _jsxs(View, { testID: testID, style: { direction, padding: 16, gap: 16 }, children: [_jsxs(View, { 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: testID ? `${testID}-back` : undefined, onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: testID ? `${testID}-title` : undefined, 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: 44, alignItems: 'flex-end' }, children: headerAction })] }), trades.length === 0 ? _jsx(Text, { testID: testID ? `${testID}-empty` : undefined, style: { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 20, color: colors.muted }, children: labels.empty }) :
|
|
22
|
+
_jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { gap: 8 }, children: trades.map(trade => {
|
|
23
|
+
const side = colors[trade.side === 'long' ? 'positive' : 'negative'];
|
|
24
|
+
const reading = [trade.name, tradeHistorySide(trade, labels, locale), formatNumber(trade.pnl, locale, pnlOptions), trade.time].filter(Boolean).join(', ');
|
|
25
|
+
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.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] })] }), _jsxs(View, { ...hidden, style: { alignItems: 'flex-end', justifyContent: 'center' }, children: [_jsx(AnimatedNumberReadout, { value: trade.pnl, options: pnlOptions, tone: trade.pnl == null || trade.pnl === 0 ? 'text' : trade.pnl > 0 ? 'positive' : 'negative', testID: testID ? `${testID}-${trade.id}-pnl` : undefined, style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }), trade.time ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: trade.time }) : null] })] });
|
|
26
|
+
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)
|
|
27
|
+
: _jsx(View, { testID: testID ? `${testID}-${trade.id}` : undefined, accessible: true, accessibilityLabel: reading, style: row(false), children: content }, trade.id);
|
|
28
|
+
}) })] });
|
|
29
|
+
}
|
package/native-fonts/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/native-fonts
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.6.0, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
|
|
4
4
|
|
|
5
5
|
Web hosts never import this entry: load fonts through `@bloxwap/font` and use `@bloxwap/hig/tokens/css`. Open Graph card renderers (Satori, `next/og`) use the much smaller `@bloxwap/hig/og-fonts` entry instead (#99).
|
|
6
6
|
|
package/og-fonts/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/og-fonts
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.6.0, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
|
|
4
4
|
|
|
5
5
|
| Face | File | Weight |
|
|
6
6
|
| --- | --- | --- |
|