@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
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, type PressableProps } from 'react-native';
|
|
3
|
+
/** A text action on the trailing edge of a `ListGroup` heading, such as “Cancel all”. */
|
|
4
|
+
export interface ListGroupAction {
|
|
5
|
+
/** Host text drawn as the action and naming it. */
|
|
6
|
+
label: string;
|
|
7
|
+
onSelect: () => void;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface ListGroupProps {
|
|
11
|
+
/** Heading above the group, such as “Settings”: host text or an element such as a live count. Omit it for an untitled group. */
|
|
12
|
+
title?: React.ReactNode;
|
|
13
|
+
/** Host content after the title, such as a count or a figure; a string is drawn muted. */
|
|
14
|
+
titleAccessory?: React.ReactNode;
|
|
15
|
+
/** A text action on the trailing edge of the heading. */
|
|
16
|
+
action?: ListGroupAction;
|
|
17
|
+
/** Host content between the heading and the rows, such as a note or a field. A group with `intro` and no rows draws no row container. */
|
|
18
|
+
intro?: React.ReactNode;
|
|
19
|
+
/** `ListRow` elements. */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
testID?: string;
|
|
22
|
+
}
|
|
23
|
+
/** A grouped list for menus and settings: an optional heading over rows that share one rounded container. */
|
|
24
|
+
export declare function ListGroup({ title, titleAccessory, action, intro, children, testID }: ListGroupProps): React.JSX.Element;
|
|
25
|
+
export interface ListRowProps extends Omit<PressableProps, 'children' | 'style' | 'onPress' | 'disabled' | 'role' | 'accessibilityRole' | 'accessibilityLabel' | 'accessibilityState' | 'aria-label' | 'aria-checked' | 'aria-disabled' | 'aria-busy' | 'aria-selected'> {
|
|
26
|
+
label: string;
|
|
27
|
+
/** A muted second line under the label, such as a subtitle or an address. The row grows to fit it, and it is read with the label (as the hint of a switch row). */
|
|
28
|
+
description?: React.ReactNode;
|
|
29
|
+
/** Colours the label: `destructive` for an action that deletes or ends something, `muted` for one that is done or inactive. */
|
|
30
|
+
tone?: 'destructive' | 'muted';
|
|
31
|
+
/** Artwork before the label, such as an icon. Decorative: the label names the row. */
|
|
32
|
+
leading?: React.ReactNode;
|
|
33
|
+
/** Short text on the trailing edge, such as `Off`, `English` or a balance. A string or number is drawn muted, or in `valueTone`, and read with the label. */
|
|
34
|
+
value?: React.ReactNode;
|
|
35
|
+
/** What a `value` that is not text reads as, such as the formatted amount of a live figure. The element is then read as this text in its place: with the label on a pressable row, and on its own on a static row. */
|
|
36
|
+
valueLabel?: string;
|
|
37
|
+
/** Colours a string or number `value` instead of the muted default, keeping its layout and reading. */
|
|
38
|
+
valueTone?: 'positive' | 'warning' | 'negative' | 'muted';
|
|
39
|
+
/** Anything richer on the trailing edge: icons, a Badge, or a control such as a Switch. */
|
|
40
|
+
trailing?: React.ReactNode;
|
|
41
|
+
/** Makes the whole row a button, usually one that opens another view, and shows the disclosure chevron. */
|
|
42
|
+
onSelect?: () => void;
|
|
43
|
+
/** Dims the row and blocks `onSelect` and the switch. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/** A row in a list of choices, such as a picker that selects and closes: `true` draws a check on the trailing edge, and the row exposes `accessibilityState.selected`. With `selected` set, true or false, the row draws no chevron unless `disclosure` asks for one. */
|
|
46
|
+
selected?: boolean;
|
|
47
|
+
/** Something the row started is in progress: a spinner takes the disclosure's place, the row is read as busy and presses are ignored, without dimming it. A busy switch row ignores presses and is read as unavailable. */
|
|
48
|
+
busy?: boolean;
|
|
49
|
+
/** Busy text appended to the accessible name while `busy` (not on Android, which speaks its own); defaults to HIGProvider `messages.busy`. `''` omits it. */
|
|
50
|
+
busyLabel?: string;
|
|
51
|
+
/** The glyph a row with `onSelect` draws on its trailing edge: the `chevron` (default), `external` (an arrow, for something that opens outside the app) or `none`. */
|
|
52
|
+
disclosure?: 'chevron' | 'external' | 'none';
|
|
53
|
+
/** Makes the row a switch: the whole row is the target, named by `label`, with the track on its trailing edge; `onCheckedChange` receives the new state. Use without `onSelect`. */
|
|
54
|
+
checked?: boolean;
|
|
55
|
+
defaultChecked?: boolean;
|
|
56
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
57
|
+
testID?: string;
|
|
58
|
+
}
|
|
59
|
+
/** One row of a ListGroup: the label leads; a value, icons, a badge or a control trail. With `onSelect` the whole row is one button and shows a disclosure chevron; with `checked` or `onCheckedChange` the whole row is a switch; otherwise the row is static, so a control in `trailing` is its only target. Other Pressable props, such as `android_disableSound`, `hitSlop` or `onLongPress`, reach the row, and the ref reaches its view. */
|
|
60
|
+
export declare const ListRow: React.ForwardRefExoticComponent<ListRowProps & React.RefAttributes<React.ComponentRef<typeof View>>>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { forwardRef, useState } from 'react';
|
|
3
|
+
import { ActivityIndicator, Platform, Pressable, View } from 'react-native';
|
|
4
|
+
import * as en from '@bloxwap/hig/contracts/messages';
|
|
5
|
+
import { useColors, useFills, useHIG } from './provider.js';
|
|
6
|
+
import { Text } from './surface.js';
|
|
7
|
+
import { ChevronIcon } from './icons.js';
|
|
8
|
+
import { SwitchRow } from './switch-row.js';
|
|
9
|
+
import { plainText } from './text-content.js';
|
|
10
|
+
const shown = (node) => node != null && node !== false && node !== '';
|
|
11
|
+
const actionSlop = { top: 12, bottom: 12, left: 8, right: 8 };
|
|
12
|
+
/** A grouped list for menus and settings: an optional heading over rows that share one rounded container. */
|
|
13
|
+
export function ListGroup({ title, titleAccessory, action, intro, children, testID }) {
|
|
14
|
+
const colors = useColors(), { direction } = useHIG();
|
|
15
|
+
const titled = shown(title), accessory = shown(titleAccessory);
|
|
16
|
+
const titleStyle = { color: colors.muted, fontSize: 14, lineHeight: 20, fontWeight: '500' };
|
|
17
|
+
const titleTestID = testID ? `${testID}-title` : undefined;
|
|
18
|
+
// A string title keeps its 0.6.0 anatomy; an element title is one header node. With an accessory, the title and the accessory are one header node instead.
|
|
19
|
+
const joined = titled && accessory;
|
|
20
|
+
const role = joined ? {} : { accessibilityRole: 'header' };
|
|
21
|
+
const name = !titled ? null : typeof title === 'string' || typeof title === 'number'
|
|
22
|
+
? _jsx(Text, { ...role, testID: titleTestID, style: accessory || action ? { flexShrink: 1, ...titleStyle } : { paddingHorizontal: 4, ...titleStyle }, children: title })
|
|
23
|
+
: _jsx(View, { ...(joined ? {} : { accessible: true, ...role }), testID: titleTestID, style: accessory || action ? { flexShrink: 1 } : { paddingHorizontal: 4 }, children: title });
|
|
24
|
+
const extra = accessory ? _jsx(View, { testID: testID ? `${testID}-title-accessory` : undefined, style: { flexShrink: 1 }, children: typeof titleAccessory === 'string' || typeof titleAccessory === 'number' ? _jsx(Text, { style: titleStyle, children: titleAccessory }) : titleAccessory }) : null;
|
|
25
|
+
// An element with no text of its own, such as a live figure, leaves the platform to read the node's children.
|
|
26
|
+
const titleText = joined ? plainText(title) : '', accessoryText = joined ? plainText(titleAccessory) : '';
|
|
27
|
+
const heading = joined ? _jsxs(View, { accessible: true, accessibilityRole: 'header', accessibilityLabel: titleText && accessoryText ? `${titleText}, ${accessoryText}` : undefined, testID: testID ? `${testID}-heading` : undefined, style: { flexDirection: 'row', alignItems: 'center', gap: 8, flexShrink: 1, minWidth: 0 }, children: [name, extra] }) : _jsxs(_Fragment, { children: [name, extra] });
|
|
28
|
+
// The action stays outside the header node, so it remains its own button.
|
|
29
|
+
const header = !accessory && !action ? name : _jsxs(View, { testID: testID ? `${testID}-header` : undefined, style: { direction, flexDirection: 'row', alignItems: 'center', gap: 8, paddingHorizontal: 4, minWidth: 0 }, children: [heading, action ? _jsx(Pressable, { testID: testID ? `${testID}-action` : undefined, accessibilityRole: 'button', accessibilityLabel: action.label, accessibilityState: { disabled: !!action.disabled }, disabled: action.disabled, hitSlop: actionSlop, onPress: action.onSelect, style: ({ pressed }) => ({ marginStart: 'auto', minWidth: 32, alignItems: 'center', paddingVertical: 4, paddingHorizontal: 4, opacity: action.disabled ? 0.5 : pressed ? 0.6 : 1 }), children: _jsx(Text, { accessible: false, style: { fontSize: 14, lineHeight: 20, fontWeight: '600', color: colors.text }, children: action.label }) }) : null] });
|
|
30
|
+
const empty = React.Children.count(children) === 0;
|
|
31
|
+
return _jsxs(View, { testID: testID, style: { direction, gap: 8, minWidth: 0 }, children: [header, shown(intro) ? _jsx(View, { testID: testID ? `${testID}-intro` : undefined, style: { paddingHorizontal: 4, minWidth: 0 }, children: intro }) : null, shown(intro) && empty ? null : _jsx(View, { testID: testID ? `${testID}-rows` : undefined, style: { gap: 2, borderRadius: 20, overflow: 'hidden' }, children: children })] });
|
|
32
|
+
}
|
|
33
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
34
|
+
/** The check of a selected row. It does not mirror in right-to-left layouts. */
|
|
35
|
+
function Check({ color, testID }) { return _jsx(View, { ...hidden, testID: testID, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' }, children: _jsx(View, { style: { width: 6, height: 12, borderRightWidth: 2, borderBottomWidth: 2, borderColor: color, transform: [{ translateY: -1 }, { rotate: '45deg' }] } }) }); }
|
|
36
|
+
/** An arrow pointing up and away, for a row that opens something outside the app; it mirrors in right-to-left layouts. */
|
|
37
|
+
function External({ color, rtl, testID }) {
|
|
38
|
+
return _jsxs(View, { ...hidden, testID: testID, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center', transform: rtl ? [{ scaleX: -1 }] : undefined }, children: [_jsx(View, { style: { position: 'absolute', width: 12, height: 1.75, borderRadius: 1, backgroundColor: color, transform: [{ rotate: '-45deg' }] } }), _jsx(View, { style: { position: 'absolute', top: 5, right: 5, width: 7, height: 7, borderTopWidth: 1.75, borderRightWidth: 1.75, borderColor: color } })] });
|
|
39
|
+
}
|
|
40
|
+
/** One row of a ListGroup: the label leads; a value, icons, a badge or a control trail. With `onSelect` the whole row is one button and shows a disclosure chevron; with `checked` or `onCheckedChange` the whole row is a switch; otherwise the row is static, so a control in `trailing` is its only target. Other Pressable props, such as `android_disableSound`, `hitSlop` or `onLongPress`, reach the row, and the ref reaches its view. */
|
|
41
|
+
export const ListRow = /* @__PURE__ */ forwardRef(function ListRow({ label, description, tone, leading, value, valueLabel, valueTone, trailing, onSelect, disabled, selected, busy, busyLabel, disclosure, checked, defaultChecked, onCheckedChange, testID, ...rest }, ref) {
|
|
42
|
+
const colors = useColors(), fills = useFills(), { direction, messages } = useHIG();
|
|
43
|
+
const [internal, setInternal] = useState(!!defaultChecked);
|
|
44
|
+
const toggles = !onSelect && (checked !== undefined || defaultChecked !== undefined || onCheckedChange != null);
|
|
45
|
+
const row = (pressed) => ({ flexDirection: 'row', alignItems: 'flex-start', gap: 12, minHeight: 56, paddingVertical: 8, paddingHorizontal: 20, backgroundColor: pressed ? fills.raised : fills.well, opacity: disabled ? 0.5 : 1 });
|
|
46
|
+
const text = typeof value === 'string' || typeof value === 'number';
|
|
47
|
+
const described = shown(description), about = described ? plainText(description) : '';
|
|
48
|
+
const reading = [label, about || null, text ? String(value) : valueLabel ?? null].filter(Boolean).join(', ');
|
|
49
|
+
const busyText = busyLabel ?? messages.busy ?? en.busy;
|
|
50
|
+
const spoken = busy && busyText && Platform.OS !== 'android' ? `${reading} · ${busyText}` : reading;
|
|
51
|
+
// Everything aligns to the first line of the label, so a trailing switch stays at the top when the label wraps.
|
|
52
|
+
const first = { minHeight: 40, justifyContent: 'center' };
|
|
53
|
+
// A static row with a state is one element, so the state is read; a trailing control keeps the row open so the control stays its own target.
|
|
54
|
+
const announced = !onSelect && !toggles && (selected !== undefined || !!busy) && trailing == null;
|
|
55
|
+
const quiet = onSelect || toggles || announced ? hidden : {};
|
|
56
|
+
const lead = leading == null ? null : _jsx(View, { ...hidden, style: first, children: leading });
|
|
57
|
+
const labelColor = tone === 'destructive' ? colors.negative : tone === 'muted' ? colors.muted : colors.text;
|
|
58
|
+
const name = described
|
|
59
|
+
? _jsxs(View, { ...quiet, style: { flex: 1, flexShrink: 1, minWidth: 0, paddingVertical: 8 }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, color: labelColor }, children: label }), _jsx(Text, { testID: testID ? `${testID}-description` : undefined, style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: description })] })
|
|
60
|
+
: _jsx(Text, { ...quiet, style: { flex: 1, flexShrink: 1, minWidth: 0, paddingVertical: 8, fontSize: 16, lineHeight: 24, color: labelColor }, children: label });
|
|
61
|
+
const amount = value == null || value === false ? null : text ? _jsx(Text, { ...quiet, testID: testID ? `${testID}-value` : undefined, numberOfLines: 1, style: { flexShrink: 1, maxWidth: '50%', paddingVertical: 8, fontSize: 16, lineHeight: 24, color: colors[valueTone ?? 'muted'], textAlign: 'right' }, children: value }) : _jsx(View, { ...(!onSelect && !toggles && !announced && valueLabel ? { accessible: true, accessibilityLabel: valueLabel } : {}), style: first, children: value });
|
|
62
|
+
const extra = trailing == null ? null : _jsx(View, { pointerEvents: onSelect || toggles ? 'none' : 'auto', ...quiet, style: { flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 40 }, children: trailing });
|
|
63
|
+
const chevron = _jsx(View, { testID: testID ? `${testID}-chevron` : undefined, style: { transform: [{ rotate: direction === 'rtl' ? '90deg' : '-90deg' }] }, children: _jsx(ChevronIcon, { color: colors.muted }) });
|
|
64
|
+
const glyphKind = disclosure ?? (selected !== undefined ? 'none' : 'chevron');
|
|
65
|
+
const glyph = busy && !toggles ? _jsx(ActivityIndicator, { testID: testID ? `${testID}-busy` : undefined, size: 'small', color: colors.muted, ...hidden })
|
|
66
|
+
: selected ? _jsx(Check, { color: colors.text, testID: testID ? `${testID}-check` : undefined })
|
|
67
|
+
: onSelect ? (glyphKind === 'chevron' ? chevron : glyphKind === 'external' ? _jsx(External, { color: colors.muted, rtl: direction === 'rtl', testID: testID ? `${testID}-external` : undefined }) : null) : null;
|
|
68
|
+
const end = glyph ? _jsx(View, { ...hidden, style: first, children: glyph }) : null;
|
|
69
|
+
if (toggles) {
|
|
70
|
+
const on = checked ?? internal;
|
|
71
|
+
const hint = [about || null, text ? String(value) : valueLabel ?? null].filter(Boolean).join(', ') || undefined;
|
|
72
|
+
// The row holds an uncontrolled state itself so the drawn track follows it; SwitchRow stays controlled and emits feedback once.
|
|
73
|
+
return _jsx(SwitchRow, { ...rest, ref: ref, testID: testID, label: label, accessibilityHint: rest.accessibilityHint ?? hint, accessibilityState: busy ? { busy: true } : undefined, checked: on, disabled: disabled || busy, onCheckedChange: next => { if (checked === undefined)
|
|
74
|
+
setInternal(next); onCheckedChange?.(next); }, style: row(false), children: _jsx(SwitchRowContent, { first: first, lead: lead, name: name, amount: amount, extra: extra, checked: on, testID: testID }) });
|
|
75
|
+
}
|
|
76
|
+
const state = { ...(selected !== undefined ? { selected } : {}), ...(busy ? { busy: true } : {}) };
|
|
77
|
+
if (!onSelect)
|
|
78
|
+
return _jsxs(View, { ...rest, ref: ref, testID: testID, ...(announced ? { accessible: true, accessibilityLabel: spoken } : {}), accessibilityState: Object.keys(state).length ? state : undefined, style: row(false), children: [lead, name, amount, extra, end] });
|
|
79
|
+
return _jsxs(Pressable, { ...rest, ref: ref, testID: testID, accessibilityRole: 'button', accessibilityLabel: spoken, accessibilityState: { disabled: !!disabled, ...state }, "aria-busy": busy || undefined, disabled: disabled, onPress: busy ? undefined : onSelect, style: ({ pressed }) => row(pressed && !busy), children: [lead, name, amount, extra, end] });
|
|
80
|
+
});
|
|
81
|
+
/** The decorative anatomy of a switch row: the label, value and trailing content, then the track. */
|
|
82
|
+
function SwitchRowContent({ first, lead, name, amount, extra, checked, testID }) {
|
|
83
|
+
const colors = useColors(), fills = useFills();
|
|
84
|
+
return _jsxs(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'flex-start', gap: 12 }, children: [lead, name, amount, extra, _jsx(View, { style: first, children: _jsx(View, { testID: testID ? `${testID}-track` : undefined, 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 } }) }) })] });
|
|
85
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
/** Every trading word of the block. HIG's built-in strings hold no trading terms, so the host supplies them, translated. */
|
|
6
|
+
export interface ManagePositionBlockLabels {
|
|
7
|
+
title: string;
|
|
8
|
+
margin: string;
|
|
9
|
+
notional: string;
|
|
10
|
+
liquidation: string;
|
|
11
|
+
/** `99.8% to liquidation`: receives the formatted percent. */
|
|
12
|
+
toLiquidation: (percent: string) => string;
|
|
13
|
+
mark: string;
|
|
14
|
+
entry: string;
|
|
15
|
+
/** Accessible words for the direction arrow. */
|
|
16
|
+
long: string;
|
|
17
|
+
short: string;
|
|
18
|
+
}
|
|
19
|
+
/** A number the host supplies as a number so it updates place by place: `{value:66000,options:{style:'currency',currency:'USD'}}`. `null` reads as unknown. */
|
|
20
|
+
export type ManagePositionBlockFigure = Figure;
|
|
21
|
+
/** The position's artwork: an image URL, a host element, or a function that draws a host element and receives `failed`, to call when that element cannot draw (an SVG that did not load); the row then shows `iconFallback` or the initials. */
|
|
22
|
+
export type ManagePositionIcon = AssetArtwork | ((failed: () => void) => React.ReactNode);
|
|
23
|
+
export interface ManagePositionBlockAction {
|
|
24
|
+
id: string;
|
|
25
|
+
label: string;
|
|
26
|
+
onSelect: () => void;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Trailing value of the row, before the chevron: host text or a live figure, such as the price a resting trigger is set at. */
|
|
29
|
+
value?: string | ManagePositionBlockFigure;
|
|
30
|
+
/** Colours `value`. The default is the muted value colour. */
|
|
31
|
+
tone?: 'positive' | 'negative' | 'muted';
|
|
32
|
+
}
|
|
33
|
+
export interface ManagePositionBlockSummary {
|
|
34
|
+
name: string;
|
|
35
|
+
/** An image URL, a host element, or a function that draws one and reports its failure. An image or element that fails shows `iconFallback`, else the initials. */
|
|
36
|
+
icon?: ManagePositionIcon;
|
|
37
|
+
/** A host element drawn in place of an `icon` that failed to draw. Without it the row shows the initials. */
|
|
38
|
+
iconFallback?: React.ReactNode;
|
|
39
|
+
/** Short ticker for the initials when there is no artwork: BTC. Without it the first letters of the name are shown. */
|
|
40
|
+
symbol?: string;
|
|
41
|
+
/** Host text after the name, drawn as a small Badge, such as a venue. */
|
|
42
|
+
badge?: string;
|
|
43
|
+
/** One line under the row, such as that the profit and loss is stale or estimated. */
|
|
44
|
+
caption?: string;
|
|
45
|
+
/** Makes the whole row a button, for example one that opens the market. Needs `label`. */
|
|
46
|
+
onSelect?: () => void;
|
|
47
|
+
/** Accessible name of the row when it is a button, read before the figures, which stay in the label: View Bitcoin. The caption is its hint. */
|
|
48
|
+
label?: string;
|
|
49
|
+
/** 40 reads `40×`. */
|
|
50
|
+
leverage?: number;
|
|
51
|
+
/** Size in asset units. */
|
|
52
|
+
size?: number | null;
|
|
53
|
+
/** Profit and loss in dollars. */
|
|
54
|
+
pnl?: number | null;
|
|
55
|
+
/** Profit and loss as a fraction: -0.0025 reads -0.25%. */
|
|
56
|
+
pnlPercent?: number | null;
|
|
57
|
+
}
|
|
58
|
+
export interface ManagePositionBlockProps {
|
|
59
|
+
labels: ManagePositionBlockLabels;
|
|
60
|
+
/** Margin mode, the title of the first card: Demo, Cross, Isolated. Without it the card is titled with the margin label. */
|
|
61
|
+
mode?: string;
|
|
62
|
+
side: 'long' | 'short';
|
|
63
|
+
entry: number;
|
|
64
|
+
mark?: number | null;
|
|
65
|
+
liquidation?: number | null;
|
|
66
|
+
margin: number;
|
|
67
|
+
notional: number;
|
|
68
|
+
/** Format of the three prices, such as another currency. They are drawn compact: no extra zeros. */
|
|
69
|
+
priceOptions?: Intl.NumberFormatOptions;
|
|
70
|
+
actions: readonly ManagePositionBlockAction[];
|
|
71
|
+
position?: ManagePositionBlockSummary;
|
|
72
|
+
/** Format of the position's profit and loss, merged over the default: signed US dollars with up to four decimals. */
|
|
73
|
+
pnlOptions?: Intl.NumberFormatOptions;
|
|
74
|
+
/** Shows Back on the leading edge of the header. */
|
|
75
|
+
onBack?: () => void;
|
|
76
|
+
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
77
|
+
headerAction?: React.ReactNode;
|
|
78
|
+
/** Sets `nativeID` on the title, so a sheet around the pane can name itself with `accessibilityLabelledBy` (Android). */
|
|
79
|
+
headingId?: string;
|
|
80
|
+
testID?: string;
|
|
81
|
+
}
|
|
82
|
+
/** Distance left before liquidation. `total` is the span from entry to liquidation, `buffer` how much of it remains between mark and liquidation (the whole span while in profit), `drawdown` the rest, and `share` the buffer as a fraction of the span. Unknown mark or liquidation, or a liquidation on the wrong side of entry, gives zeros and a `null` share. */
|
|
83
|
+
export declare function positionCorridor({ side, entry, mark, liquidation }: {
|
|
84
|
+
side: 'long' | 'short';
|
|
85
|
+
entry: number;
|
|
86
|
+
mark?: number | null;
|
|
87
|
+
liquidation?: number | null;
|
|
88
|
+
}): {
|
|
89
|
+
total: number;
|
|
90
|
+
buffer: number;
|
|
91
|
+
drawdown: number;
|
|
92
|
+
share: number | null;
|
|
93
|
+
};
|
|
94
|
+
/** One open position as a screen: margin and notional under the share left before liquidation, then the liquidation, mark and entry prices as a `BarPnl`, what can be done, and the position itself. Both bars are drawn without a card, because nothing in them can be pressed. */
|
|
95
|
+
export declare function ManagePositionBlock({ labels, mode, side, entry, mark, liquidation, margin, notional, priceOptions, actions, position, pnlOptions, onBack, headerAction, headingId, testID }: ManagePositionBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } 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 { IconButton } from './button.js';
|
|
7
|
+
import { ChevronIcon } from './icons.js';
|
|
8
|
+
import { AnimatedNumberReadout } from './animated-number.js';
|
|
9
|
+
import { figureProps, figureReading } from './figure.js';
|
|
10
|
+
import { formatNumberReadout } from './animated-number-model.js';
|
|
11
|
+
import { BarMark } from './bar-mark.js';
|
|
12
|
+
import { BarPnl } from './bar-pnl.js';
|
|
13
|
+
import { ListGroup, ListRow } from './list-group.js';
|
|
14
|
+
const usd = { style: 'currency', currency: 'USD' };
|
|
15
|
+
const pnlUsdDefault = { style: 'currency', currency: 'USD', signDisplay: 'exceptZero', maximumFractionDigits: 4 };
|
|
16
|
+
const pnlShare = { style: 'percent', minimumFractionDigits: 2, maximumFractionDigits: 2, signDisplay: 'exceptZero' };
|
|
17
|
+
const units = { maximumFractionDigits: 6 };
|
|
18
|
+
const tenth = { maximumFractionDigits: 1 };
|
|
19
|
+
const numberMark = '', unknown = '—', times = '×', dot = ' · ', percent = '%', up = '↑', down = '↓';
|
|
20
|
+
const avatar = 40;
|
|
21
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
22
|
+
const known = (value) => value != null && Number.isFinite(value);
|
|
23
|
+
/** Distance left before liquidation. `total` is the span from entry to liquidation, `buffer` how much of it remains between mark and liquidation (the whole span while in profit), `drawdown` the rest, and `share` the buffer as a fraction of the span. Unknown mark or liquidation, or a liquidation on the wrong side of entry, gives zeros and a `null` share. */
|
|
24
|
+
export function positionCorridor({ side, entry, mark, liquidation }) {
|
|
25
|
+
const long = side === 'long', span = known(liquidation) ? long ? entry - liquidation : liquidation - entry : 0;
|
|
26
|
+
if (!known(mark) || !known(liquidation) || !Number.isFinite(span) || span <= 0)
|
|
27
|
+
return { total: 0, buffer: 0, drawdown: 0, share: null };
|
|
28
|
+
const traveled = long ? entry - mark : mark - entry, buffer = Math.min(span, Math.max(0, span - traveled));
|
|
29
|
+
return { total: span, buffer, drawdown: span - buffer, share: buffer / span };
|
|
30
|
+
}
|
|
31
|
+
/** 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. */
|
|
32
|
+
function Sentence({ template, text, value, options, suffix, testID }) {
|
|
33
|
+
const colors = useColors(), { direction } = useHIG();
|
|
34
|
+
const type = { fontSize: 14, lineHeight: 21 }, words = { ...type, color: colors.muted };
|
|
35
|
+
const reading = template(text), parts = template(numberMark).split(numberMark);
|
|
36
|
+
if (value === null || parts.length !== 2)
|
|
37
|
+
return _jsx(Text, { testID: testID, style: { ...words, flexShrink: 1 }, children: reading });
|
|
38
|
+
return _jsxs(View, { accessible: true, accessibilityLabel: reading, testID: testID, style: { direction, flexDirection: 'row', alignItems: 'center', flexShrink: 1 }, children: [parts[0] ? _jsx(Text, { accessible: false, style: words, children: parts[0] }) : null, _jsx(AnimatedNumberReadout, { value: value, options: options, suffix: suffix, tone: 'muted', style: type }), parts[1] ? _jsx(Text, { accessible: false, style: words, children: parts[1] }) : null] });
|
|
39
|
+
}
|
|
40
|
+
/** One open position as a screen: margin and notional under the share left before liquidation, then the liquidation, mark and entry prices as a `BarPnl`, what can be done, and the position itself. Both bars are drawn without a card, because nothing in them can be pressed. */
|
|
41
|
+
export function ManagePositionBlock({ labels, mode, side, entry, mark, liquidation, margin, notional, priceOptions, actions, position, pnlOptions, onBack, headerAction, headingId, testID }) {
|
|
42
|
+
const colors = useColors(), fills = useFills(), t = useMessages(), { direction } = useHIG(), locale = useNumberLocale(), present = usePresentNumber();
|
|
43
|
+
// The artwork that failed to draw (its URL, or the position for a host element); it then shows the fallback or the initials until the artwork changes.
|
|
44
|
+
const [broken, setBroken] = useState(null);
|
|
45
|
+
const pnlUsd = pnlOptions ? { ...pnlUsdDefault, ...pnlOptions } : pnlUsdDefault;
|
|
46
|
+
const read = (value, options) => known(value) ? formatNumberReadout(value, locale, present(options)).text : unknown;
|
|
47
|
+
const corridor = positionCorridor({ side, entry, mark, liquidation }), long = side === 'long';
|
|
48
|
+
const marginBar = [{ id: 'margin', label: labels.margin, value: margin, detail: read(margin, usd), tone: 'info' }, { id: 'notional', label: labels.notional, value: known(notional) ? Math.max(notional - margin, 0) : 0, detail: read(notional, usd), tone: 'positive' }];
|
|
49
|
+
const left = corridor.share === null ? null : corridor.share * 100;
|
|
50
|
+
const shape = { width: avatar, height: avatar, borderRadius: avatar / 2, backgroundColor: fills.raised, alignItems: 'center', justifyContent: 'center', overflow: 'hidden' };
|
|
51
|
+
const row = () => {
|
|
52
|
+
if (!position)
|
|
53
|
+
return null;
|
|
54
|
+
const { name, icon, iconFallback, symbol, leverage, size, pnl, pnlPercent, badge, caption, onSelect } = position;
|
|
55
|
+
const initials = _jsx(Text, { accessible: false, maxFontSizeMultiplier: 1, style: { fontSize: 12, lineHeight: 16, fontWeight: '600', color: colors.muted }, children: symbol ?? name.slice(0, 3) });
|
|
56
|
+
const key = typeof icon === 'string' ? icon : `${symbol ?? ''}|${name}`, failed = broken === key, fail = () => setBroken(key);
|
|
57
|
+
const art = failed ? _jsx(View, { testID: 'manage-position-initials', style: shape, children: iconFallback ?? initials })
|
|
58
|
+
: typeof icon === 'string' ? _jsx(Image, { accessible: false, accessibilityIgnoresInvertColors: true, source: { uri: icon }, onError: fail, style: shape })
|
|
59
|
+
: _jsx(View, { style: shape, children: typeof icon === 'function' ? icon(fail) : icon ?? initials });
|
|
60
|
+
const gearing = known(leverage) ? formatNumberReadout(leverage, locale, units).text + times : null, held = size !== undefined ? read(size, units) : null;
|
|
61
|
+
const label = [name, long ? labels.long : labels.short, gearing, held, pnl !== undefined ? read(pnl, pnlUsd) : null, pnlPercent !== undefined ? read(pnlPercent, pnlShare) : null].filter(Boolean).join(', ');
|
|
62
|
+
const meta = { fontSize: 14, lineHeight: 20 };
|
|
63
|
+
const title = _jsx(Text, { numberOfLines: 1, style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: colors.text, ...(badge ? { flexShrink: 1 } : null) }, children: name });
|
|
64
|
+
const surface = (pressed) => ({ flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 56, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 28, backgroundColor: pressed ? fills.raised : fills.well, marginTop: 16 });
|
|
65
|
+
const parts = _jsxs(_Fragment, { children: [_jsx(View, { ...hidden, children: art }), _jsxs(View, { ...hidden, style: { flex: 1, flexShrink: 1, minWidth: 0 }, children: [badge ? _jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', gap: 8, minWidth: 0 }, children: [title, _jsx(View, { testID: 'manage-position-badge', style: { flexShrink: 0, borderRadius: 9999, paddingHorizontal: 8, backgroundColor: fills.raised }, children: _jsx(Text, { numberOfLines: 1, style: { fontSize: 12, lineHeight: 18, fontWeight: '500', color: colors.muted }, children: badge }) })] }) : title, _jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', gap: 4 }, children: [_jsx(Text, { testID: 'manage-position-side', style: { ...meta, fontWeight: '600', color: long ? colors.up : colors.down }, children: long ? up : down }), gearing ? _jsx(Text, { testID: 'manage-position-leverage', style: { ...meta, fontWeight: '600', color: long ? colors.up : colors.down }, children: gearing }) : null, gearing && held ? _jsx(Text, { style: { ...meta, color: colors.muted }, children: dot.trim() }) : null, size !== undefined ? _jsx(AnimatedNumberReadout, { value: size, options: units, tone: 'muted', testID: 'manage-position-size', style: meta }) : null] })] }), _jsxs(View, { ...hidden, style: { alignItems: 'flex-end', justifyContent: 'center' }, children: [pnl !== undefined ? _jsx(AnimatedNumberReadout, { value: pnl, options: pnlUsd, tone: known(pnl) && pnl > 0 ? 'up' : known(pnl) && pnl < 0 ? 'down' : 'text', testID: 'manage-position-pnl', style: { fontSize: 16, lineHeight: 24, fontWeight: '600' } }) : null, pnlPercent !== undefined ? _jsx(AnimatedNumberReadout, { value: pnlPercent, options: pnlShare, tone: 'muted', testID: 'manage-position-pnl-percent', style: meta }) : null] })] });
|
|
66
|
+
const note = caption ? _jsx(Text, { testID: 'manage-position-caption', style: { marginTop: 8, paddingHorizontal: 16, color: colors.muted, fontSize: 13, lineHeight: 20 }, children: caption }) : null;
|
|
67
|
+
if (onSelect) {
|
|
68
|
+
// A pressable row is named by the host's label and then what it shows, so the figures are read even with hints off; the caption is its hint.
|
|
69
|
+
return _jsxs(_Fragment, { children: [_jsx(Pressable, { testID: 'manage-position-row', accessibilityRole: 'button', accessibilityLabel: position.label ? `${position.label}, ${label}` : label, accessibilityHint: caption, onPress: onSelect, style: ({ pressed }) => surface(pressed), children: parts }), note] });
|
|
70
|
+
}
|
|
71
|
+
return _jsxs(_Fragment, { children: [_jsx(View, { testID: 'manage-position-row', accessible: true, accessibilityLabel: label, style: surface(false), children: parts }), note] });
|
|
72
|
+
};
|
|
73
|
+
const actionValue = (action) => {
|
|
74
|
+
const figure = action.value;
|
|
75
|
+
if (figure == null)
|
|
76
|
+
return {};
|
|
77
|
+
if (typeof figure === 'string')
|
|
78
|
+
return { value: figure, valueTone: action.tone };
|
|
79
|
+
return { value: _jsx(AnimatedNumberReadout, { ...figureProps(figure), tone: action.tone ?? 'muted', testID: `manage-action-${action.id}-value`, style: { fontSize: 16, lineHeight: 24 } }), valueLabel: figureReading(figure, locale, present(figure.options)) };
|
|
80
|
+
};
|
|
81
|
+
return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [_jsxs(View, { testID: 'manage-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: 'manage-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'manage-title', nativeID: headingId, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: labels.title }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] }), _jsxs(View, { style: { gap: 20, marginTop: 16, paddingHorizontal: 4 }, children: [_jsx(BarMark, { testID: 'manage-margin', surface: false, title: mode ?? labels.margin, elements: marginBar, description: _jsx(Sentence, { testID: 'manage-to-liquidation', template: labels.toLiquidation, text: left === null ? unknown : formatNumberReadout(left, locale, tenth).text + percent, value: left, options: tenth, suffix: percent }) }), _jsx(BarPnl, { testID: 'manage-liquidation', surface: false, compact: true, side: side, entry: entry, mark: mark, liquidation: liquidation, labels: { liquidation: labels.liquidation, mark: labels.mark, entry: labels.entry }, priceOptions: priceOptions })] }), actions.length > 0 ? _jsx(View, { testID: 'manage-actions', style: { marginTop: 16 }, children: _jsx(ListGroup, { children: actions.map(action => _jsx(ListRow, { testID: `manage-action-${action.id}`, label: action.label, disabled: action.disabled, onSelect: action.onSelect, ...actionValue(action) }, action.id)) }) }) : null, row()] });
|
|
82
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, type GestureResponderEvent, type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
interface MarketRowContent {
|
|
4
|
+
symbol: string;
|
|
5
|
+
name: string;
|
|
6
|
+
/** Leave out to draw no price (no dash); `null` reads as unknown. */
|
|
7
|
+
price?: number | null;
|
|
8
|
+
/** Leave out to draw no change (no dash); `null` reads as unknown. */
|
|
9
|
+
change?: number | null;
|
|
10
|
+
/** Intl display options for the price, including a decimal style when the host omits a currency symbol. */
|
|
11
|
+
priceOptions?: Intl.NumberFormatOptions;
|
|
12
|
+
/** Percent-point display precision and sign, forwarded to `Percent`. */
|
|
13
|
+
changeOptions?: Intl.NumberFormatOptions;
|
|
14
|
+
/** Host artwork before the name, such as the market icon. Decorative. */
|
|
15
|
+
icon?: React.ReactNode;
|
|
16
|
+
/** Host favourite indicator or control before the icon. */
|
|
17
|
+
favorite?: React.ReactNode;
|
|
18
|
+
/** Host-formatted volume after the change. */
|
|
19
|
+
volume?: React.ReactNode;
|
|
20
|
+
/** A muted second line under the name, such as the maximum leverage. Text, or host nodes (text nodes are drawn muted; an element is drawn as given). In action mode its text is read with the name. */
|
|
21
|
+
detail?: React.ReactNode;
|
|
22
|
+
/** Host content on the trailing edge, after the figures, such as a held position's result. */
|
|
23
|
+
trailing?: React.ReactNode;
|
|
24
|
+
/** The market in use: a check on the trailing edge and `accessibilityState.selected` on the name button (the row in presentation mode). */
|
|
25
|
+
selected?: boolean;
|
|
26
|
+
/** Dims the row; in action mode the name button is disabled. */
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
/** Highlights the row with the well fill, as for a host's keyboard cursor. */
|
|
29
|
+
active?: boolean;
|
|
30
|
+
/** Action mode: called when a press starts on the name button, before it is accepted, for example to prefetch the market. */
|
|
31
|
+
onPressIn?: (event: GestureResponderEvent) => void;
|
|
32
|
+
testID?: string;
|
|
33
|
+
style?: StyleProp<ViewStyle>;
|
|
34
|
+
}
|
|
35
|
+
export type MarketRowProps = MarketRowContent & ({
|
|
36
|
+
mode?: 'action';
|
|
37
|
+
onSelect: () => void;
|
|
38
|
+
identity?: never;
|
|
39
|
+
} | {
|
|
40
|
+
mode: 'presentation';
|
|
41
|
+
onSelect?: never; /** Host market identity in place of `name (symbol)`. */
|
|
42
|
+
identity?: React.ReactNode;
|
|
43
|
+
});
|
|
44
|
+
/** A market as one row: its name (a button, or the host's identity in presentation mode), price and change. The ref reaches the row's root view. */
|
|
45
|
+
export declare const MarketRow: React.ForwardRefExoticComponent<MarketRowProps & React.RefAttributes<React.ComponentRef<typeof View>>>;
|
|
46
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { useColors, useFills } from './provider.js';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
import { Text } from './surface.js';
|
|
7
|
+
import { Row, Usd, Percent } from './data.js';
|
|
8
|
+
import { plainText } from './text-content.js';
|
|
9
|
+
const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' };
|
|
10
|
+
/** A market as one row: its name (a button, or the host's identity in presentation mode), price and change. The ref reaches the row's root view. */
|
|
11
|
+
export const MarketRow = /* @__PURE__ */ forwardRef(function MarketRow({ symbol, name, price, change, priceOptions, changeOptions, mode = 'action', onSelect, identity, icon, favorite, volume, detail, trailing, selected, disabled, active, onPressIn, testID, style }, ref) {
|
|
12
|
+
const colors = useColors(), fills = useFills();
|
|
13
|
+
const label = `${name} (${symbol})`;
|
|
14
|
+
const lines = detail === undefined ? null : _jsxs(View, { style: { alignItems: 'flex-start' }, children: [_jsx(Text, { style: { fontSize: 16, lineHeight: 24, fontWeight: '600', color: disabled ? colors.muted : colors.text }, children: label }), typeof detail === 'string' || typeof detail === 'number' ? _jsx(Text, { style: { fontSize: 14, lineHeight: 20, color: colors.muted }, children: detail }) : detail] });
|
|
15
|
+
const detailText = detail === undefined ? '' : plainText(detail);
|
|
16
|
+
const title = mode === 'presentation'
|
|
17
|
+
? _jsx(View, { style: disabled ? { opacity: 0.5, flexShrink: 1 } : { flexShrink: 1 }, children: identity ?? lines ?? _jsx(Text, { children: label }) })
|
|
18
|
+
: lines ? _jsx(Button, { intent: 'ghost', contentMode: 'custom', accessibilityLabel: detailText ? `${label}, ${detailText}` : label, accessibilityState: selected ? { selected: true } : undefined, disabled: disabled, onPress: onSelect, onPressIn: onPressIn, testID: testID ? `${testID}-select` : undefined, style: { alignItems: 'flex-start' }, children: lines })
|
|
19
|
+
: _jsx(Button, { intent: 'ghost', accessibilityState: selected ? { selected: true } : undefined, disabled: disabled, onPress: onSelect, onPressIn: onPressIn, testID: testID ? `${testID}-select` : undefined, children: label });
|
|
20
|
+
const leading = favorite !== undefined || icon !== undefined;
|
|
21
|
+
const identityCell = leading ? _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center', gap: 8, flexShrink: 1, minWidth: 0 }, children: [favorite !== undefined ? favorite : null, icon !== undefined ? _jsx(View, { ...hidden, children: icon }) : null, title] }) : title;
|
|
22
|
+
const dim = disabled ? { opacity: 0.5 } : undefined;
|
|
23
|
+
const cells = _jsxs(_Fragment, { children: [identityCell, price !== undefined ? _jsx(View, { style: dim, children: _jsx(Usd, { value: price, options: priceOptions }) }) : null, change !== undefined ? _jsx(View, { style: dim, children: _jsx(Percent, { value: change, options: changeOptions }) }) : null, volume !== undefined ? _jsx(View, { style: dim, children: volume }) : null, trailing != null && trailing !== false ? _jsx(View, { testID: testID ? `${testID}-trailing` : undefined, style: [{ flexDirection: 'row', alignItems: 'center', gap: 8 }, dim], children: trailing }) : null, selected ? _jsx(View, { ...hidden, testID: testID ? `${testID}-check` : undefined, style: { width: 20, height: 20, alignItems: 'center', justifyContent: 'center' }, children: _jsx(View, { style: { width: 6, height: 12, borderRightWidth: 2, borderBottomWidth: 2, borderColor: colors.text, transform: [{ translateY: -1 }, { rotate: '45deg' }] } }) }) : null] });
|
|
24
|
+
const plain = !ref && !leading && detail === undefined && price !== undefined && change !== undefined && volume === undefined && trailing == null && !selected && !disabled && !active && !onPressIn && mode === 'action' && !testID && !style;
|
|
25
|
+
// Without host options the row is exactly the 0.6.0 one: the name button, the price and the change in a wrapping Row.
|
|
26
|
+
if (plain)
|
|
27
|
+
return _jsxs(Row, { children: [_jsxs(Button, { intent: 'ghost', onPress: onSelect, children: [name, " (", symbol, ")"] }), _jsx(Usd, { value: price, options: priceOptions }), _jsx(Percent, { value: change, options: changeOptions })] });
|
|
28
|
+
const state = mode === 'presentation' && (selected || disabled) ? { ...(selected ? { selected: true } : {}), ...(disabled ? { disabled: true } : {}) } : undefined;
|
|
29
|
+
return _jsx(View, { ref: ref, testID: testID, accessibilityState: state, style: [{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', flexWrap: 'wrap', gap: 12, paddingVertical: 12 }, active ? { backgroundColor: fills.well, borderRadius: 14 } : null, style], children: cells });
|
|
30
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ScrollViewProps } from 'react-native';
|
|
3
|
+
import { type SettingAction } from './setting-switch.js';
|
|
4
|
+
/** One kind of notification. Every word is host text. */
|
|
5
|
+
export interface NotificationsItem {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
checked: boolean;
|
|
10
|
+
onCheckedChange: (checked: boolean) => void;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
/** Always on and not changeable: shown on at full strength and read as unavailable. */
|
|
13
|
+
locked?: boolean;
|
|
14
|
+
/** Host content after the label, such as a badge. It is drawn only; the switch is read by `label`. */
|
|
15
|
+
labelAccessory?: React.ReactNode;
|
|
16
|
+
/** Host words for the `labelAccessory`, read after the label and a pause: `Push, New`. */
|
|
17
|
+
labelAccessoryLabel?: string;
|
|
18
|
+
/** A neutral line under the card, announced when it changes, for progress or a hint: Registering this device. */
|
|
19
|
+
hint?: string;
|
|
20
|
+
/** Why turning it on failed, under the card: Push request timed out. It is announced when it appears. */
|
|
21
|
+
error?: string;
|
|
22
|
+
/** A secondary action under the card, such as Open Settings after the permission was refused. `feedback: false` keeps the provider's press feedback off it. */
|
|
23
|
+
action?: SettingAction;
|
|
24
|
+
}
|
|
25
|
+
/** Notifications under one optional heading: Alert types. */
|
|
26
|
+
export interface NotificationsGroup {
|
|
27
|
+
id: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
items: readonly NotificationsItem[];
|
|
30
|
+
}
|
|
31
|
+
export interface NotificationsBlockProps {
|
|
32
|
+
/** Heading: Notifications. */
|
|
33
|
+
title: string;
|
|
34
|
+
/** A muted line under the header that explains the screen. */
|
|
35
|
+
description?: string;
|
|
36
|
+
/** One card each, in order. */
|
|
37
|
+
items?: readonly NotificationsItem[];
|
|
38
|
+
/** More cards under the items, in groups with an optional heading, 24dp apart. */
|
|
39
|
+
groups?: readonly NotificationsGroup[];
|
|
40
|
+
/** Shows Back on the leading edge of the header. */
|
|
41
|
+
onBack?: () => void;
|
|
42
|
+
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
43
|
+
headerAction?: React.ReactNode;
|
|
44
|
+
/** Keeps the header pinned while the cards scroll: 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. */
|
|
45
|
+
stickyHeader?: boolean;
|
|
46
|
+
/** Fill behind the pinned header once content scrolls under it. Defaults to the background role; in a sheet pass the sheet's fill. */
|
|
47
|
+
stickyHeaderBackground?: string;
|
|
48
|
+
/** The scroll view used with `stickyHeader`, such as a sheet library's own. */
|
|
49
|
+
scrollComponent?: React.ComponentType<ScrollViewProps>;
|
|
50
|
+
testID?: string;
|
|
51
|
+
}
|
|
52
|
+
/** The notifications the viewer receives, as a screen: each kind is a card with a switch and a line of explanation, and a failure to turn one on reads under its card. */
|
|
53
|
+
export declare function NotificationsBlock({ title, description, items, groups, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }: NotificationsBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import { useColors, useHIG } from './provider.js';
|
|
4
|
+
import { Text } from './surface.js';
|
|
5
|
+
import { Button } from './button.js';
|
|
6
|
+
import { SettingCard, SettingHeader, SettingSwitch } from './setting-switch.js';
|
|
7
|
+
import { StickyHeaderLayout } from './sticky-header.js';
|
|
8
|
+
/** The notifications the viewer receives, as a screen: each kind is a card with a switch and a line of explanation, and a failure to turn one on reads under its card. */
|
|
9
|
+
export function NotificationsBlock({ title, description, items = [], groups, onBack, headerAction, stickyHeader, stickyHeaderBackground, scrollComponent, testID }) {
|
|
10
|
+
const colors = useColors(), { direction } = useHIG();
|
|
11
|
+
const note = { paddingHorizontal: 20, fontSize: 14, lineHeight: 21 };
|
|
12
|
+
const card = (item) => {
|
|
13
|
+
const id = `notifications-${item.id}`;
|
|
14
|
+
return _jsxs(View, { style: { gap: 8 }, children: [_jsx(SettingCard, { testID: id, children: _jsx(SettingSwitch, { testID: `${id}-switch`, label: item.label, description: item.description, checked: item.checked, disabled: item.disabled, locked: item.locked, labelAccessory: item.labelAccessory, labelAccessoryLabel: item.labelAccessoryLabel, onCheckedChange: item.onCheckedChange }) }), item.hint ? _jsx(Text, { testID: `${id}-hint`, accessibilityLiveRegion: 'polite', style: { ...note, color: colors.muted }, children: item.hint }) : null, item.error ? _jsx(Text, { testID: `${id}-error`, accessibilityRole: 'alert', accessibilityLiveRegion: 'polite', style: { paddingHorizontal: 20, fontSize: 14, lineHeight: 21, color: colors.negative }, children: item.error }) : null, item.action ? _jsx(View, { style: { marginTop: 8 }, children: _jsx(Button, { testID: `${id}-action`, intent: 'secondary', fullWidth: true, disabled: item.action.disabled, suppressFeedback: item.action.feedback === false, onPress: item.action.onSelect, children: item.action.label }) }) : null] }, item.id);
|
|
15
|
+
};
|
|
16
|
+
const cards = items.map(card);
|
|
17
|
+
const header = _jsx(SettingHeader, { testID: 'notifications', title: title, onBack: onBack, action: headerAction });
|
|
18
|
+
const body = _jsxs(_Fragment, { children: [description ? _jsx(Text, { testID: 'notifications-description', style: { fontSize: 14, lineHeight: 21, color: colors.muted, marginTop: 16, paddingHorizontal: 4 }, children: description }) : null, items.length > 0 ? _jsx(View, { testID: 'notifications-items', style: { gap: 8, marginTop: 16 }, children: cards }) : null, groups?.map(group => _jsxs(View, { testID: `notifications-group-${group.id}`, style: { gap: 8, marginTop: 24 }, children: [group.title ? _jsx(View, { style: { direction, flexDirection: 'row', alignItems: 'center', minHeight: 44, paddingStart: 4 }, children: _jsx(Text, { testID: `notifications-group-${group.id}-title`, accessibilityRole: 'header', numberOfLines: 1, style: { flexShrink: 1, fontSize: 16, lineHeight: 24, fontWeight: '500', color: colors.muted }, children: group.title }) }) : null, group.items.map(card)] }, group.id))] });
|
|
19
|
+
if (stickyHeader)
|
|
20
|
+
return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'notifications-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
|
|
21
|
+
return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
|
|
22
|
+
}
|
package/native/dist/pickers.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
2
|
+
import { type FlatListProps, type StyleProp, type TextInput, type TextInputProps, type ViewStyle } from 'react-native';
|
|
3
3
|
import { type SwapChain, type SwapToken, type SwapWallet } from './swap-shared.js';
|
|
4
4
|
export type { SwapChain, SwapFigure, SwapToken, SwapWallet } from './swap-shared.js';
|
|
5
|
+
/** 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. */
|
|
6
|
+
export { SwapHostContext } from './swap-parts.js';
|
|
5
7
|
/** The searchable token list both pickers share. */
|
|
6
8
|
export interface PickerListProps {
|
|
7
9
|
/** Tokens offered: a wallet's holdings, a whitelist, or a whole catalog. */
|
|
@@ -18,8 +20,22 @@ export interface PickerListProps {
|
|
|
18
20
|
loading?: boolean;
|
|
19
21
|
/** Web only: focuses the search with a hardware pointer. Native never raises the keyboard on mount. */
|
|
20
22
|
autoFocus?: boolean;
|
|
23
|
+
/** `false` leaves out the search field, for a short list. Default `true`. */
|
|
24
|
+
search?: boolean;
|
|
25
|
+
/** Shows a token's balance when it is zero, where by default only a balance above zero is drawn. */
|
|
26
|
+
zeroBalances?: boolean;
|
|
27
|
+
/** A visible label over the search field, which then names it in place of the built-in label. */
|
|
28
|
+
searchLabel?: string;
|
|
29
|
+
/** A ref to the search input, for example to register it with a host bottom sheet's keyboard handling. */
|
|
30
|
+
searchRef?: React.Ref<React.ComponentRef<typeof TextInput>>;
|
|
31
|
+
/** Props for the search input, such as `onFocus`/`onBlur` for a host sheet or `returnKeyType`. The value and its change handler stay HIG's. */
|
|
32
|
+
searchInputProps?: PickerInputProps;
|
|
33
|
+
/** The list component the rows render through, such as a bottom sheet library's `FlatList`, so the list scrolls inside the host's sheet. Defaults to the `SwapHostContext` list, then React Native's `FlatList`. It receives the bounded `style` HIG sets, which the host's component may override. */
|
|
34
|
+
listComponent?: React.ComponentType<FlatListProps<SwapToken>>;
|
|
21
35
|
}
|
|
22
|
-
|
|
36
|
+
/** Host props for a picker's input: what a `TextInput` takes, except the value and its change handler. */
|
|
37
|
+
export type PickerInputProps = Omit<TextInputProps, 'value' | 'defaultValue' | 'onChangeText' | 'onChange'>;
|
|
38
|
+
export interface FromPickerBlockProps extends PickerListProps {
|
|
23
39
|
/** The connected wallet. Omit for a list with no wallet row at all. */
|
|
24
40
|
wallet?: SwapWallet;
|
|
25
41
|
/** Shows Connect wallet while no wallet is connected. */
|
|
@@ -36,8 +52,8 @@ export interface FromPickerProps extends PickerListProps {
|
|
|
36
52
|
* the tokens it holds (or a whitelist). With no wallet it offers Connect wallet and a Generate address switch above the list.
|
|
37
53
|
* The host owns the wallet, the token data and the generated address.
|
|
38
54
|
*/
|
|
39
|
-
export declare function
|
|
40
|
-
export interface
|
|
55
|
+
export declare function FromPickerBlock({ wallet, onConnect, onDisconnect, generateAddress, onGenerateAddressChange, style, ...list }: FromPickerBlockProps): React.JSX.Element;
|
|
56
|
+
export interface ToPickerBlockProps extends Partial<PickerListProps> {
|
|
41
57
|
/** The destination address field. Omit `onAddressChange` to hide it. */
|
|
42
58
|
address?: string;
|
|
43
59
|
onAddressChange?: (address: string) => void;
|
|
@@ -45,10 +61,24 @@ export interface ToPickerProps extends Partial<PickerListProps> {
|
|
|
45
61
|
addressPlaceholder?: string;
|
|
46
62
|
/** Shows the scan button. HIG ships no scanner: the host opens its own and writes the result to `address`. */
|
|
47
63
|
onScan?: () => void;
|
|
64
|
+
/** A visible label over the address field, which then names it in place of the built-in “Recipient”. */
|
|
65
|
+
addressLabel?: string;
|
|
66
|
+
/** A ref to the address input, for example to register it with a host bottom sheet's keyboard handling. */
|
|
67
|
+
addressRef?: React.Ref<React.ComponentRef<typeof TextInput>>;
|
|
68
|
+
/** Props for the address input, such as `onFocus`/`onBlur` for a host sheet, `textContentType` or a mono `style`. The value and its change handler stay HIG's. */
|
|
69
|
+
addressInputProps?: PickerInputProps;
|
|
48
70
|
style?: StyleProp<ViewStyle>;
|
|
49
71
|
}
|
|
50
72
|
/**
|
|
51
73
|
* Where the assets go. On its own it is a destination address field with a scan button. With `tokens` it adds the
|
|
52
74
|
* searchable token list, with the chain filter or, with `chainFilter={false}`, without it.
|
|
53
75
|
*/
|
|
54
|
-
export declare function
|
|
76
|
+
export declare function ToPickerBlock({ address, onAddressChange, addressPlaceholder, onScan, addressLabel, addressRef, addressInputProps, style, tokens, onSelect, ...list }: ToPickerBlockProps): React.JSX.Element;
|
|
77
|
+
/** @deprecated Renamed `FromPickerBlock`. The old name keeps working until the next major release. */
|
|
78
|
+
export declare const FromPicker: typeof FromPickerBlock;
|
|
79
|
+
/** @deprecated Renamed `FromPickerBlockProps`. */
|
|
80
|
+
export type FromPickerProps = FromPickerBlockProps;
|
|
81
|
+
/** @deprecated Renamed `ToPickerBlock`. The old name keeps working until the next major release. */
|
|
82
|
+
export declare const ToPicker: typeof ToPickerBlock;
|
|
83
|
+
/** @deprecated Renamed `ToPickerBlockProps`. */
|
|
84
|
+
export type ToPickerProps = ToPickerBlockProps;
|