@bloxwap/hig 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/chart/README.md +1 -1
- package/contracts/README.md +1 -1
- package/contracts/dist/index.d.ts +16 -0
- package/contracts/dist/index.js +22 -0
- package/contracts/dist/messages.d.ts +37 -4
- package/contracts/dist/messages.js +13 -2
- package/feedback/README.md +1 -1
- package/native/README.md +1 -1
- package/native/dist/account-block.d.ts +92 -0
- package/native/dist/account-block.js +61 -0
- package/native/dist/animated-number-model.d.ts +7 -1
- package/native/dist/animated-number-model.js +50 -1
- package/native/dist/animated-number.d.ts +3 -1
- package/native/dist/animated-number.js +8 -5
- package/native/dist/asset-balance-row.d.ts +36 -0
- package/native/dist/asset-balance-row.js +26 -0
- package/native/dist/bar-mark.d.ts +57 -0
- package/native/dist/bar-mark.js +48 -0
- package/native/dist/bar-pnl.d.ts +50 -0
- package/native/dist/bar-pnl.js +60 -0
- package/native/dist/blocks.d.ts +38 -0
- package/native/dist/blocks.js +42 -0
- package/native/dist/button.js +3 -1
- package/native/dist/data.d.ts +1 -1
- package/native/dist/data.js +6 -4
- package/native/dist/field.d.ts +14 -5
- package/native/dist/field.js +33 -8
- package/native/dist/figure.d.ts +23 -0
- package/native/dist/figure.js +10 -0
- package/native/dist/icons.d.ts +8 -0
- package/native/dist/icons.js +4 -0
- package/native/dist/language-block.d.ts +35 -0
- package/native/dist/language-block.js +30 -0
- package/native/dist/list-group.d.ts +60 -0
- package/native/dist/list-group.js +85 -0
- package/native/dist/manage-position-block.d.ts +95 -0
- package/native/dist/manage-position-block.js +82 -0
- package/native/dist/market-row.d.ts +46 -0
- package/native/dist/market-row.js +30 -0
- package/native/dist/notifications-block.d.ts +53 -0
- package/native/dist/notifications-block.js +22 -0
- package/native/dist/pickers.d.ts +35 -5
- package/native/dist/pickers.js +21 -9
- package/native/dist/position-block.d.ts +107 -0
- package/native/dist/position-block.js +55 -0
- package/native/dist/profile-block.d.ts +66 -0
- package/native/dist/profile-block.js +48 -0
- package/native/dist/provider.d.ts +9 -3
- package/native/dist/provider.js +7 -3
- package/native/dist/radio-group.d.ts +9 -3
- package/native/dist/radio-group.js +4 -5
- package/native/dist/recipes.d.ts +6 -46
- package/native/dist/recipes.js +6 -33
- package/native/dist/reward-block.d.ts +122 -0
- package/native/dist/reward-block.js +53 -0
- package/native/dist/screen-header.d.ts +49 -0
- package/native/dist/screen-header.js +29 -0
- package/native/dist/selection.d.ts +2 -2
- package/native/dist/setting-header.d.ts +2 -0
- package/native/dist/setting-header.js +2 -0
- package/native/dist/setting-switch.d.ts +31 -0
- package/native/dist/setting-switch.js +20 -0
- package/native/dist/signals-block.d.ts +61 -0
- package/native/dist/signals-block.js +26 -0
- package/native/dist/sound-haptics-block.d.ts +66 -0
- package/native/dist/sound-haptics-block.js +32 -0
- package/native/dist/status.d.ts +6 -5
- package/native/dist/status.js +5 -5
- package/native/dist/sticky-header.d.ts +28 -0
- package/native/dist/sticky-header.js +21 -0
- package/native/dist/surface.d.ts +3 -1
- package/native/dist/surface.js +2 -1
- package/native/dist/{swap-panel.d.ts → swap-panel-block.d.ts} +8 -3
- package/native/dist/{swap-panel.js → swap-panel-block.js} +13 -8
- package/native/dist/swap-parts.d.ts +5 -3
- package/native/dist/swap-parts.js +2 -2
- package/native/dist/swap-shared.d.ts +6 -0
- 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 +9 -7
- package/native/dist/switch-row.d.ts +3 -2
- package/native/dist/switch-row.js +5 -3
- package/native/dist/switch.d.ts +4 -2
- package/native/dist/switch.js +3 -3
- package/native/dist/target-block.d.ts +110 -0
- package/native/dist/target-block.js +74 -0
- package/native/dist/token-action-block.d.ts +47 -0
- package/native/dist/token-action-block.js +28 -0
- package/native/dist/trade-history-detail-block.d.ts +84 -0
- package/native/dist/trade-history-detail-block.js +46 -0
- package/native/dist/trade-history-list-block.d.ts +110 -0
- package/native/dist/trade-history-list-block.js +64 -0
- package/native/dist/wallet-address-core.d.ts +25 -0
- package/native/dist/wallet-address-core.js +31 -0
- package/native/dist/wallet-address.d.ts +6 -10
- package/native/dist/wallet-address.js +16 -20
- package/native-fonts/README.md +1 -1
- package/og-fonts/README.md +1 -1
- package/package.json +266 -41
- package/react/README.md +1 -1
- package/react/dist/animated-number-model.d.ts +6 -0
- package/react/dist/animated-number-model.js +33 -0
- package/react/dist/animated-number.d.ts +5 -1
- package/react/dist/animated-number.js +12 -8
- package/react/dist/asset-balance-row.d.ts +35 -0
- package/react/dist/asset-balance-row.js +18 -0
- package/react/dist/bar-mark.d.ts +38 -0
- package/react/dist/bar-mark.js +23 -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 +92 -0
- package/react/dist/blocks/account-block.js +62 -0
- package/react/dist/blocks/language-block.d.ts +36 -0
- package/react/dist/blocks/language-block.js +52 -0
- package/react/dist/blocks/manage-position-block.d.ts +93 -0
- package/react/dist/blocks/manage-position-block.js +47 -0
- package/react/dist/blocks/market-row.d.ts +36 -0
- package/react/dist/blocks/market-row.js +16 -0
- package/react/dist/blocks/notifications-block.d.ts +46 -0
- package/react/dist/blocks/notifications-block.js +17 -0
- package/react/dist/{recipes → blocks}/pickers.d.ts +32 -4
- package/react/dist/{recipes → blocks}/pickers.js +35 -11
- package/react/dist/blocks/position-block.d.ts +72 -0
- package/react/dist/blocks/position-block.js +25 -0
- package/react/dist/blocks/profile-block.d.ts +71 -0
- package/react/dist/blocks/profile-block.js +41 -0
- package/react/dist/blocks/reward-block.d.ts +120 -0
- package/react/dist/blocks/reward-block.js +34 -0
- package/react/dist/blocks/screen-header.d.ts +33 -0
- package/react/dist/blocks/screen-header.js +20 -0
- package/react/dist/blocks/setting-switch.d.ts +23 -0
- package/react/dist/blocks/setting-switch.js +12 -0
- package/react/dist/blocks/signals-block.d.ts +54 -0
- package/react/dist/blocks/signals-block.js +15 -0
- package/react/dist/blocks/sound-haptics-block.d.ts +59 -0
- package/react/dist/blocks/sound-haptics-block.js +22 -0
- package/react/dist/blocks/sticky-header.d.ts +9 -0
- package/react/dist/blocks/sticky-header.js +43 -0
- package/react/dist/blocks/swap/amount-card.js +8 -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/settings.js +2 -2
- package/react/dist/{recipes → blocks}/swap/shared.d.ts +8 -1
- package/react/dist/{recipes → blocks}/swap/shared.js +7 -4
- package/react/dist/{recipes/swap-panel.d.ts → blocks/swap-panel-block.d.ts} +8 -2
- package/react/dist/{recipes/swap-panel.js → blocks/swap-panel-block.js} +9 -7
- 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 +103 -0
- package/react/dist/blocks/target-block.js +73 -0
- package/react/dist/blocks/token-action-block.d.ts +46 -0
- package/react/dist/blocks/token-action-block.js +21 -0
- package/react/dist/{recipes → blocks}/trade-entry.js +2 -2
- package/react/dist/blocks/trade-history-detail-block.d.ts +78 -0
- package/react/dist/blocks/trade-history-detail-block.js +17 -0
- package/react/dist/blocks/trade-history-list-block.d.ts +67 -0
- package/react/dist/blocks/trade-history-list-block.js +28 -0
- package/react/dist/blocks.d.ts +20 -0
- package/react/dist/blocks.js +21 -0
- package/react/dist/button.js +6 -4
- package/react/dist/data.js +3 -3
- package/react/dist/field.d.ts +14 -6
- package/react/dist/field.js +19 -8
- package/react/dist/figure.d.ts +23 -0
- package/react/dist/figure.js +12 -0
- package/react/dist/list-group.d.ts +59 -0
- package/react/dist/list-group.js +52 -0
- package/react/dist/provider.d.ts +40 -3
- package/react/dist/provider.js +63 -6
- package/react/dist/selection.d.ts +8 -2
- package/react/dist/selection.js +11 -6
- package/react/dist/styles.css +425 -5
- package/react/dist/surface.d.ts +5 -1
- package/react/dist/surface.js +1 -1
- package/react/dist/wallet-address-core.d.ts +23 -0
- package/react/dist/wallet-address-core.js +24 -0
- package/react/dist/wallet-address.d.ts +6 -12
- package/react/dist/wallet-address.js +5 -16
- package/tokens/README.md +1 -1
- 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/market-row.d.ts +0 -25
- package/react/dist/recipes/market-row.js +0 -8
- package/react/dist/recipes/swap/amount-card.js +0 -7
- 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}/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/settings.d.ts +0 -0
- /package/react/dist/{recipes → blocks}/trade-entry.d.ts +0 -0
package/native/dist/pickers.js
CHANGED
|
@@ -4,24 +4,29 @@ import { FlatList, Pressable, View, useWindowDimensions } from 'react-native';
|
|
|
4
4
|
import { useColors, useFills, useHIG, useMessages } from './provider.js';
|
|
5
5
|
import { Text } from './surface.js';
|
|
6
6
|
import { Button, IconButton } from './button.js';
|
|
7
|
-
import { Input, SearchInput } from './field.js';
|
|
7
|
+
import { Field, Input, SearchInput } from './field.js';
|
|
8
8
|
import { Filter } from './radio-group.js';
|
|
9
9
|
import { AnimatedNumberReadout } from './animated-number.js';
|
|
10
10
|
import { SwitchRow } from './switch-row.js';
|
|
11
11
|
import { LeaveIcon, LockIcon, ScanIcon, SwapHostContext, TokenIcon, WalletIcon } from './swap-parts.js';
|
|
12
12
|
import { addressColor, pickerRows, shortAddress } from './swap-shared.js';
|
|
13
|
+
/** The list component (and height animation) a sheet hands to the pickers it holds; `listComponent` on a picker block does the same for one block. */
|
|
14
|
+
export { SwapHostContext } from './swap-parts.js';
|
|
13
15
|
/** Chains present in a token list, in first-seen order. */
|
|
14
16
|
function chainsOf(tokens) { const seen = new Map(); for (const token of tokens)
|
|
15
17
|
if (!seen.has(token.chainId))
|
|
16
18
|
seen.set(token.chainId, { chainId: token.chainId, name: token.chain, icon: typeof token.chainIcon === 'string' ? token.chainIcon : undefined }); return [...seen.values()]; }
|
|
17
|
-
|
|
19
|
+
/** A row shows a known balance above zero, or a zero one when the host asks for it. */
|
|
20
|
+
const showBalance = (token, zero) => token.balance != null && Number.isFinite(token.balance) && (token.balance > 0 || (!!zero && token.balance === 0));
|
|
21
|
+
function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected = null, onSelect, loading, search = true, zeroBalances, searchLabel, searchRef, searchInputProps, listComponent, side, title }) {
|
|
18
22
|
const { direction } = useHIG();
|
|
19
23
|
const colors = useColors();
|
|
20
24
|
const fills = useFills();
|
|
21
25
|
const t = useMessages();
|
|
22
26
|
const window = useWindowDimensions();
|
|
23
|
-
// A sheet passes its backend's list through the host context so drags hand off to the sheet.
|
|
24
|
-
const
|
|
27
|
+
// A sheet passes its backend's list, through the prop or the host context, so drags hand off to the sheet.
|
|
28
|
+
const host = useContext(SwapHostContext).listComponent;
|
|
29
|
+
const List = listComponent ?? host ?? FlatList;
|
|
25
30
|
const [query, setQuery] = useState('');
|
|
26
31
|
const [chain, pickChain] = useState('');
|
|
27
32
|
const options = useMemo(() => chains ?? chainsOf(tokens), [chains, tokens]);
|
|
@@ -31,9 +36,11 @@ function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected =
|
|
|
31
36
|
const section = (heading) => _jsx(Text, { accessibilityRole: 'header', style: { paddingHorizontal: 8, paddingTop: 12, paddingBottom: 6, fontSize: 12, lineHeight: 18, fontWeight: '600', letterSpacing: 1, textTransform: 'uppercase', color: colors.muted }, children: heading });
|
|
32
37
|
const chainOptions = useMemo(() => [{ value: '', label: t.swapAllChains }, ...options.map(item => ({ value: String(item.chainId), label: item.name, icon: item.icon }))], [options, t.swapAllChains]);
|
|
33
38
|
const empty = _jsx(Text, { accessibilityLiveRegion: 'polite', testID: `swap-empty-${side}`, style: { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 21, color: colors.muted }, children: loading ? `${t.loading}…` : t.swapNoTokens });
|
|
34
|
-
|
|
39
|
+
// A visible label names the field through the Field context instead of the built-in name.
|
|
40
|
+
const field = _jsx(SearchInput, { ref: searchRef, accessibilityLabel: searchLabel ? undefined : t.swapSearchTokens, placeholder: t.swapSearchTokens, testID: `swap-search-${side}`, autoCapitalize: 'none', autoCorrect: false, autoComplete: 'off', spellCheck: false, ...searchInputProps, value: query, onChangeText: setQuery });
|
|
41
|
+
return _jsxs(_Fragment, { children: [search ? searchLabel ? _jsx(Field, { label: searchLabel, children: field }) : field : null, chainFilter && options.length > 1 ? _jsx(Filter, { label: t.swapChains, options: chainOptions, value: chain, onValueChange: pickChain }) : null, _jsx(List, { style: { height: Math.max(240, Math.round(window.height * 0.5)) }, data: rows, keyExtractor: token => token.id, keyboardShouldPersistTaps: 'handled', accessibilityLabel: title, testID: `swap-list-${side}`, initialNumToRender: 12, ListEmptyComponent: empty, renderItem: ({ item: token, index }) => {
|
|
35
42
|
const isSelected = selected?.id === token.id, balance = token.balance ?? 0, price = token.price ?? 0;
|
|
36
|
-
return _jsxs(View, { children: [hotCount > 0 && index === 0 ? section(t.swapHot) : null, hotCount > 0 && index === hotCount ? section(t.swapAllTokens) : null, _jsxs(Pressable, { accessibilityRole: 'button', accessibilityState: { selected: isSelected }, testID: `swap-token-${token.id}`, onPress: () => onSelect(token), style: ({ pressed }) => ({ direction, flexDirection: 'row', alignItems: 'center', gap: 12, marginBottom: 4, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 9999, backgroundColor: pressed ? fills.well : 'transparent', opacity: isSelected ? 0.5 : 1 }), children: [_jsx(TokenIcon, { token: token }), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: token.name }), _jsxs(Text, { style: { fontSize: 14, lineHeight: 21, color: colors.muted }, children: [token.chain, isSelected ? ` · ${t.swapSelected}` : ''] })] }),
|
|
43
|
+
return _jsxs(View, { children: [hotCount > 0 && index === 0 ? section(t.swapHot) : null, hotCount > 0 && index === hotCount ? section(t.swapAllTokens) : null, _jsxs(Pressable, { accessibilityRole: 'button', accessibilityState: { selected: isSelected }, testID: `swap-token-${token.id}`, onPress: () => onSelect(token), style: ({ pressed }) => ({ direction, flexDirection: 'row', alignItems: 'center', gap: 12, marginBottom: 4, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 9999, backgroundColor: pressed ? fills.well : 'transparent', opacity: isSelected ? 0.5 : 1 }), children: [_jsx(TokenIcon, { token: token }), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: token.name }), _jsxs(Text, { style: { fontSize: 14, lineHeight: 21, color: colors.muted }, children: [token.detail ?? token.chain, isSelected ? ` · ${t.swapSelected}` : ''] })] }), showBalance(token, zeroBalances) ? _jsxs(View, { style: { alignItems: 'flex-end' }, children: [_jsx(AnimatedNumberReadout, { testID: `swap-token-balance-${token.id}`, value: balance, options: { maximumFractionDigits: 6 }, suffix: token.unitsSuffix, style: { fontWeight: '600', textAlign: 'right' } }), price > 0 ? _jsx(AnimatedNumberReadout, { testID: `swap-token-value-${token.id}`, value: balance * price, options: { style: 'currency', currency: 'USD' }, tone: 'muted', style: { fontSize: 14, lineHeight: 21, textAlign: 'right' } }) : null] }) : null] })] });
|
|
37
44
|
} })] });
|
|
38
45
|
}
|
|
39
46
|
/**
|
|
@@ -41,7 +48,7 @@ function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected =
|
|
|
41
48
|
* the tokens it holds (or a whitelist). With no wallet it offers Connect wallet and a Generate address switch above the list.
|
|
42
49
|
* The host owns the wallet, the token data and the generated address.
|
|
43
50
|
*/
|
|
44
|
-
export function
|
|
51
|
+
export function FromPickerBlock({ wallet, onConnect, onDisconnect, generateAddress = false, onGenerateAddressChange, style, ...list }) {
|
|
45
52
|
const colors = useColors();
|
|
46
53
|
const fills = useFills();
|
|
47
54
|
const t = useMessages();
|
|
@@ -53,8 +60,13 @@ export function FromPicker({ wallet, onConnect, onDisconnect, generateAddress =
|
|
|
53
60
|
* Where the assets go. On its own it is a destination address field with a scan button. With `tokens` it adds the
|
|
54
61
|
* searchable token list, with the chain filter or, with `chainFilter={false}`, without it.
|
|
55
62
|
*/
|
|
56
|
-
export function
|
|
63
|
+
export function ToPickerBlock({ address, onAddressChange, addressPlaceholder, onScan, addressLabel, addressRef, addressInputProps, style, tokens, onSelect, ...list }) {
|
|
57
64
|
const colors = useColors();
|
|
58
65
|
const t = useMessages();
|
|
59
|
-
|
|
66
|
+
const row = onAddressChange ? _jsxs(View, { testID: 'picker-address-row', style: { flexDirection: 'row', alignItems: 'center', gap: 8 }, children: [_jsx(View, { style: { flex: 1 }, children: _jsx(Input, { ref: addressRef, accessibilityLabel: addressLabel ? undefined : t.swapRecipient, placeholder: addressPlaceholder ?? t.swapRecipient, testID: 'picker-address', autoCapitalize: 'none', autoCorrect: false, autoComplete: 'off', spellCheck: false, ...addressInputProps, value: address ?? '', onChangeText: onAddressChange }) }), onScan ? _jsx(IconButton, { intent: 'secondary', label: t.swapScan, testID: 'picker-scan', onPress: onScan, style: { minWidth: 48, minHeight: 48 }, children: _jsx(ScanIcon, { color: colors.text }) }) : null] }) : null;
|
|
67
|
+
return _jsxs(View, { accessibilityLabel: t.swapTo, testID: 'to-picker', style: [{ gap: 16 }, style], children: [row && addressLabel ? _jsx(Field, { label: addressLabel, children: row }) : row, tokens && onSelect ? _jsx(TokenList, { ...list, tokens: tokens, onSelect: onSelect, side: 'to', title: t.swapTo }) : null] });
|
|
60
68
|
}
|
|
69
|
+
/** @deprecated Renamed `FromPickerBlock`. The old name keeps working until the next major release. */
|
|
70
|
+
export const FromPicker = FromPickerBlock;
|
|
71
|
+
/** @deprecated Renamed `ToPickerBlock`. The old name keeps working until the next major release. */
|
|
72
|
+
export const ToPicker = ToPickerBlock;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ScrollViewProps, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type ScreenHeaderControlProps } from './screen-header.js';
|
|
4
|
+
import { type Figure } from './figure.js';
|
|
5
|
+
/** A number the host supplies as a number so it updates place by place: `{value:0.53,options:{style:'currency',currency:'USD'}}`, or Leverage as `{value:40,suffix:'×'}`. `null` reads as unknown. `formattedValue` is the host's own text for it, still moving place by place. */
|
|
6
|
+
export type PositionBlockFigure = Figure;
|
|
7
|
+
/** One line of the summary: Notional, Fee, Liquidation. `value` is host text (`2% of profit`) or a live figure. `tone` colours the value; the default is the text colour. */
|
|
8
|
+
export interface PositionBlockDetail {
|
|
9
|
+
id?: string;
|
|
10
|
+
label: string;
|
|
11
|
+
value: string | PositionBlockFigure;
|
|
12
|
+
tone?: 'positive' | 'negative' | 'muted';
|
|
13
|
+
/** Draws the value struck through, for a charge that does not apply, and reads this host text after it: Waived. */
|
|
14
|
+
struck?: string;
|
|
15
|
+
/** Host content right after the label, such as a badge that explains the line. It may be pressable; it is then its own accessibility element. */
|
|
16
|
+
labelAccessory?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** One setting of the position: Size, Leverage, Stop Loss. With `onSelect` the row opens the host's own view and shows a chevron; with `onCheckedChange` the row is a switch. */
|
|
19
|
+
export interface PositionBlockRow {
|
|
20
|
+
id: string;
|
|
21
|
+
label: string;
|
|
22
|
+
/** Host text on the trailing edge, or a live figure that updates place by place. */
|
|
23
|
+
value?: string | PositionBlockFigure;
|
|
24
|
+
onSelect?: () => void;
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** With `onCheckedChange`, the row is a switch named by its label, and the whole row toggles it. */
|
|
27
|
+
checked?: boolean;
|
|
28
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
29
|
+
}
|
|
30
|
+
/** An action on the paper trading row's card, under the switch, such as collecting what the paper position earned. */
|
|
31
|
+
export interface PositionBlockFlagAction {
|
|
32
|
+
label: string;
|
|
33
|
+
onSelect: () => void;
|
|
34
|
+
intent?: 'primary' | 'secondary' | 'destructive';
|
|
35
|
+
busy?: boolean;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
/** The paper trading switch. The host supplies its name, because HIG ships no trading terms. */
|
|
39
|
+
export interface PositionBlockFlag {
|
|
40
|
+
label: string;
|
|
41
|
+
checked: boolean;
|
|
42
|
+
onCheckedChange: (checked: boolean) => void;
|
|
43
|
+
disabled?: boolean;
|
|
44
|
+
/** A button on the row's card, under the switch. */
|
|
45
|
+
action?: PositionBlockFlagAction;
|
|
46
|
+
}
|
|
47
|
+
/** The header of a PositionBlock on its own, for a host scroller that pins it: Back, the title and Close. */
|
|
48
|
+
export interface PositionBlockHeaderProps {
|
|
49
|
+
/** Heading: Position. */
|
|
50
|
+
title: string;
|
|
51
|
+
/** Shows Close on the trailing edge. */
|
|
52
|
+
onClose?: () => void;
|
|
53
|
+
/** Shows Back on the leading edge. */
|
|
54
|
+
onBack?: () => void;
|
|
55
|
+
/** A control on the trailing edge in place of Close. */
|
|
56
|
+
headerAction?: React.ReactNode;
|
|
57
|
+
/** Sets `nativeID` on the title, so a sheet around the pane can name itself with `accessibilityLabelledBy` (Android). */
|
|
58
|
+
headingId?: string;
|
|
59
|
+
/** Style of the header's container, such as padding of the host's scroller. */
|
|
60
|
+
style?: StyleProp<ViewStyle>;
|
|
61
|
+
/** Content has scrolled under the header (`useStickyHeaderScroll().scrolled`): it is transparent while false and takes `stickyHeaderBackground` while true. Omitted, the header draws no fill of its own. */
|
|
62
|
+
scrolled?: boolean;
|
|
63
|
+
/** The fill once `scrolled`. Defaults to the background role. */
|
|
64
|
+
stickyHeaderBackground?: string;
|
|
65
|
+
/** Pressable props for Back, such as `{android_disableSound: true}`. */
|
|
66
|
+
backProps?: ScreenHeaderControlProps;
|
|
67
|
+
/** Pressable props for Close. */
|
|
68
|
+
closeProps?: ScreenHeaderControlProps;
|
|
69
|
+
testID?: string;
|
|
70
|
+
}
|
|
71
|
+
export interface PositionBlockProps {
|
|
72
|
+
/** Heading: Position. */
|
|
73
|
+
title: string;
|
|
74
|
+
/** The summary under the header, in order. */
|
|
75
|
+
details: readonly PositionBlockDetail[];
|
|
76
|
+
/** One sentence under the summary, such as the minimum margin. */
|
|
77
|
+
note?: string;
|
|
78
|
+
/** Shows the paper trading switch as a row of its own above the settings. */
|
|
79
|
+
paperTrade?: PositionBlockFlag;
|
|
80
|
+
/** The settings, as groups of rows. Each group is one rounded container. */
|
|
81
|
+
groups: readonly (readonly PositionBlockRow[])[];
|
|
82
|
+
/** Shows Close on the trailing edge of the header. */
|
|
83
|
+
onClose?: () => void;
|
|
84
|
+
/** Shows Back on the leading edge of the header. */
|
|
85
|
+
onBack?: () => void;
|
|
86
|
+
/** A control on the trailing edge of the header in place of Close. */
|
|
87
|
+
headerAction?: React.ReactNode;
|
|
88
|
+
/** Sets `nativeID` on the title, so a sheet around the pane can name itself with `accessibilityLabelledBy` (Android). */
|
|
89
|
+
headingId?: string;
|
|
90
|
+
/** Set false to leave the header out, when the host draws `PositionBlockHeader` itself, for example as a sticky header of its scroller. The two stack exactly as the whole block does. */
|
|
91
|
+
header?: boolean;
|
|
92
|
+
/** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container, such as a sheet body. */
|
|
93
|
+
stickyHeader?: boolean;
|
|
94
|
+
/** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill (`useColors().overlay`). */
|
|
95
|
+
stickyHeaderBackground?: string;
|
|
96
|
+
/** The scroll view used with `stickyHeader`, such as a sheet library's own. Defaults to React Native's ScrollView. */
|
|
97
|
+
scrollComponent?: React.ComponentType<ScrollViewProps>;
|
|
98
|
+
/** Pressable props for the header's Back, such as `{android_disableSound: true}`. */
|
|
99
|
+
backProps?: ScreenHeaderControlProps;
|
|
100
|
+
/** Pressable props for the header's Close. */
|
|
101
|
+
closeProps?: ScreenHeaderControlProps;
|
|
102
|
+
testID?: string;
|
|
103
|
+
}
|
|
104
|
+
/** The PositionBlock header on its own: put it in a scroller's sticky header and render `PositionBlock` with `header={false}` under it. It carries the block's top and side padding. */
|
|
105
|
+
export declare function PositionBlockHeader({ style, testID, scrolled, stickyHeaderBackground, ...props }: PositionBlockHeaderProps): React.JSX.Element;
|
|
106
|
+
/** The position being opened or edited as a screen: a summary of what it costs and where it ends, an optional paper trading switch, and its settings as grouped rows that open the host's own views. */
|
|
107
|
+
export declare function PositionBlock({ title, details, note, paperTrade, groups, onClose, onBack, headerAction, headingId, header, stickyHeader, stickyHeaderBackground, scrollComponent, backProps, closeProps, testID }: PositionBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useColors, useFills, useHIG, useMessages, useNumberLocale, usePresentNumber } from './provider.js';
|
|
4
|
+
import { Text } from './surface.js';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
import { SwitchRow } from './switch-row.js';
|
|
7
|
+
import { ListGroup, ListRow } from './list-group.js';
|
|
8
|
+
import { AnimatedNumberReadout } from './animated-number.js';
|
|
9
|
+
import { HeaderClose, ScreenHeader } from './screen-header.js';
|
|
10
|
+
import { StickyHeaderLayout, stickyHeaderFill } from './sticky-header.js';
|
|
11
|
+
import { figureProps, figureReading } from './figure.js';
|
|
12
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
13
|
+
function HeaderRow({ title, onClose, onBack, headerAction, headingId, backProps, closeProps }) {
|
|
14
|
+
const t = useMessages();
|
|
15
|
+
return _jsx(ScreenHeader, { testID: 'position', title: title, onBack: onBack, backProps: backProps, headingId: headingId, action: headerAction ?? (onClose ? _jsx(HeaderClose, { testID: 'position-close', label: t.close, onClose: onClose, closeProps: closeProps }) : null) });
|
|
16
|
+
}
|
|
17
|
+
/** The PositionBlock header on its own: put it in a scroller's sticky header and render `PositionBlock` with `header={false}` under it. It carries the block's top and side padding. */
|
|
18
|
+
export function PositionBlockHeader({ style, testID, scrolled, stickyHeaderBackground, ...props }) {
|
|
19
|
+
const colors = useColors();
|
|
20
|
+
return _jsx(View, { testID: testID, style: [{ paddingTop: 16, paddingHorizontal: 16 }, scrolled === undefined ? undefined : stickyHeaderFill(scrolled, stickyHeaderBackground ?? colors.background), style], children: _jsx(HeaderRow, { ...props }) });
|
|
21
|
+
}
|
|
22
|
+
function Track({ checked, testID }) {
|
|
23
|
+
const colors = useColors(), fills = useFills();
|
|
24
|
+
return _jsx(View, { testID: testID, style: { width: 40, height: 24, borderRadius: 12, padding: 3, backgroundColor: checked ? colors.action : fills.raised, alignItems: checked ? 'flex-end' : 'flex-start' }, children: _jsx(View, { style: { width: 18, height: 18, borderRadius: 9, backgroundColor: checked ? colors.onAction : colors.text } }) });
|
|
25
|
+
}
|
|
26
|
+
/** The position being opened or edited as a screen: a summary of what it costs and where it ends, an optional paper trading switch, and its settings as grouped rows that open the host's own views. */
|
|
27
|
+
export function PositionBlock({ title, details, note, paperTrade, groups, onClose, onBack, headerAction, headingId, header = true, stickyHeader, stickyHeaderBackground, scrollComponent, backProps, closeProps, testID }) {
|
|
28
|
+
const colors = useColors(), fills = useFills(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
|
|
29
|
+
const figure = { fontSize: 16, lineHeight: 24, fontWeight: '500' };
|
|
30
|
+
const shown = groups.filter(group => group.length > 0);
|
|
31
|
+
const read = (live) => figureReading(live, locale, present(live.options));
|
|
32
|
+
const flagRow = paperTrade ? _jsx(SwitchRow, { testID: 'position-paper-trade', label: paperTrade.label, checked: paperTrade.checked, disabled: paperTrade.disabled, onCheckedChange: paperTrade.onCheckedChange, style: { minHeight: 56, paddingVertical: 8, paddingHorizontal: 20, borderRadius: 20, backgroundColor: fills.well, opacity: paperTrade.disabled ? 0.5 : 1 }, children: _jsxs(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [_jsx(Text, { style: { flex: 1, flexShrink: 1, minWidth: 0, fontSize: 16, lineHeight: 24, color: colors.text }, children: paperTrade.label }), _jsx(Track, { checked: paperTrade.checked, testID: 'position-paper-trade-track' })] }) }) : null;
|
|
33
|
+
const action = paperTrade?.action;
|
|
34
|
+
const row = (item) => {
|
|
35
|
+
const live = item.value == null || typeof item.value === 'string' ? null : item.value, reading = live ? read(live) : item.value;
|
|
36
|
+
if (item.onCheckedChange)
|
|
37
|
+
return _jsx(SwitchRow, { testID: `position-row-${item.id}`, label: item.label, accessibilityHint: reading, checked: !!item.checked, disabled: item.disabled, onCheckedChange: item.onCheckedChange, style: { minHeight: 56, paddingVertical: 8, paddingHorizontal: 20, backgroundColor: fills.well, opacity: item.disabled ? 0.5 : 1 }, children: _jsxs(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: 12 }, children: [_jsx(Text, { style: { flex: 1, flexShrink: 1, minWidth: 0, fontSize: 16, lineHeight: 24, color: colors.text }, children: item.label }), live ? _jsx(AnimatedNumberReadout, { ...figureProps(live), tone: 'muted', style: { fontSize: 16, lineHeight: 24 } }) : reading ? _jsx(Text, { numberOfLines: 1, style: { flexShrink: 1, maxWidth: '50%', fontSize: 16, lineHeight: 24, color: colors.muted, textAlign: 'right' }, children: reading }) : null, _jsx(Track, { checked: !!item.checked, testID: `position-row-${item.id}-track` })] }) }, item.id);
|
|
38
|
+
return _jsx(ListRow, { testID: `position-row-${item.id}`, label: item.label, value: live ? _jsx(AnimatedNumberReadout, { ...figureProps(live), tone: 'muted', testID: `position-row-${item.id}-value`, style: { fontSize: 16, lineHeight: 24 } }) : item.value, valueLabel: live ? reading : undefined, onSelect: item.onSelect, disabled: item.disabled }, item.id);
|
|
39
|
+
};
|
|
40
|
+
const headerRow = _jsx(HeaderRow, { title: title, onClose: onClose, onBack: onBack, headerAction: headerAction, headingId: headingId, backProps: backProps, closeProps: closeProps });
|
|
41
|
+
const content = _jsxs(_Fragment, { children: [details.length > 0 ? _jsx(View, { testID: 'position-details', style: { gap: 12, marginTop: 16, paddingHorizontal: 20 }, children: details.map((detail, index) => {
|
|
42
|
+
const key = detail.id ?? index, live = typeof detail.value === 'string' ? null : detail.value, reading = live ? read(live) : detail.value;
|
|
43
|
+
const spoken = `${detail.label}, ${reading}${detail.struck ? `, ${detail.struck}` : ''}`;
|
|
44
|
+
const value = live ? _jsx(AnimatedNumberReadout, { ...figureProps(live), tone: detail.tone ?? 'text', style: figure }) : _jsx(Text, { style: { ...figure, color: detail.tone ? colors[detail.tone] : colors.text, textAlign: 'right' }, children: reading });
|
|
45
|
+
// The line is drawn over the figure, so it crosses animated digits as well as text.
|
|
46
|
+
const drawn = detail.struck ? _jsxs(View, { testID: `position-detail-${key}-struck`, style: { position: 'relative' }, children: [value, _jsx(View, { pointerEvents: 'none', style: { position: 'absolute', start: 0, end: 0, top: '50%', height: 1, backgroundColor: detail.tone ? colors[detail.tone] : colors.text } })] }) : value;
|
|
47
|
+
const label = _jsx(Text, { ...hidden, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, color: colors.muted }, children: detail.label });
|
|
48
|
+
if (detail.labelAccessory != null)
|
|
49
|
+
return _jsxs(View, { testID: `position-detail-${key}`, style: { direction, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12 }, children: [_jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', gap: 6, flexShrink: 1 }, children: [_jsx(Text, { testID: `position-detail-${key}-label`, accessible: true, accessibilityLabel: spoken, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, color: colors.muted }, children: detail.label }), detail.labelAccessory] }), _jsx(View, { ...hidden, style: { flexShrink: 1 }, children: drawn })] }, key);
|
|
50
|
+
return _jsxs(View, { testID: `position-detail-${key}`, accessible: true, accessibilityLabel: spoken, style: { direction, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12 }, children: [label, _jsx(View, { ...hidden, style: { flexShrink: 1 }, children: drawn })] }, key);
|
|
51
|
+
}) }) : null, note ? _jsx(Text, { testID: 'position-note', style: { color: colors.muted, fontSize: 13, lineHeight: 20, marginTop: 8, paddingHorizontal: 20 }, children: note }) : null, paperTrade || shown.length > 0 ? _jsxs(View, { testID: 'position-groups', style: { gap: 24, marginTop: 16 }, children: [action ? _jsxs(View, { testID: 'position-paper-trade-card', style: { borderRadius: 20, overflow: 'hidden', backgroundColor: fills.well }, children: [flagRow, _jsx(View, { style: { paddingHorizontal: 20, paddingBottom: 16 }, children: _jsx(Button, { testID: 'position-paper-trade-action', fullWidth: true, intent: action.intent ?? 'primary', busy: action.busy, disabled: action.disabled, onPress: action.onSelect, children: action.label }) })] }) : flagRow, shown.map((group, index) => _jsx(ListGroup, { testID: `position-group-${index}`, children: group.map(row) }, index))] }) : null] });
|
|
52
|
+
if (header && stickyHeader)
|
|
53
|
+
return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'position-sticky-header', header: headerRow, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: content });
|
|
54
|
+
return _jsxs(View, { testID: testID, style: header ? { padding: 16 } : { padding: 16, paddingTop: 0 }, children: [header ? headerRow : null, content] });
|
|
55
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type Figure } from './figure.js';
|
|
3
|
+
import type { AssetArtwork } from './asset-balance-row.js';
|
|
4
|
+
export type { AssetArtwork } from './asset-balance-row.js';
|
|
5
|
+
/** A row value that can change while the profile is shown, such as a balance: formatted with `options` between `prefix` and `suffix`, and updated place by place. `null` reads as unknown. */
|
|
6
|
+
export type ProfileFigure = Figure;
|
|
7
|
+
/** One row of a profile section. The host supplies every label and value. */
|
|
8
|
+
export interface ProfileRow {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
leading?: React.ReactNode;
|
|
12
|
+
/** Short text on the trailing edge, or a live figure that updates place by place. */
|
|
13
|
+
value?: React.ReactNode | ProfileFigure;
|
|
14
|
+
/** Colours the value. Without it the value keeps the row's muted value style. */
|
|
15
|
+
tone?: 'positive' | 'warning' | 'negative' | 'muted';
|
|
16
|
+
trailing?: React.ReactNode;
|
|
17
|
+
onSelect?: () => void;
|
|
18
|
+
disabled?: boolean;
|
|
19
|
+
/** With `onCheckedChange`, the row is a switch: the whole row is the target, the track trails and the label names it. */
|
|
20
|
+
checked?: boolean;
|
|
21
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface ProfileSection {
|
|
24
|
+
id: string;
|
|
25
|
+
/** Heading above the group, such as Rewards or Settings. */
|
|
26
|
+
title?: string;
|
|
27
|
+
rows: readonly ProfileRow[];
|
|
28
|
+
}
|
|
29
|
+
export interface ProfileStatus {
|
|
30
|
+
/** Read out for the dot, for example Demo. */
|
|
31
|
+
label: string;
|
|
32
|
+
tone?: 'positive' | 'warning' | 'negative' | 'info';
|
|
33
|
+
}
|
|
34
|
+
/** The primary action under the name, such as Log in for a signed-out viewer. The host writes the label. */
|
|
35
|
+
export interface ProfileAction {
|
|
36
|
+
label: string;
|
|
37
|
+
onSelect: () => void;
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/** Defaults to `primary`. */
|
|
40
|
+
intent?: 'primary' | 'secondary';
|
|
41
|
+
}
|
|
42
|
+
export interface ProfileBlockProps {
|
|
43
|
+
/** The name under the avatar: a display name or a shortened address. It may be left out when `action` is set, for a signed-out viewer. */
|
|
44
|
+
name?: string;
|
|
45
|
+
/** Host content beside the name, such as a badge. It stays in the accessibility tree, so give an interactive badge its own label. */
|
|
46
|
+
nameAccessory?: React.ReactNode;
|
|
47
|
+
/** Colours the avatar when there is no artwork. */
|
|
48
|
+
address?: string;
|
|
49
|
+
avatar?: AssetArtwork;
|
|
50
|
+
/** Makes the avatar a button, for example to choose a picture. `avatarLabel` names it. */
|
|
51
|
+
onAvatarPress?: () => void;
|
|
52
|
+
/** The accessible name of the avatar button, such as Change profile picture. Defaults to `name`, then the built-in “Change profile picture”. */
|
|
53
|
+
avatarLabel?: string;
|
|
54
|
+
status?: ProfileStatus;
|
|
55
|
+
onEditName?: () => void;
|
|
56
|
+
onShowAddress?: () => void;
|
|
57
|
+
onClose?: () => void;
|
|
58
|
+
/** A full-width button under the name, such as Log in. */
|
|
59
|
+
action?: ProfileAction;
|
|
60
|
+
sections: readonly ProfileSection[];
|
|
61
|
+
/** Host content under the sections on the block's inset, such as legal links. */
|
|
62
|
+
footer?: React.ReactNode;
|
|
63
|
+
testID?: string;
|
|
64
|
+
}
|
|
65
|
+
/** A person's profile as one screen: the address and close controls, the avatar with its status, the name, then the host's sections of rows. */
|
|
66
|
+
export declare function ProfileBlock({ name, nameAccessory, address, avatar, onAvatarPress, avatarLabel, status, onEditName, onShowAddress, onClose, action, sections, footer, testID }: ProfileBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Image, Pressable, View } from 'react-native';
|
|
4
|
+
import { useColors, useFills, useHIG, useMessages, useNumberLocale, usePresentNumber } from './provider.js';
|
|
5
|
+
import { Text } from './surface.js';
|
|
6
|
+
import { Button } from './button.js';
|
|
7
|
+
import { CloseIcon, EditIcon, QrIcon } from './icons.js';
|
|
8
|
+
import { ListGroup, ListRow } from './list-group.js';
|
|
9
|
+
import { SwitchRow } from './switch-row.js';
|
|
10
|
+
import { AnimatedNumberReadout } from './animated-number.js';
|
|
11
|
+
import { figureProps, figureReading } from './figure.js';
|
|
12
|
+
import { addressColor } from './swap-shared.js';
|
|
13
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
14
|
+
/** A 44dp control keeps a 48dp touch target on every side. */
|
|
15
|
+
const targetSlop = { top: 2, bottom: 2, left: 2, right: 2 };
|
|
16
|
+
/** True for a `ProfileFigure`: a plain object with a `value`, not an element, array or other node. */
|
|
17
|
+
const isProfileFigure = (value) => value != null && typeof value === 'object' && !React.isValidElement(value) && !Array.isArray(value) && !(Symbol.iterator in value) && 'value' in value;
|
|
18
|
+
/** A round 44 control with no fill of its own, like the other block headers; it takes the well fill while pressed. */
|
|
19
|
+
function RoundButton({ label, testID, onPress, children }) {
|
|
20
|
+
const fills = useFills();
|
|
21
|
+
return _jsx(Pressable, { testID: testID, accessibilityRole: 'button', accessibilityLabel: label, onPress: onPress, hitSlop: targetSlop, style: ({ pressed }) => ({ width: 44, height: 44, borderRadius: 22, alignItems: 'center', justifyContent: 'center', backgroundColor: pressed ? fills.well : 'transparent' }), children: children });
|
|
22
|
+
}
|
|
23
|
+
/** A list row that is one switch: the same anatomy as ListRow, with the track on the trailing edge, level with the first line of the label. */
|
|
24
|
+
function ProfileSwitchRow({ row }) {
|
|
25
|
+
const colors = useColors(), fills = useFills();
|
|
26
|
+
const on = !!row.checked;
|
|
27
|
+
const first = { minHeight: 40, justifyContent: 'center' };
|
|
28
|
+
return _jsx(SwitchRow, { testID: `profile-row-${row.id}`, label: row.label, checked: on, disabled: row.disabled, onCheckedChange: row.onCheckedChange, style: { minHeight: 56, paddingVertical: 8, paddingHorizontal: 20, backgroundColor: fills.well, opacity: row.disabled ? 0.5 : 1 }, children: _jsxs(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'flex-start', gap: 12 }, children: [row.leading == null ? null : _jsx(View, { style: first, children: row.leading }), _jsx(Text, { style: { flex: 1, flexShrink: 1, minWidth: 0, paddingVertical: 8, fontSize: 16, lineHeight: 24, color: colors.text }, children: row.label }), _jsx(View, { style: first, children: _jsx(View, { testID: `profile-row-${row.id}-track`, style: { width: 40, height: 24, borderRadius: 12, padding: 3, backgroundColor: on ? colors.action : fills.raised, alignItems: on ? 'flex-end' : 'flex-start' }, children: _jsx(View, { style: { width: 18, height: 18, borderRadius: 9, backgroundColor: on ? colors.onAction : colors.text } }) }) })] }) });
|
|
29
|
+
}
|
|
30
|
+
/** A row that opens something or shows a value. A live figure or a toned value is drawn here and read through `valueLabel`. */
|
|
31
|
+
function ProfileListRow({ row }) {
|
|
32
|
+
const locale = useNumberLocale(), present = usePresentNumber();
|
|
33
|
+
const { value, tone } = row, testID = `profile-row-${row.id}`;
|
|
34
|
+
const style = { fontSize: 16, lineHeight: 24, textAlign: 'right' };
|
|
35
|
+
if (isProfileFigure(value)) {
|
|
36
|
+
const reading = figureReading(value, locale, present(value.options));
|
|
37
|
+
return _jsx(ListRow, { testID: testID, label: row.label, leading: row.leading, valueLabel: reading, value: _jsx(AnimatedNumberReadout, { ...figureProps(value), tone: tone ?? 'muted', testID: `${testID}-value`, style: style }), trailing: row.trailing, onSelect: row.onSelect, disabled: row.disabled });
|
|
38
|
+
}
|
|
39
|
+
return _jsx(ListRow, { testID: testID, label: row.label, leading: row.leading, value: value, valueTone: tone, trailing: row.trailing, onSelect: row.onSelect, disabled: row.disabled });
|
|
40
|
+
}
|
|
41
|
+
/** A person's profile as one screen: the address and close controls, the avatar with its status, the name, then the host's sections of rows. */
|
|
42
|
+
export function ProfileBlock({ name, nameAccessory, address, avatar, onAvatarPress, avatarLabel, status, onEditName, onShowAddress, onClose, action, sections, footer, testID }) {
|
|
43
|
+
const colors = useColors(), fills = useFills(), t = useMessages(), { direction } = useHIG();
|
|
44
|
+
const art = typeof avatar === 'string' ? _jsx(Image, { source: { uri: avatar }, style: { width: 144, height: 144 } }) : avatar ?? (address ? null : _jsx(Text, { style: { fontSize: 40, lineHeight: 48, fontWeight: '600', color: colors.muted }, children: name?.slice(0, 2) }));
|
|
45
|
+
const shown = sections.filter(section => section.rows.length > 0);
|
|
46
|
+
const disc = _jsx(View, { ...hidden, testID: 'profile-avatar', style: { width: 144, height: 144, borderRadius: 72, overflow: 'hidden', alignItems: 'center', justifyContent: 'center', backgroundColor: avatar == null && address ? addressColor(address) : fills.well }, children: art });
|
|
47
|
+
return _jsxs(View, { testID: testID, style: { direction, padding: 16 }, children: [_jsxs(View, { testID: 'profile-bar', style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onShowAddress ? _jsx(RoundButton, { label: t.showAddress, testID: 'profile-address', onPress: onShowAddress, children: _jsx(QrIcon, { color: colors.text }) }) : null }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: onClose ? _jsx(RoundButton, { label: t.close, testID: 'profile-close', onPress: onClose, children: _jsx(CloseIcon, { color: colors.text }) }) : null })] }), _jsxs(View, { style: { alignSelf: 'center', width: 144, height: 144, marginTop: 8 }, children: [onAvatarPress ? _jsx(Pressable, { testID: 'profile-avatar-button', accessibilityRole: 'button', accessibilityLabel: avatarLabel ?? name ?? t.changeProfilePicture, onPress: onAvatarPress, style: ({ pressed }) => ({ borderRadius: 72, opacity: pressed ? 0.85 : 1 }), children: disc }) : disc, status ? _jsx(View, { testID: 'profile-status', accessible: true, accessibilityLabel: status.label, style: { position: 'absolute', top: 10, end: 10, width: 20, height: 20, borderRadius: 10, borderWidth: 3, borderColor: colors.background, backgroundColor: colors[status.tone ?? 'warning'] } }) : null] }), name != null ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: 4, marginTop: 16 }, children: [_jsx(Text, { testID: 'profile-name', accessibilityRole: 'header', numberOfLines: 1, style: { flexShrink: 1, fontSize: 28, lineHeight: 34, fontWeight: '700', color: colors.text }, children: name }), nameAccessory != null ? _jsx(View, { testID: 'profile-name-accessory', style: { flexShrink: 0 }, children: nameAccessory }) : null, onEditName ? _jsx(Pressable, { testID: 'profile-edit', accessibilityRole: 'button', accessibilityLabel: t.editName, onPress: onEditName, hitSlop: targetSlop, style: ({ pressed }) => ({ width: 44, height: 44, alignItems: 'center', justifyContent: 'center', opacity: pressed ? 0.6 : 1 }), children: _jsx(EditIcon, { color: colors.muted }) }) : null] }) : null, action ? _jsx(View, { testID: 'profile-action-row', style: { marginTop: 16 }, children: _jsx(Button, { testID: 'profile-action', fullWidth: true, intent: action.intent ?? 'primary', disabled: action.disabled, onPress: action.onSelect, children: action.label }) }) : null, shown.length > 0 ? _jsx(View, { testID: 'profile-sections', style: { gap: 24, marginTop: 24 }, children: shown.map(section => _jsx(ListGroup, { testID: `profile-section-${section.id}`, title: section.title, children: section.rows.map(row => row.onCheckedChange ? _jsx(ProfileSwitchRow, { row: row }, row.id) : _jsx(ProfileListRow, { row: row }, row.id)) }, section.id)) }) : null, footer != null ? _jsx(View, { testID: 'profile-footer', style: { marginTop: 24 }, children: footer }) : null] });
|
|
48
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { FeedbackSink, FeedbackIntent } from '@bloxwap/hig/contracts/feedback';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { nativeSrgb } from '@bloxwap/hig/tokens';
|
|
4
|
-
import { type Environment } from '@bloxwap/hig/contracts';
|
|
4
|
+
import { type Environment, type NumberFormatPresentation } from '@bloxwap/hig/contracts';
|
|
5
|
+
export type { NumberFormatPresentation } from '@bloxwap/hig/contracts';
|
|
5
6
|
import { type HIGMessages } from '@bloxwap/hig/contracts/messages';
|
|
6
7
|
export type { HIGMessages } from '@bloxwap/hig/contracts/messages';
|
|
7
8
|
/** Direction of a host-supplied locale (for example expo-localization's `getLocales()[0]`) for `HIGProvider direction`; see #86. */
|
|
@@ -34,7 +35,8 @@ export interface HIGContext extends Environment {
|
|
|
34
35
|
monoFontFamily?: string; /** Default Dynamic Type / font-scale cap for HIG Text; a Text prop overrides it. Leave unset for prose. */
|
|
35
36
|
maxFontSizeMultiplier?: number; /** Per-script letter spacing in em for Korean and Chinese companion faces; overrides `scriptLetterSpacing`. */
|
|
36
37
|
letterSpacingByScript?: Readonly<Partial<Record<'ko' | 'zh', number>>>; /** Colour space HIG paints in; defaults to `srgb` and is inherited by nested providers. Read the resolved table with `useColors()`. */
|
|
37
|
-
colorSpace: HIGColorSpace; /**
|
|
38
|
+
colorSpace: HIGColorSpace; /** Money presentation merged under every currency format HIG draws: the blocks, BarMark, BarPnl, AssetBalanceRow, the swap pieces and the number readouts. Options a format sets itself win. Nested providers inherit it. */
|
|
39
|
+
numberFormat?: NumberFormatPresentation; /** Host translations of built-in copy, merged through nested providers. Components fall back to the English export per key; read the full resolved catalog with `useMessages()`. */
|
|
38
40
|
messages: Readonly<Partial<HIGMessages>>;
|
|
39
41
|
}
|
|
40
42
|
export interface HIGProviderProps extends Partial<Omit<HIGContext, 'messages'>> {
|
|
@@ -42,8 +44,12 @@ export interface HIGProviderProps extends Partial<Omit<HIGContext, 'messages'>>
|
|
|
42
44
|
messages?: Partial<HIGMessages>;
|
|
43
45
|
}
|
|
44
46
|
/** Direction defaults to the OS layout direction (I18nManager) so HIG roots never force LTR inside an RTL app. React Native 0.83 Android does not report a per-app RTL locale through I18nManager (#86): RTL hosts pass `direction={localeDirection(getLocales()[0])}`. Hosts that disallow RTL leave `direction` unset. */
|
|
45
|
-
export declare function HIGProvider({ children, density, locale, direction, reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, marketColors, messages }: React.PropsWithChildren<HIGProviderProps>): React.JSX.Element;
|
|
47
|
+
export declare function HIGProvider({ children, density, locale, direction, reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, marketColors, messages, numberFormat }: React.PropsWithChildren<HIGProviderProps>): React.JSX.Element;
|
|
46
48
|
export declare const useHIG: () => HIGContext;
|
|
49
|
+
/** Number options with the nearest provider's `numberFormat` merged under them; only currency formats change. */
|
|
50
|
+
export declare function usePresentNumber(): <T extends Intl.NumberFormatOptions | undefined>(options: T) => T;
|
|
51
|
+
/** The locale numbers are formatted in: the nearest provider's `numberFormat.locale`, else its `locale`. */
|
|
52
|
+
export declare function useNumberLocale(): string;
|
|
47
53
|
/** Marks content that sits on a Surface, Dialog or sheet. HIG has no resting strokes, so wells inside step up one fill to stay visible. */
|
|
48
54
|
export declare function Raised({ children }: React.PropsWithChildren): React.JSX.Element;
|
|
49
55
|
/** Fills for the current elevation: `well` for inputs, tracks and neutral chips; `raised` for what sits on a well (a selected segment). On the page they are `surface` and `nested`; inside a Surface, Dialog or sheet, `nested` and `border`. */
|
package/native/dist/provider.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { createContext, useContext, useEffect, useMemo, useState, useRef, useId } from 'react';
|
|
3
3
|
import { AccessibilityInfo, I18nManager, Platform } from 'react-native';
|
|
4
4
|
import { nativeSrgb, nativeDisplayP3, resolvePrimaryColor } from '@bloxwap/hig/tokens';
|
|
5
|
-
import { defaultEnvironment } from '@bloxwap/hig/contracts';
|
|
5
|
+
import { defaultEnvironment, numberLocale, presentNumberFormat } from '@bloxwap/hig/contracts';
|
|
6
6
|
import { defaultMessages, resolveMessages } from '@bloxwap/hig/contracts/messages';
|
|
7
7
|
/** Direction of a host-supplied locale (for example expo-localization's `getLocales()[0]`) for `HIGProvider direction`; see #86. */
|
|
8
8
|
export { localeDirection } from '@bloxwap/hig/contracts';
|
|
@@ -16,7 +16,7 @@ const marketColor = (value) => typeof value === 'string' && value !== '' ? value
|
|
|
16
16
|
const srgbColors = withMarketRoles(nativeSrgb), displayP3Colors = withMarketRoles(nativeDisplayP3);
|
|
17
17
|
const ColorsContext = createContext(srgbColors);
|
|
18
18
|
/** Direction defaults to the OS layout direction (I18nManager) so HIG roots never force LTR inside an RTL app. React Native 0.83 Android does not report a per-app RTL locale through I18nManager (#86): RTL hosts pass `direction={localeDirection(getLocales()[0])}`. Hosts that disallow RTL leave `direction` unset. */
|
|
19
|
-
export function HIGProvider({ children, density = 'comfortable', locale = 'en-US', direction = I18nManager.isRTL ? 'rtl' : 'ltr', reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, marketColors, messages }) {
|
|
19
|
+
export function HIGProvider({ children, density = 'comfortable', locale = 'en-US', direction = I18nManager.isRTL ? 'rtl' : 'ltr', reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, marketColors, messages, numberFormat }) {
|
|
20
20
|
const parent = useContext(Context);
|
|
21
21
|
const inherited = parent.messages;
|
|
22
22
|
const resolved = useMemo(() => resolveMessages(inherited, messages), [inherited, messages]);
|
|
@@ -31,9 +31,13 @@ export function HIGProvider({ children, density = 'comfortable', locale = 'en-US
|
|
|
31
31
|
const [osReduced, setOSReduced] = useState(false);
|
|
32
32
|
useEffect(() => { let alive = true; void AccessibilityInfo.isReduceMotionEnabled().then(v => { if (alive)
|
|
33
33
|
setOSReduced(v); }).catch(() => { }); const sub = AccessibilityInfo.addEventListener('reduceMotionChanged', setOSReduced); return () => { alive = false; sub.remove(); }; }, []);
|
|
34
|
-
return _jsx(Context.Provider, { value: { density, locale, direction, reducedMotion: reducedMotion ?? osReduced, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript: fontFamiliesByScript ?? parent.fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace: space, primaryColor: normalized, marketColors: inheritedMarket, messages: resolved }, children: _jsx(ColorsContext.Provider, { value: colors, children: children }) });
|
|
34
|
+
return _jsx(Context.Provider, { value: { density, locale, direction, reducedMotion: reducedMotion ?? osReduced, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript: fontFamiliesByScript ?? parent.fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace: space, primaryColor: normalized, marketColors: inheritedMarket, messages: resolved, numberFormat: numberFormat ?? parent.numberFormat }, children: _jsx(ColorsContext.Provider, { value: colors, children: children }) });
|
|
35
35
|
}
|
|
36
36
|
export const useHIG = () => useContext(Context);
|
|
37
|
+
/** Number options with the nearest provider's `numberFormat` merged under them; only currency formats change. */
|
|
38
|
+
export function usePresentNumber() { const { numberFormat } = useContext(Context); return useMemo(() => (options) => presentNumberFormat(options, numberFormat), [numberFormat]); }
|
|
39
|
+
/** The locale numbers are formatted in: the nearest provider's `numberFormat.locale`, else its `locale`. */
|
|
40
|
+
export function useNumberLocale() { const { locale, numberFormat } = useContext(Context); return numberLocale(locale, numberFormat); }
|
|
37
41
|
const RaisedContext = createContext(false);
|
|
38
42
|
/** Marks content that sits on a Surface, Dialog or sheet. HIG has no resting strokes, so wells inside step up one fill to stay visible. */
|
|
39
43
|
export function Raised({ children }) { return _jsx(RaisedContext.Provider, { value: true, children: children }); }
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type ScrollViewProps } from 'react-native';
|
|
2
3
|
import type { ChoicesProps } from './selection-types.js';
|
|
3
4
|
export declare function RadioGroup({ label, options, value, defaultValue, disabled, onValueChange }: ChoicesProps): React.JSX.Element;
|
|
4
5
|
/** Equal-width choices with one interruptible selection indicator. The track is the dark well and the selected segment the lighter fill; the control is 44dp tall (36 compact). */
|
|
5
|
-
export
|
|
6
|
+
export interface SegmentedControlProps extends ChoicesProps {
|
|
7
|
+
hideLabel?: boolean;
|
|
8
|
+
testID?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function SegmentedControl({ label, options, value, defaultValue, disabled, hideLabel, testID, onValueChange }: SegmentedControlProps): React.JSX.Element;
|
|
6
11
|
export interface FilterOption {
|
|
7
12
|
value: string;
|
|
8
13
|
label: string;
|
|
@@ -15,7 +20,8 @@ export interface FilterProps {
|
|
|
15
20
|
value?: string;
|
|
16
21
|
defaultValue?: string;
|
|
17
22
|
disabled?: boolean;
|
|
18
|
-
onValueChange?: (value: string) => void;
|
|
23
|
+
onValueChange?: (value: string) => void; /** The horizontal scroll view the capsules sit in, such as a sheet library's ScrollView that keeps sideways drags from the sheet. It receives the same props as React Native's `ScrollView`, which is the default. */
|
|
24
|
+
scrollComponent?: React.ComponentType<ScrollViewProps>;
|
|
19
25
|
}
|
|
20
26
|
/** A horizontal, scrolling row of single-choice filter chips. The selected chip inverts and its circle shows a check that animates in. */
|
|
21
|
-
export declare function Filter({ label, options, value, defaultValue, disabled, onValueChange }: FilterProps): React.JSX.Element;
|
|
27
|
+
export declare function Filter({ label, options, value, defaultValue, disabled, onValueChange, scrollComponent: Scroll }: FilterProps): React.JSX.Element;
|
|
@@ -18,8 +18,7 @@ export function RadioGroup({ label, options, value, defaultValue = '', disabled,
|
|
|
18
18
|
}
|
|
19
19
|
/** Segments are 36dp inside a 44dp track; the slop restores a 48dp touch target. */
|
|
20
20
|
const segmentSlop = { top: 6, bottom: 6 };
|
|
21
|
-
|
|
22
|
-
export function SegmentedControl({ label, options, value, defaultValue = '', disabled, onValueChange }) {
|
|
21
|
+
export function SegmentedControl({ label, options, value, defaultValue = '', disabled, hideLabel, testID, onValueChange }) {
|
|
23
22
|
const [current, set] = useControllable(value, defaultValue, onValueChange);
|
|
24
23
|
const { direction, locale, reducedMotion, density } = useHIG();
|
|
25
24
|
const colors = useColors();
|
|
@@ -47,7 +46,7 @@ export function SegmentedControl({ label, options, value, defaultValue = '', dis
|
|
|
47
46
|
animation.start();
|
|
48
47
|
return () => animation.stop();
|
|
49
48
|
}, [selected, width, count, direction, reducedMotion, target, translateX]);
|
|
50
|
-
return _jsxs(View, { accessibilityRole: 'radiogroup', accessibilityLabel: label, style: { direction, gap: 8 }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: label }), _jsx(View, { style: { padding: 4, borderRadius: 9999, backgroundColor: fills.well }, children: _jsxs(View, { onLayout: event => setWidth(event.nativeEvent.layout.width), style: { flexDirection: 'row', gap: 4 }, children: [selected >= 0 && width > 0 && _jsx(Animated.View, { pointerEvents: 'none', accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { position: 'absolute', ...anchor, top: 0, bottom: 0, width: segmentWidth, borderRadius: 9999, backgroundColor: fills.raised, opacity: disabled || options[selected].disabled ? 0.5 : 1, transform: [{ translateX }] } }), options.map(option => {
|
|
49
|
+
return _jsxs(View, { testID: testID, accessibilityRole: 'radiogroup', accessibilityLabel: label, style: { direction, gap: 8 }, children: [hideLabel ? null : _jsx(Text, { style: { fontWeight: '600' }, children: label }), _jsx(View, { style: { padding: 4, borderRadius: 9999, backgroundColor: fills.well }, children: _jsxs(View, { onLayout: event => setWidth(event.nativeEvent.layout.width), style: { flexDirection: 'row', gap: 4 }, children: [selected >= 0 && width > 0 && _jsx(Animated.View, { pointerEvents: 'none', accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { position: 'absolute', ...anchor, top: 0, bottom: 0, width: segmentWidth, borderRadius: 9999, backgroundColor: fills.raised, opacity: disabled || options[selected].disabled ? 0.5 : 1, transform: [{ translateX }] } }), options.map(option => {
|
|
51
50
|
const checked = current === option.value, blocked = !!disabled || !!option.disabled;
|
|
52
51
|
const activate = () => { if (!blocked)
|
|
53
52
|
set(option.value); };
|
|
@@ -84,8 +83,8 @@ function FilterChip({ option, checked, blocked, reducedMotion, onSelect }) {
|
|
|
84
83
|
activate(); }, hitSlop: filterSlop, style: state => ({ flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 40, paddingVertical: 6, paddingStart: 8, paddingEnd: 16, borderRadius: 9999, backgroundColor: checked ? colors.text : state.pressed ? fills.raised : fills.well, opacity: blocked ? 0.5 : 1 }), children: [_jsxs(View, { ...hiddenMark, style: { width: 24, height: 24, borderRadius: 12, overflow: 'hidden', alignItems: 'center', justifyContent: 'center' }, children: [option.icon ? _jsx(Image, { source: { uri: option.icon }, accessible: false, style: { position: 'absolute', width: 24, height: 24, borderRadius: 12 } }) : _jsx(View, { style: { position: 'absolute', width: 24, height: 24, borderRadius: 12, borderWidth: 2, borderColor: ink } }), _jsx(Animated.View, { style: { position: 'absolute', width: 24, height: 24, borderRadius: 12, backgroundColor: colors.background, opacity: progress } }), _jsx(Animated.View, { style: { opacity: progress, transform: [{ scale: progress.interpolate({ inputRange: [0, 1], outputRange: [0.4, 1] }) }] }, children: _jsx(View, { style: { width: 11, height: 6, borderLeftWidth: 2, borderBottomWidth: 2, borderColor: colors.text, transform: [{ translateY: -1.5 }, { rotate: '-45deg' }] } }) })] }), _jsx(Text, { accessible: false, style: { fontSize: 14, lineHeight: 21, fontWeight: '600', color: ink }, children: option.label })] });
|
|
85
84
|
}
|
|
86
85
|
/** A horizontal, scrolling row of single-choice filter chips. The selected chip inverts and its circle shows a check that animates in. */
|
|
87
|
-
export function Filter({ label, options, value, defaultValue = '', disabled, onValueChange }) {
|
|
86
|
+
export function Filter({ label, options, value, defaultValue = '', disabled, onValueChange, scrollComponent: Scroll = ScrollView }) {
|
|
88
87
|
const [current, set] = useControllable(value, defaultValue, onValueChange);
|
|
89
88
|
const { direction, reducedMotion } = useHIG();
|
|
90
|
-
return _jsx(
|
|
89
|
+
return _jsx(Scroll, { horizontal: true, showsHorizontalScrollIndicator: false, keyboardShouldPersistTaps: 'handled', accessibilityRole: 'radiogroup', accessibilityLabel: label, style: { flexGrow: 0, direction }, contentContainerStyle: { direction, gap: 8 }, children: options.map(option => _jsx(FilterChip, { option: option, checked: current === option.value, blocked: !!disabled || !!option.disabled, reducedMotion: !!reducedMotion, onSelect: () => set(option.value) }, option.value)) });
|
|
91
90
|
}
|
package/native/dist/recipes.d.ts
CHANGED
|
@@ -1,46 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
onSelect: () => void;
|
|
8
|
-
}): React.JSX.Element;
|
|
9
|
-
export declare function BalanceCard({ label, balance, stale }: {
|
|
10
|
-
label: string;
|
|
11
|
-
balance: number | null;
|
|
12
|
-
stale?: boolean;
|
|
13
|
-
}): React.JSX.Element;
|
|
14
|
-
export declare function TradeEntry({ asset, amount, onAmountChange, onConfirm, busy, error, available }: {
|
|
15
|
-
asset: string;
|
|
16
|
-
amount: string;
|
|
17
|
-
onAmountChange: (v: string) => void;
|
|
18
|
-
onConfirm: () => void;
|
|
19
|
-
busy?: boolean;
|
|
20
|
-
error?: string;
|
|
21
|
-
available: string;
|
|
22
|
-
}): React.JSX.Element;
|
|
23
|
-
/** A copy outcome shows as a transient toast capsule (about 4s, dismissible) and is announced the way Toast announces any notice. */
|
|
24
|
-
export declare function InstallCommand({ command, onCopy }: {
|
|
25
|
-
command: string;
|
|
26
|
-
onCopy: () => Promise<void> | void;
|
|
27
|
-
}): React.JSX.Element;
|
|
28
|
-
export declare function CodeWindow({ language, children }: React.PropsWithChildren<{
|
|
29
|
-
language: string;
|
|
30
|
-
}>): React.JSX.Element;
|
|
31
|
-
export declare function MarketingHero({ title, description, href, cta }: {
|
|
32
|
-
title: string;
|
|
33
|
-
description: string;
|
|
34
|
-
href: string;
|
|
35
|
-
cta: string;
|
|
36
|
-
}): React.JSX.Element;
|
|
37
|
-
export declare function ActivityList({ items }: {
|
|
38
|
-
items: readonly {
|
|
39
|
-
id: string;
|
|
40
|
-
label: string;
|
|
41
|
-
status: string;
|
|
42
|
-
}[];
|
|
43
|
-
}): React.JSX.Element;
|
|
44
|
-
export { FromPicker, ToPicker, type FromPickerProps, type ToPickerProps, type PickerListProps } from './pickers.js';
|
|
45
|
-
export { SwapKeypad, SwapCapsule } from './swap-parts.js';
|
|
46
|
-
export { SwapPanel, swapAction, 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.js';
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Blocks were called recipes through 0.5.x. Import from `@bloxwap/hig/native/blocks`; this module is removed in the next
|
|
3
|
+
* major release. It exists as a real file so a Jest `moduleNameMapper` that maps `@bloxwap/hig/native/<entry>` to `native/dist/<entry>.js`
|
|
4
|
+
* resolves the old path too.
|
|
5
|
+
*/
|
|
6
|
+
export * from './blocks.js';
|