@bloxwap/hig 0.6.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/chart/README.md +13 -2
- package/chart/dist/altimeter-burst.d.ts +4 -0
- package/chart/dist/altimeter-burst.js +43 -0
- package/chart/dist/altimeter-chart.d.ts +52 -0
- package/chart/dist/altimeter-chart.js +275 -0
- package/chart/dist/altimeter-model.d.ts +43 -0
- package/chart/dist/altimeter-model.js +148 -0
- package/chart/dist/altimeter-targets.d.ts +33 -0
- package/chart/dist/altimeter-targets.js +88 -0
- package/chart/dist/bitcoin-price.d.ts +8 -0
- package/chart/dist/bitcoin-price.js +41 -0
- package/chart/dist/champions-league.d.ts +19 -0
- package/chart/dist/champions-league.js +104 -0
- package/chart/dist/index.d.ts +6 -0
- package/chart/dist/index.js +5 -0
- package/chart/dist/outcome-chart.d.ts +37 -0
- package/chart/dist/outcome-chart.js +212 -0
- package/chart/dist/outcome-model.d.ts +43 -0
- package/chart/dist/outcome-model.js +71 -0
- package/chart/dist/plus-grid.d.ts +6 -0
- package/chart/dist/plus-grid.js +29 -0
- package/contracts/README.md +1 -1
- package/contracts/dist/avatar.d.ts +68 -0
- package/contracts/dist/avatar.js +93 -0
- package/contracts/dist/confetti.d.ts +174 -0
- package/contracts/dist/confetti.js +138 -0
- package/contracts/dist/decimal.d.ts +7 -0
- package/contracts/dist/decimal.js +35 -0
- package/contracts/dist/index.d.ts +45 -2
- package/contracts/dist/index.js +145 -4
- package/contracts/dist/invariants.d.ts +17 -0
- package/contracts/dist/invariants.js +24 -0
- package/contracts/dist/messages.d.ts +62 -2
- package/contracts/dist/messages.js +22 -2
- package/contracts/dist/number-flow.d.ts +90 -0
- package/contracts/dist/number-flow.js +150 -0
- package/contracts/dist/qr.d.ts +151 -0
- package/contracts/dist/qr.js +581 -0
- package/contracts/dist/toast.d.ts +168 -0
- package/contracts/dist/toast.js +171 -0
- package/feedback/README.md +1 -1
- package/feedback/dist/contract.js +1 -1
- package/feedback/dist/react.js +2 -4
- package/native/README.md +6 -1
- package/native/dist/account-block.d.ts +62 -7
- package/native/dist/account-block.js +54 -11
- package/native/dist/animated-number-model.d.ts +47 -1
- package/native/dist/animated-number-model.js +248 -21
- package/native/dist/animated-number.d.ts +41 -1
- package/native/dist/animated-number.js +165 -17
- package/native/dist/announce.d.ts +2 -0
- package/native/dist/announce.js +10 -0
- package/native/dist/asset-balance-row.d.ts +19 -1
- package/native/dist/asset-balance-row.js +24 -8
- package/native/dist/assets-block.d.ts +115 -0
- package/native/dist/assets-block.js +87 -0
- package/native/dist/async-result.d.ts +2 -0
- package/native/dist/async-result.js +11 -0
- package/native/dist/avatar-frame.d.ts +29 -0
- package/native/dist/avatar-frame.js +56 -0
- package/native/dist/avatar.d.ts +21 -0
- package/native/dist/avatar.js +31 -0
- package/native/dist/bar-mark.d.ts +16 -2
- package/native/dist/bar-mark.js +23 -7
- package/native/dist/bar-pnl.js +7 -5
- package/native/dist/blocks.d.ts +13 -14
- package/native/dist/blocks.js +10 -6
- package/native/dist/brand.js +2 -1
- package/native/dist/button.d.ts +7 -2
- package/native/dist/button.js +16 -4
- package/native/dist/checkbox.js +2 -1
- package/native/dist/confetti.d.ts +33 -0
- package/native/dist/confetti.js +143 -0
- package/native/dist/confirm-block.d.ts +98 -0
- package/native/dist/confirm-block.js +48 -0
- package/native/dist/data.d.ts +1 -1
- package/native/dist/data.js +8 -4
- package/native/dist/explainer-block.d.ts +91 -0
- package/native/dist/explainer-block.js +34 -0
- package/native/dist/field.d.ts +19 -5
- package/native/dist/field.js +56 -9
- package/native/dist/figure.d.ts +23 -0
- package/native/dist/figure.js +10 -0
- package/native/dist/gesture-sheet-model.d.ts +50 -0
- package/native/dist/gesture-sheet-model.js +105 -0
- package/native/dist/gesture-sheet-next.d.ts +82 -0
- package/native/dist/gesture-sheet-next.js +315 -0
- package/native/dist/gesture-sheet.d.ts +5 -1
- package/native/dist/gesture-sheet.js +13 -6
- package/native/dist/icons.d.ts +9 -6
- package/native/dist/icons.js +25 -24
- package/native/dist/language-block.d.ts +14 -1
- package/native/dist/language-block.js +11 -4
- package/native/dist/list-group.d.ts +44 -8
- package/native/dist/list-group.js +84 -13
- package/native/dist/manage-position-block.d.ts +35 -2
- package/native/dist/manage-position-block.js +41 -11
- package/native/dist/market-row.d.ts +46 -0
- package/native/dist/market-row.js +41 -0
- package/native/dist/navigation.js +5 -3
- package/native/dist/notifications-block.d.ts +30 -2
- package/native/dist/notifications-block.js +16 -8
- package/native/dist/number-format.d.ts +6 -0
- package/native/dist/number-format.js +9 -0
- package/native/dist/pickers.d.ts +32 -2
- package/native/dist/pickers.js +17 -9
- package/native/dist/position-block.d.ts +66 -10
- package/native/dist/position-block.js +45 -11
- package/native/dist/preset-group.d.ts +31 -0
- package/native/dist/preset-group.js +39 -0
- package/native/dist/preset-picker-block.d.ts +107 -0
- package/native/dist/preset-picker-block.js +43 -0
- package/native/dist/profile-block.d.ts +38 -5
- package/native/dist/profile-block.js +31 -6
- package/native/dist/provider.d.ts +14 -5
- package/native/dist/provider.js +32 -6
- package/native/dist/qr-code.d.ts +33 -0
- package/native/dist/qr-code.js +29 -0
- package/native/dist/radio-group.d.ts +23 -5
- package/native/dist/radio-group.js +40 -12
- package/native/dist/recipes.d.ts +6 -0
- package/native/dist/recipes.js +6 -0
- package/native/dist/reward-block.d.ts +55 -13
- package/native/dist/reward-block.js +37 -14
- package/native/dist/screen-header.d.ts +59 -0
- package/native/dist/screen-header.js +37 -0
- package/native/dist/select.js +4 -2
- package/native/dist/selection.d.ts +3 -2
- package/native/dist/selection.js +1 -0
- package/native/dist/setting-header.d.ts +2 -8
- package/native/dist/setting-header.js +2 -11
- package/native/dist/setting-switch.d.ts +15 -2
- package/native/dist/setting-switch.js +11 -4
- package/native/dist/signals-block.d.ts +26 -2
- package/native/dist/signals-block.js +14 -4
- package/native/dist/slider.js +5 -1
- package/native/dist/sound-haptics-block.d.ts +29 -2
- package/native/dist/sound-haptics-block.js +19 -8
- package/native/dist/status.d.ts +47 -14
- package/native/dist/status.js +39 -22
- package/native/dist/sticky-header.d.ts +28 -0
- package/native/dist/sticky-header.js +29 -0
- package/native/dist/surface.d.ts +3 -1
- package/native/dist/surface.js +2 -1
- package/native/dist/swap-amount-card.d.ts +57 -0
- package/native/dist/swap-amount-card.js +31 -0
- package/native/dist/swap-panel-block.d.ts +11 -4
- package/native/dist/swap-panel-block.js +67 -38
- package/native/dist/swap-parts.d.ts +5 -10
- package/native/dist/swap-parts.js +22 -24
- package/native/dist/swap-shared.d.ts +8 -2
- package/native/dist/swap-shared.js +10 -6
- package/native/dist/swap-views.js +6 -4
- 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 +40 -7
- package/native/dist/target-block.js +31 -11
- package/native/dist/toast.d.ts +47 -0
- package/native/dist/toast.js +386 -0
- package/native/dist/token-action-block.d.ts +26 -9
- package/native/dist/token-action-block.js +21 -8
- package/native/dist/trade-history-detail-block.d.ts +26 -1
- package/native/dist/trade-history-detail-block.js +17 -9
- package/native/dist/trade-history-list-block.d.ts +71 -5
- package/native/dist/trade-history-list-block.js +55 -17
- package/native/dist/wallet-address-core.d.ts +25 -0
- package/native/dist/wallet-address-core.js +34 -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 +131 -2
- package/react/README.md +3 -1
- package/react/dist/animated-number-flow.d.ts +72 -0
- package/react/dist/animated-number-flow.js +316 -0
- package/react/dist/animated-number-model.d.ts +24 -0
- package/react/dist/animated-number-model.js +106 -3
- package/react/dist/animated-number.d.ts +49 -1
- package/react/dist/animated-number.js +146 -11
- package/react/dist/asset-balance-row.d.ts +19 -1
- package/react/dist/asset-balance-row.js +17 -3
- package/react/dist/async-result.d.ts +2 -0
- package/react/dist/async-result.js +11 -0
- package/react/dist/avatar.d.ts +25 -0
- package/react/dist/avatar.js +50 -0
- package/react/dist/bar-mark.d.ts +5 -2
- package/react/dist/bar-mark.js +5 -3
- package/react/dist/blocks/account-block.d.ts +57 -7
- package/react/dist/blocks/account-block.js +51 -11
- package/react/dist/blocks/assets-block.d.ts +106 -0
- package/react/dist/blocks/assets-block.js +135 -0
- package/react/dist/blocks/confirm-block.d.ts +91 -0
- package/react/dist/blocks/confirm-block.js +31 -0
- package/react/dist/blocks/explainer-block.d.ts +80 -0
- package/react/dist/blocks/explainer-block.js +20 -0
- package/react/dist/blocks/install-command.js +3 -1
- package/react/dist/blocks/language-block.d.ts +9 -1
- package/react/dist/blocks/language-block.js +8 -6
- package/react/dist/blocks/manage-position-block.d.ts +30 -2
- package/react/dist/blocks/manage-position-block.js +23 -4
- package/react/dist/blocks/market-row.d.ts +20 -9
- package/react/dist/blocks/market-row.js +17 -4
- package/react/dist/blocks/notifications-block.d.ts +27 -2
- package/react/dist/blocks/notifications-block.js +11 -2
- package/react/dist/blocks/pickers.d.ts +30 -1
- package/react/dist/blocks/pickers.js +32 -10
- package/react/dist/blocks/position-block.d.ts +34 -11
- package/react/dist/blocks/position-block.js +16 -5
- package/react/dist/blocks/preset-picker-block.d.ts +85 -0
- package/react/dist/blocks/preset-picker-block.js +19 -0
- package/react/dist/blocks/profile-block.d.ts +33 -6
- package/react/dist/blocks/profile-block.js +31 -6
- package/react/dist/blocks/reward-block.d.ts +65 -21
- package/react/dist/blocks/reward-block.js +24 -11
- package/react/dist/blocks/screen-header.d.ts +34 -2
- package/react/dist/blocks/screen-header.js +17 -6
- package/react/dist/blocks/setting-switch.d.ts +14 -1
- package/react/dist/blocks/setting-switch.js +11 -4
- package/react/dist/blocks/signals-block.d.ts +23 -2
- package/react/dist/blocks/signals-block.js +6 -5
- package/react/dist/blocks/sound-haptics-block.d.ts +27 -3
- package/react/dist/blocks/sound-haptics-block.js +11 -7
- package/react/dist/blocks/sticky-header.d.ts +19 -0
- package/react/dist/blocks/sticky-header.js +103 -0
- package/react/dist/blocks/swap/amount-card.js +2 -1
- package/react/dist/blocks/swap/settings.js +4 -3
- package/react/dist/blocks/swap/shared.d.ts +29 -23
- package/react/dist/blocks/swap/shared.js +36 -32
- package/react/dist/blocks/swap-panel-block.d.ts +12 -3
- package/react/dist/blocks/swap-panel-block.js +72 -37
- package/react/dist/blocks/target-block.d.ts +35 -7
- package/react/dist/blocks/target-block.js +26 -12
- package/react/dist/blocks/token-action-block.d.ts +21 -8
- package/react/dist/blocks/token-action-block.js +9 -6
- package/react/dist/blocks/trade-history-detail-block.d.ts +23 -1
- package/react/dist/blocks/trade-history-detail-block.js +5 -4
- package/react/dist/blocks/trade-history-list-block.d.ts +31 -5
- package/react/dist/blocks/trade-history-list-block.js +20 -10
- package/react/dist/blocks.d.ts +12 -8
- package/react/dist/blocks.js +6 -2
- package/react/dist/brand.js +2 -1
- package/react/dist/button.d.ts +9 -3
- package/react/dist/button.js +12 -5
- package/react/dist/confetti.d.ts +27 -0
- package/react/dist/confetti.js +240 -0
- package/react/dist/data.js +11 -4
- package/react/dist/field.d.ts +20 -5
- package/react/dist/field.js +30 -8
- package/react/dist/figure.d.ts +23 -0
- package/react/dist/figure.js +12 -0
- package/react/dist/gesture-sheet.d.ts +15 -1
- package/react/dist/gesture-sheet.js +53 -8
- package/react/dist/list-group.d.ts +41 -8
- package/react/dist/list-group.js +49 -13
- package/react/dist/navigation.js +11 -3
- package/react/dist/overlay.d.ts +28 -3
- package/react/dist/overlay.js +29 -3
- package/react/dist/preset-group.d.ts +30 -0
- package/react/dist/preset-group.js +13 -0
- package/react/dist/provider.d.ts +42 -5
- package/react/dist/provider.js +84 -10
- package/react/dist/qr-code.d.ts +32 -0
- package/react/dist/qr-code.js +28 -0
- package/react/dist/select.js +10 -3
- package/react/dist/selection.d.ts +18 -4
- package/react/dist/selection.js +20 -10
- package/react/dist/slider.js +5 -1
- package/react/dist/status.d.ts +14 -10
- package/react/dist/status.js +17 -9
- package/react/dist/styles.css +380 -150
- package/react/dist/surface.d.ts +5 -1
- package/react/dist/surface.js +1 -1
- package/react/dist/toast.d.ts +19 -12
- package/react/dist/toast.js +29 -7
- package/react/dist/wallet-address-core.d.ts +27 -0
- package/react/dist/wallet-address-core.js +29 -0
- package/react/dist/wallet-address.d.ts +6 -12
- package/react/dist/wallet-address.js +5 -16
- package/tokens/README.md +2 -2
- package/tokens/dist/index.d.ts +16 -0
- package/tokens/dist/index.js +16 -0
- package/tokens/dist/manifest.json +8 -0
- package/tokens/dist/tokens.css +6 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
/** A market's live heat signal: `watch` while it is being watched, `up` or `down` once it trends. */
|
|
3
|
+
export type AssetSignal = 'watch' | 'up' | 'down';
|
|
4
|
+
/** The three views of the list: every market, the markets with an open position, and the markets with a signal. */
|
|
5
|
+
export type AssetsView = 'all' | 'positions' | 'trend';
|
|
6
|
+
/** One market the host offers. Every word is host text. */
|
|
7
|
+
export interface AssetItem {
|
|
8
|
+
/** Stable id the host switches on. */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Bitcoin. */
|
|
11
|
+
name: string;
|
|
12
|
+
/** BTC. */
|
|
13
|
+
symbol: string;
|
|
14
|
+
/** `id` of the `AssetCategory` whose section the market sits in. */
|
|
15
|
+
category: string;
|
|
16
|
+
/** Short host text after the symbol on the second line, such as the maximum leverage: `40×`. */
|
|
17
|
+
detail?: string;
|
|
18
|
+
/** Round artwork: an image URL or a host element. Without it the row shows the first letters of the symbol. */
|
|
19
|
+
icon?: string | React.ReactElement;
|
|
20
|
+
/** The trailing signal disc. `null` draws an empty disc, for a market with no signal yet; leave it out to draw no disc. */
|
|
21
|
+
signal?: AssetSignal | null;
|
|
22
|
+
/** The viewer holds an open position in this market, so it shows under Positions. */
|
|
23
|
+
position?: boolean;
|
|
24
|
+
/** Host content on the trailing edge, before the signal disc, such as the live result of the viewer's open position. It is drawn only (it sits inside the row button, hidden from assistive technology); the row reads `trailingLabel` for it. */
|
|
25
|
+
trailing?: React.ReactNode;
|
|
26
|
+
/** Words the row reads after its symbol line, such as `open position`, for what `trailing` shows. */
|
|
27
|
+
trailingLabel?: string;
|
|
28
|
+
/** More text the search matches, such as an alias or a ticker on another venue. */
|
|
29
|
+
keywords?: string;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** A market type: a section of the list and a capsule in the category filter. */
|
|
33
|
+
export interface AssetCategory {
|
|
34
|
+
id: string;
|
|
35
|
+
/** Crypto. */
|
|
36
|
+
label: string;
|
|
37
|
+
/** A badge on the section heading's trailing edge, such as OPEN. Bloxwap trades around the clock, so there is no closed badge: use `opensAt` for a legacy market that is shut. */
|
|
38
|
+
status?: {
|
|
39
|
+
label: string;
|
|
40
|
+
tone?: 'positive' | 'negative' | 'warning' | 'info';
|
|
41
|
+
};
|
|
42
|
+
/** When the legacy market behind this category next opens, as epoch milliseconds or a `Date`. While it is ahead, the badge counts down to it (“Opens in 2:14:33”) in place of `status`, and the heading reads it in words. Once it passes, `status` shows again. */
|
|
43
|
+
opensAt?: number | Date;
|
|
44
|
+
}
|
|
45
|
+
export interface AssetsBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title' | 'onSelect'> {
|
|
46
|
+
/** Shows a clear button in the search field while it holds text: it empties the query and returns focus to the field. Named by `messages.clearSearch`. */
|
|
47
|
+
clearable?: boolean;
|
|
48
|
+
/** Heading. Defaults to the built-in “Assets”. */
|
|
49
|
+
title?: string;
|
|
50
|
+
/** Shows Close on the trailing edge of the header. */
|
|
51
|
+
onClose?: () => void;
|
|
52
|
+
assets: readonly AssetItem[];
|
|
53
|
+
/** Sections and filter capsules, in order. A market whose category is not listed is not shown. */
|
|
54
|
+
categories: readonly AssetCategory[];
|
|
55
|
+
onSelect: (asset: AssetItem) => void;
|
|
56
|
+
/** `id` of the market in use: its row is marked current. */
|
|
57
|
+
selectedId?: string | null;
|
|
58
|
+
view?: AssetsView;
|
|
59
|
+
defaultView?: AssetsView;
|
|
60
|
+
onViewChange?: (view: AssetsView) => void;
|
|
61
|
+
/** `id` of the chosen category; `''` is All. */
|
|
62
|
+
category?: string;
|
|
63
|
+
defaultCategory?: string;
|
|
64
|
+
onCategoryChange?: (category: string) => void;
|
|
65
|
+
query?: string;
|
|
66
|
+
defaultQuery?: string;
|
|
67
|
+
onQueryChange?: (query: string) => void;
|
|
68
|
+
/** `false` leaves out the category filter. Defaults to `true` when there is more than one category. */
|
|
69
|
+
categoryFilter?: boolean;
|
|
70
|
+
/** Shows the loading text in place of the empty text while the list is empty. */
|
|
71
|
+
loading?: boolean;
|
|
72
|
+
/** Pins the header (title and Close) to the top of the nearest scroller while the rest scrolls, as `ScreenHeader stickyHeader` does: transparent at rest, filled once content scrolls under it. */
|
|
73
|
+
stickyHeader?: boolean;
|
|
74
|
+
/** `id` of the heading, so a dialog or sheet around the block can name itself by it (`aria-labelledby`, `GestureSheet labelledBy`). */
|
|
75
|
+
headingId?: string;
|
|
76
|
+
/** Freezes the opening countdown at the text it last showed, stops its timer and its digits rolling, for example while the block is off screen. */
|
|
77
|
+
paused?: boolean;
|
|
78
|
+
/** The host's clock in epoch milliseconds, read for the opening countdown. Defaults to `Date.now`. */
|
|
79
|
+
now?: () => number;
|
|
80
|
+
/** A button under the empty text, drawn only while the list is empty and not `loading`, such as Browse all markets on an empty Positions view. `testID` becomes its `data-testid`. */
|
|
81
|
+
emptyAction?: AssetsEmptyAction;
|
|
82
|
+
/** With a hardware pointer, focus the search field on mount so typing filters at once. */
|
|
83
|
+
autoFocusSearch?: boolean;
|
|
84
|
+
/** While the search field holds a query and the arrows have not moved, Enter chooses the first enabled match, as a search box's top hit. By default Enter then chooses only a lone match. */
|
|
85
|
+
enterChoosesFirst?: boolean;
|
|
86
|
+
}
|
|
87
|
+
/** The empty list's action. */
|
|
88
|
+
export interface AssetsEmptyAction {
|
|
89
|
+
label: string;
|
|
90
|
+
onPress: () => void;
|
|
91
|
+
testID?: string;
|
|
92
|
+
}
|
|
93
|
+
/** The markets a view, category and query leave, grouped by category in the host's order. Empty sections are dropped. */
|
|
94
|
+
export declare function filterAssets(assets: readonly AssetItem[], categories: readonly AssetCategory[], { view, category, query }?: {
|
|
95
|
+
view?: AssetsView;
|
|
96
|
+
category?: string;
|
|
97
|
+
query?: string;
|
|
98
|
+
}): {
|
|
99
|
+
category: AssetCategory;
|
|
100
|
+
assets: AssetItem[];
|
|
101
|
+
}[];
|
|
102
|
+
/**
|
|
103
|
+
* Choose a market as one screen: a header, a search field, category capsules, the All / Positions / Trend views, then the
|
|
104
|
+
* markets in sections by category, each with its icon, name, symbol and detail, and its signal disc. The host owns the data.
|
|
105
|
+
*/
|
|
106
|
+
export declare function AssetsBlock({ title, onClose, assets, categories, onSelect, selectedId, view, defaultView, onViewChange, category, defaultCategory, onCategoryChange, query, defaultQuery, onQueryChange, categoryFilter, loading, stickyHeader, headingId, clearable, paused, now: clock, emptyAction, autoFocusSearch, enterChoosesFirst, className, ...rest }: AssetsBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Eye } from '@bloxwap/icons/react/eye';
|
|
4
|
+
import { TrendingDown } from '@bloxwap/icons/react/trending-down';
|
|
5
|
+
import { TrendingUp } from '@bloxwap/icons/react/trending-up';
|
|
6
|
+
import { useEffect, useId, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { formatCountdown } from '@bloxwap/hig/contracts';
|
|
8
|
+
import { PressDecoration, useHIG, useMessages } from '../provider.js';
|
|
9
|
+
import { SearchInput } from '../field.js';
|
|
10
|
+
import { Filter, SegmentedControl } from '../selection.js';
|
|
11
|
+
import { Badge } from '../status.js';
|
|
12
|
+
import { Button } from '../button.js';
|
|
13
|
+
import { AnimatedNumberReadout } from '../animated-number.js';
|
|
14
|
+
import { ScreenHeader, HeaderClose } from './screen-header.js';
|
|
15
|
+
const fold = (text) => text.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase();
|
|
16
|
+
/** The markets a view, category and query leave, grouped by category in the host's order. Empty sections are dropped. */
|
|
17
|
+
export function filterAssets(assets, categories, { view = 'all', category = '', query = '' } = {}) {
|
|
18
|
+
const needle = fold(query.trim());
|
|
19
|
+
const keep = (asset) => (view === 'all' || (view === 'positions' ? !!asset.position : asset.signal != null)) && (needle === '' || fold(`${asset.name} ${asset.symbol} ${asset.keywords ?? ''}`).includes(needle));
|
|
20
|
+
return categories.filter(entry => category === '' || entry.id === category).map(entry => ({ category: entry, assets: assets.filter(asset => asset.category === entry.id && keep(asset)) })).filter(section => section.assets.length > 0);
|
|
21
|
+
}
|
|
22
|
+
const signalIcons = {
|
|
23
|
+
watch: _jsx(Eye, { size: 20 }),
|
|
24
|
+
up: _jsx(TrendingUp, { size: 20 }),
|
|
25
|
+
down: _jsx(TrendingDown, { size: 20 }),
|
|
26
|
+
};
|
|
27
|
+
/** Controlled when `value` is set, otherwise local. No feedback: the filter and segmented control emit their own, and typing emits none. */
|
|
28
|
+
function useHostState(value, initial, onChange) {
|
|
29
|
+
const [local, setLocal] = useState(initial);
|
|
30
|
+
const current = value === undefined ? local : value;
|
|
31
|
+
return [current, next => { if (Object.is(next, current))
|
|
32
|
+
return; if (value === undefined)
|
|
33
|
+
setLocal(next); onChange?.(next); }];
|
|
34
|
+
}
|
|
35
|
+
/** The host clock, ticking each second while one of `openings` is still ahead and not `paused`; paused keeps the last reading (or takes one) and judges "ahead" against it, so a host re-render after an opening passes keeps the frozen text. `null` until mounted, so server HTML never carries a clock that hydration would contradict. */
|
|
36
|
+
function useNow(openings, paused, clock) {
|
|
37
|
+
const [now, setNow] = useState(null);
|
|
38
|
+
const read = useRef(clock);
|
|
39
|
+
read.current = clock;
|
|
40
|
+
const reading = paused && now != null ? now : openings.length ? clock() : 0;
|
|
41
|
+
const active = openings.some(at => at > reading);
|
|
42
|
+
useEffect(() => { if (!active) {
|
|
43
|
+
setNow(null);
|
|
44
|
+
return;
|
|
45
|
+
} if (paused) {
|
|
46
|
+
setNow(last => last ?? read.current());
|
|
47
|
+
return;
|
|
48
|
+
} setNow(read.current()); const tick = setInterval(() => setNow(read.current()), 1000); return () => clearInterval(tick); }, [active, paused]);
|
|
49
|
+
return active ? now : null;
|
|
50
|
+
}
|
|
51
|
+
const opensAtTime = (category) => category.opensAt == null ? null : +category.opensAt;
|
|
52
|
+
/**
|
|
53
|
+
* Choose a market as one screen: a header, a search field, category capsules, the All / Positions / Trend views, then the
|
|
54
|
+
* markets in sections by category, each with its icon, name, symbol and detail, and its signal disc. The host owns the data.
|
|
55
|
+
*/
|
|
56
|
+
export function AssetsBlock({ title, onClose, assets, categories, onSelect, selectedId = null, view, defaultView = 'all', onViewChange, category, defaultCategory = '', onCategoryChange, query, defaultQuery = '', onQueryChange, categoryFilter, loading, stickyHeader, headingId, clearable, paused = false, now: clock = Date.now, emptyAction, autoFocusSearch, enterChoosesFirst, className, ...rest }) {
|
|
57
|
+
const t = useMessages();
|
|
58
|
+
const { locale } = useHIG();
|
|
59
|
+
const id = useId();
|
|
60
|
+
const [currentView, setView] = useHostState(view, defaultView, onViewChange);
|
|
61
|
+
const [currentCategory, setCategory] = useHostState(category, defaultCategory, onCategoryChange);
|
|
62
|
+
const [currentQuery, setQuery] = useHostState(query, defaultQuery, onQueryChange);
|
|
63
|
+
const sections = useMemo(() => filterAssets(assets, categories, { view: currentView, category: currentCategory, query: currentQuery }), [assets, categories, currentView, currentCategory, currentQuery]);
|
|
64
|
+
// The clock runs only while a section on screen has an opening still ahead.
|
|
65
|
+
const now = useNow(sections.flatMap(section => { const at = opensAtTime(section.category); return at == null ? [] : [at]; }), paused, clock);
|
|
66
|
+
const rows = useMemo(() => sections.flatMap(section => section.assets), [sections]);
|
|
67
|
+
// The cursor follows an asset, not a position, so a live update that reorders or drops rows never moves it onto another market.
|
|
68
|
+
const [activeId, setActiveId] = useState(null);
|
|
69
|
+
const active = activeId == null ? -1 : rows.findIndex(asset => asset.id === activeId);
|
|
70
|
+
const field = useRef(null), list = useRef(null);
|
|
71
|
+
useEffect(() => { if (autoFocusSearch && window.matchMedia?.('(pointer: fine)').matches)
|
|
72
|
+
field.current?.focus(); }, []);
|
|
73
|
+
useEffect(() => { setActiveId(null); }, [currentQuery, currentCategory, currentView]);
|
|
74
|
+
useEffect(() => { if (active >= 0)
|
|
75
|
+
list.current?.querySelector('[data-active]')?.scrollIntoView?.({ block: 'nearest' }); }, [active]);
|
|
76
|
+
// From the search field the arrow keys move through the enabled rows and Enter chooses one: the one the arrows reached, or, if they have not moved, the only row (or with `enterChoosesFirst` and a query, the first enabled one).
|
|
77
|
+
const step = (from, by) => { for (let index = from + by; index >= 0 && index < rows.length; index += by)
|
|
78
|
+
if (!rows[index].disabled)
|
|
79
|
+
return index; return from; };
|
|
80
|
+
const onKeyDown = (event) => {
|
|
81
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229)
|
|
82
|
+
return; // An IME commit is not a choice.
|
|
83
|
+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
|
|
84
|
+
event.preventDefault();
|
|
85
|
+
const next = step(active, event.key === 'ArrowDown' ? 1 : -1);
|
|
86
|
+
setActiveId(rows[next]?.id ?? null);
|
|
87
|
+
}
|
|
88
|
+
else if (event.key === 'Enter') {
|
|
89
|
+
const choice = activeId != null ? rows[active] : enterChoosesFirst && currentQuery.trim() !== '' ? rows.find(asset => !asset.disabled) : rows.length === 1 ? rows[0] : undefined;
|
|
90
|
+
if (choice && !choice.disabled) {
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
onSelect(choice);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
// With a row focused (by Tab or a click) the arrow keys move focus to the next or previous enabled row; Up from the first returns to the search field. Focus is then the cursor, so the field's highlight steps aside.
|
|
97
|
+
const onListKeyDown = (event) => {
|
|
98
|
+
if (event.key !== 'ArrowDown' && event.key !== 'ArrowUp')
|
|
99
|
+
return;
|
|
100
|
+
const current = event.target.closest?.('.hig-assets-row');
|
|
101
|
+
if (!current || !list.current)
|
|
102
|
+
return;
|
|
103
|
+
const buttons = [...list.current.querySelectorAll('.hig-assets-row:not(:disabled)')];
|
|
104
|
+
const index = buttons.indexOf(current);
|
|
105
|
+
event.preventDefault();
|
|
106
|
+
setActiveId(null);
|
|
107
|
+
if (event.key === 'ArrowUp' && index <= 0) {
|
|
108
|
+
field.current?.focus();
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
buttons[event.key === 'ArrowDown' ? Math.min(buttons.length - 1, index + 1) : index - 1]?.focus();
|
|
112
|
+
};
|
|
113
|
+
const heading = title ?? t.assets;
|
|
114
|
+
const signalName = { watch: t.signalWatch, up: t.signalUp, down: t.signalDown };
|
|
115
|
+
const empty = loading ? `${t.loading}…` : currentQuery.trim() !== '' ? t.noResults : currentView === 'positions' ? t.noPositions : currentView === 'trend' ? t.noTrend : t.noItems;
|
|
116
|
+
const secondLine = (asset) => asset.detail ? `${asset.symbol} · ${asset.detail}` : asset.symbol;
|
|
117
|
+
const rowName = (asset) => [asset.name, secondLine(asset), asset.trailingLabel, asset.signal ? signalName[asset.signal] : null].filter(Boolean).join(', ');
|
|
118
|
+
const row = (asset, index) => {
|
|
119
|
+
const second = secondLine(asset);
|
|
120
|
+
const signal = asset.signal === undefined ? null : _jsx("span", { className: 'hig-assets-signal', "data-signal": asset.signal ?? undefined, children: asset.signal ? signalIcons[asset.signal] : null });
|
|
121
|
+
const name = rowName(asset);
|
|
122
|
+
return _jsx("li", { children: _jsxs("button", { type: 'button', className: 'hig-assets-row', "data-asset-id": asset.id, "data-active": index === active || undefined, "aria-label": name, "aria-current": asset.id === selectedId || undefined, disabled: asset.disabled, onClick: () => onSelect(asset), children: [_jsx("span", { className: 'hig-assets-icon', "aria-hidden": 'true', children: typeof asset.icon === 'string' ? _jsx("img", { src: asset.icon, alt: '' }) : asset.icon ?? asset.symbol.slice(0, 4) }), _jsxs("span", { className: 'hig-assets-text', "aria-hidden": 'true', children: [_jsx("strong", { children: asset.name }), _jsx("span", { children: second })] }), asset.trailing != null && asset.trailing !== false ? _jsx("span", { className: 'hig-assets-trailing', "aria-hidden": 'true', children: asset.trailing }) : null, signal, _jsx(PressDecoration, { kind: 'row', disabled: !!asset.disabled })] }) }, asset.id);
|
|
123
|
+
};
|
|
124
|
+
const showFilter = (categoryFilter ?? true) && categories.length > 1;
|
|
125
|
+
const sectionHeader = (entry) => {
|
|
126
|
+
const at = opensAtTime(entry);
|
|
127
|
+
const remaining = now != null && at != null && at > now ? at - now : null, countdown = remaining != null ? formatCountdown(remaining, locale) : null;
|
|
128
|
+
const badge = countdown ? { visible: `${t.opensIn} ${countdown.visible}`, spoken: `${t.opensIn} ${countdown.spoken}`, tone: 'neutral' } : entry.status ? { visible: entry.status.label, spoken: entry.status.label, tone: entry.status.tone ?? 'positive' } : null;
|
|
129
|
+
return _jsxs("div", { className: 'hig-assets-section-header', children: [_jsx("h3", { id: `${id}-${entry.id}`, "aria-label": badge ? `${entry.label}, ${badge.spoken}` : undefined, children: entry.label }), badge && _jsx(Badge, { "aria-hidden": 'true', className: 'hig-assets-status', "data-countdown": countdown ? '' : undefined, tone: badge.tone, children: countdown && remaining != null ? _jsx(AnimatedNumberReadout, { value: Math.ceil(remaining / 1000), formattedValue: countdown.visible, animateFormatted: true, duration: paused ? 0 : undefined, prefix: `${t.opensIn} ` }) : badge.visible })] });
|
|
130
|
+
};
|
|
131
|
+
return _jsxs("section", { ...rest, className: `hig-assets-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: heading, headingId: headingId, stickyHeader: stickyHeader, action: onClose ? _jsx(HeaderClose, { onClose: onClose, label: t.close }) : undefined }), _jsx(SearchInput, { ref: field, "aria-label": t.searchMarkets, placeholder: `${t.searchMarkets}…`, value: currentQuery, onChange: event => setQuery(event.target.value), onKeyDown: onKeyDown, onClear: clearable ? () => setQuery('') : undefined, enterKeyHint: 'search', autoComplete: 'off', autoCapitalize: 'none', autoCorrect: 'off', spellCheck: false }), showFilter && _jsx(Filter, { label: t.marketCategories, options: [{ value: '', label: t.assetsAll }, ...categories.map(entry => ({ value: entry.id, label: entry.label }))], value: currentCategory, onValueChange: setCategory }), _jsx(SegmentedControl, { hideLabel: true, label: t.assetsView, options: [{ value: 'all', label: t.assetsAll }, { value: 'positions', label: t.assetsPositions }, { value: 'trend', label: t.assetsTrend }], value: currentView, onValueChange: next => setView(next) }), _jsx("span", { className: 'hig-sr-only hig-assets-cursor', "aria-live": 'polite', "aria-atomic": 'true', children: rows[active] ? rowName(rows[active]) : '' }), _jsxs("div", { ref: list, className: 'hig-assets-list', "aria-busy": loading || undefined, onKeyDown: onListKeyDown, children: [sections.length === 0 && _jsx("p", { className: 'hig-assets-empty', role: 'status', children: empty }), sections.length === 0 && !loading && emptyAction && _jsx(Button, { intent: 'secondary', "data-testid": emptyAction.testID, onClick: emptyAction.onPress, children: emptyAction.label }), sections.map(section => {
|
|
132
|
+
const first = rows.indexOf(section.assets[0]);
|
|
133
|
+
return _jsxs("section", { className: 'hig-assets-section', "aria-labelledby": `${id}-${section.category.id}`, children: [sectionHeader(section.category), _jsx("ul", { children: section.assets.map((asset, offset) => row(asset, first + offset)) })] }, section.category.id);
|
|
134
|
+
})] })] });
|
|
135
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ScreenHeaderControlProps } from './screen-header.js';
|
|
3
|
+
/** One more line under Network, such as a fee: host text on both edges. */
|
|
4
|
+
export interface ConfirmDetail {
|
|
5
|
+
label: string;
|
|
6
|
+
value: React.ReactNode;
|
|
7
|
+
/** What a `value` that is not text reads as. */
|
|
8
|
+
valueLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
/** A full-width action under Cancel and Confirm, such as “Delete anyway”: a ghost button, in the negative colour with `tone='destructive'`. */
|
|
11
|
+
export interface ConfirmTertiaryAction {
|
|
12
|
+
label: string;
|
|
13
|
+
onSelect: () => void;
|
|
14
|
+
tone?: 'destructive';
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** The button's `data-testid`. */
|
|
17
|
+
testID?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ConfirmBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
|
|
20
|
+
/** The amount being sent, in token units. `null` reads as unknown. Leave it out, with `symbol`, `address` and `network`, for a confirmation that is not a send, such as signing out: the block then draws only the header, `children`, the notice and the actions. */
|
|
21
|
+
amount?: number | null;
|
|
22
|
+
/** The token's ticker, after the amount: HYPE. */
|
|
23
|
+
symbol?: string;
|
|
24
|
+
/** Format of the amount. Defaults to at most six fraction digits. */
|
|
25
|
+
amountOptions?: Intl.NumberFormatOptions;
|
|
26
|
+
/** What the amount is read as before the figure, such as “Amount” (“Amount: 2.5”, then the ticker). Without it the figure is read alone. */
|
|
27
|
+
amountLabel?: string;
|
|
28
|
+
/** The destination address, shown in full beside “To”, always as two rows, with the first 4 characters (6 with a `0x` prefix) and the last 4 emphasised and the rest muted. */
|
|
29
|
+
address?: string;
|
|
30
|
+
/** The network the send moves on: HyperEVM. */
|
|
31
|
+
network?: string;
|
|
32
|
+
/** What is being confirmed, drawn as given under the header (and under the amount and lines of a send): usually a muted `Text`, a `List` of consequences, an `Alert` or a `ListGroup`. */
|
|
33
|
+
children?: React.ReactNode;
|
|
34
|
+
/** A bulleted list under `children`, in the muted colour, such as what deleting an account loses. */
|
|
35
|
+
points?: readonly React.ReactNode[];
|
|
36
|
+
/** The confirming action's intent: `primary` (the default), `destructive`, for an action that deletes or ends something, or `warning`, the warning role's fill, for an action that goes ahead despite a caution, such as confirming past a `warning`. */
|
|
37
|
+
confirmIntent?: 'primary' | 'destructive' | 'warning';
|
|
38
|
+
/** A full-width action under Cancel and Confirm, such as “Delete anyway”. Unavailable while `busy`, unless `cancelWhileBusy` is set. */
|
|
39
|
+
tertiaryAction?: ConfirmTertiaryAction;
|
|
40
|
+
/** More lines under Network, such as a fee. */
|
|
41
|
+
details?: readonly ConfirmDetail[];
|
|
42
|
+
/** Draws the Network line and each of `details` on one line: the label keeps its width and the value truncates with an ellipsis instead of wrapping. A value that is not text should be inline content, such as a span, for the ellipsis to show. The address keeps its two rows. Off by default. */
|
|
43
|
+
oneLineDetails?: boolean;
|
|
44
|
+
/** Heading. Defaults to the built-in “Confirm Send”. */
|
|
45
|
+
title?: string;
|
|
46
|
+
/** Heading of the warning. Defaults to the built-in “Double-check the address.” */
|
|
47
|
+
warningTitle?: string;
|
|
48
|
+
/** Body of the warning. Defaults to the built-in sentence naming the token and network when `address` is given, and to none otherwise; `null` or `false` draws no warning. */
|
|
49
|
+
warning?: React.ReactNode;
|
|
50
|
+
/** A notice between the warning and the actions, drawn as given, such as an error `Alert` when a fee cannot be read or the send failed. Nothing by default. */
|
|
51
|
+
notice?: React.ReactNode;
|
|
52
|
+
/** Called when the user confirms. The host signs and sends. */
|
|
53
|
+
onConfirm: () => void;
|
|
54
|
+
/** Text of the confirming action. Defaults to the built-in “Confirm Send”. */
|
|
55
|
+
confirmLabel?: string;
|
|
56
|
+
/** The send is in progress: the confirming action shows a spinner and ignores presses, and Back, Cancel and the tertiary action are unavailable. */
|
|
57
|
+
busy?: boolean;
|
|
58
|
+
/** Draws the confirming action unavailable, for example while a quote refreshes. */
|
|
59
|
+
confirmDisabled?: boolean;
|
|
60
|
+
/** Keeps Back, Cancel and the tertiary action available while `busy`, for a wait the user may walk away from, such as a wallet signature the host can abandon. Off by default. */
|
|
61
|
+
cancelWhileBusy?: boolean;
|
|
62
|
+
/** Keeps only Back available while `busy`: the user may leave the pane while the action finishes, but Cancel and the tertiary action stay held, since they cannot stop it. Off by default; `cancelWhileBusy` frees Back as well. */
|
|
63
|
+
backWhileBusy?: boolean;
|
|
64
|
+
/** Shows Cancel on the leading side of the confirming action, the two sharing the row equally. Without it the confirming action takes the full width. */
|
|
65
|
+
onCancel?: () => void;
|
|
66
|
+
/** Text of Cancel. Defaults to the built-in “Cancel”. */
|
|
67
|
+
cancelLabel?: string;
|
|
68
|
+
/** Draws Cancel unavailable without `busy`, for example while the host's own work runs and the confirming action is a step that does not show a spinner. */
|
|
69
|
+
cancelDisabled?: boolean;
|
|
70
|
+
/** The confirming action's `data-testid`. */
|
|
71
|
+
confirmTestID?: string;
|
|
72
|
+
/** Cancel's `data-testid`. */
|
|
73
|
+
cancelTestID?: string;
|
|
74
|
+
/** Shows Back on the leading edge of the header. */
|
|
75
|
+
onBack?: () => void;
|
|
76
|
+
/** Attributes for the header's Back `<button>`, such as a `data-testid`, as `ScreenHeader` takes them. */
|
|
77
|
+
backProps?: ScreenHeaderControlProps;
|
|
78
|
+
/** A control on the trailing edge of the header, usually an `IconButton`. */
|
|
79
|
+
headerAction?: React.ReactNode;
|
|
80
|
+
/** Pins the header to the top of the nearest scroller: transparent at rest, filled once content scrolls under it, and still when it starts to stick. See Pinned headers. */
|
|
81
|
+
stickyHeader?: boolean;
|
|
82
|
+
/** `id` of the header's heading, so a host dialog or sheet can name itself with `aria-labelledby`. */
|
|
83
|
+
headingId?: string;
|
|
84
|
+
}
|
|
85
|
+
/** The address as the two rows the block draws: split at the middle, with `anchor` on the characters people compare, the first 4 (6 when it starts with `0x`) and the last 4. An address too short to have a middle is all anchor. */
|
|
86
|
+
export declare function confirmAddressRows(address: string): {
|
|
87
|
+
text: string;
|
|
88
|
+
anchor: boolean;
|
|
89
|
+
}[][];
|
|
90
|
+
/** The last look before a send: the amount as the headline, where it goes and on which network, a warning that it cannot be taken back, then Cancel and Confirm side by side. Without an amount, address or network it confirms anything else, such as signing out or deleting an account: the header, `children`, then the actions. */
|
|
91
|
+
export declare function ConfirmBlock({ amount, symbol, amountOptions, amountLabel, address, network, details, oneLineDetails, children, points, confirmIntent, tertiaryAction, title, warningTitle, warning, notice, onConfirm, confirmLabel, busy, confirmDisabled, cancelWhileBusy, backWhileBusy, onCancel, cancelLabel, cancelDisabled, confirmTestID, cancelTestID, onBack, backProps, headerAction, stickyHeader, headingId, className, ...rest }: ConfirmBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as en from '@bloxwap/hig/contracts/messages';
|
|
4
|
+
import { useHIG } from '../provider.js';
|
|
5
|
+
import { Button } from '../button.js';
|
|
6
|
+
import { AnimatedNumberReadout } from '../animated-number.js';
|
|
7
|
+
import { ScreenHeader } from './screen-header.js';
|
|
8
|
+
const amountFormat = { maximumFractionDigits: 6 };
|
|
9
|
+
/** The address as the two rows the block draws: split at the middle, with `anchor` on the characters people compare, the first 4 (6 when it starts with `0x`) and the last 4. An address too short to have a middle is all anchor. */
|
|
10
|
+
export function confirmAddressRows(address) {
|
|
11
|
+
const characters = Array.from(address), head = address.startsWith('0x') ? 6 : 4, tail = characters.length - 4, split = Math.ceil(characters.length / 2);
|
|
12
|
+
return [characters.slice(0, split), characters.slice(split)].map((row, rowIndex) => {
|
|
13
|
+
const parts = [];
|
|
14
|
+
row.forEach((character, index) => { const position = rowIndex * split + index, anchor = position < head || position >= tail, last = parts[parts.length - 1]; if (last && last.anchor === anchor)
|
|
15
|
+
last.text += character;
|
|
16
|
+
else
|
|
17
|
+
parts.push({ text: character, anchor }); });
|
|
18
|
+
return parts;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** The last look before a send: the amount as the headline, where it goes and on which network, a warning that it cannot be taken back, then Cancel and Confirm side by side. Without an amount, address or network it confirms anything else, such as signing out or deleting an account: the header, `children`, then the actions. */
|
|
22
|
+
export function ConfirmBlock({ amount, symbol, amountOptions = amountFormat, amountLabel, address, network, details, oneLineDetails, children, points, confirmIntent = 'primary', tertiaryAction, title, warningTitle, warning, notice, onConfirm, confirmLabel, busy, confirmDisabled, cancelWhileBusy, backWhileBusy, onCancel, cancelLabel, cancelDisabled, confirmTestID, cancelTestID, onBack, backProps, headerAction, stickyHeader, headingId, className, ...rest }) {
|
|
23
|
+
const { messages } = useHIG();
|
|
24
|
+
// What busy holds besides the confirming action: Back, Cancel and the tertiary action, unless the host lets them leave the wait (Back alone with backWhileBusy).
|
|
25
|
+
const held = !!busy && !cancelWhileBusy;
|
|
26
|
+
const backHeld = held && !backWhileBusy;
|
|
27
|
+
const heading = title ?? messages.confirmSend ?? en.confirmSend;
|
|
28
|
+
const body = warning === undefined ? (address !== undefined ? (messages.sendWarning ?? en.sendWarning)(symbol ?? '', network ?? '') : null) : warning;
|
|
29
|
+
const hasLines = address !== undefined || network !== undefined || !!details?.length;
|
|
30
|
+
return _jsxs("section", { ...rest, className: `hig-confirm${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: heading, onBack: onBack, backDisabled: backHeld, backProps: backProps, action: headerAction, headingId: headingId, stickyHeader: stickyHeader }), amount !== undefined && _jsxs("p", { className: 'hig-confirm-amount', children: [_jsx(AnimatedNumberReadout, { value: amount, options: amountOptions, label: amountLabel }), symbol ? _jsxs(_Fragment, { children: [" ", _jsx("span", { className: 'hig-confirm-symbol', children: symbol })] }) : null] }), hasLines && _jsxs("dl", { className: 'hig-confirm-details', "data-one-line": oneLineDetails || undefined, children: [address !== undefined && _jsxs("div", { children: [_jsx("dt", { children: messages.sendTo ?? en.sendTo }), _jsx("dd", { children: _jsxs("span", { className: 'hig-confirm-address', dir: 'ltr', translate: 'no', children: [_jsx("span", { className: 'hig-sr-only', children: address }), _jsx("span", { "aria-hidden": 'true', children: confirmAddressRows(address).map((row, index) => _jsx("span", { children: row.map((part, offset) => _jsx("span", { "data-anchor": part.anchor || undefined, children: part.text }, offset)) }, index)) })] }) })] }), network !== undefined && _jsxs("div", { children: [_jsx("dt", { children: messages.sendNetwork ?? en.sendNetwork }), _jsx("dd", { children: network })] }), details?.map(detail => _jsxs("div", { children: [_jsx("dt", { children: detail.label }), _jsx("dd", { children: detail.valueLabel ? _jsxs(_Fragment, { children: [_jsx("span", { className: 'hig-sr-only', children: detail.valueLabel }), _jsx("span", { "aria-hidden": 'true', children: detail.value })] }) : detail.value })] }, detail.label))] }), (children != null && children !== false || !!points?.length) && _jsxs("div", { className: 'hig-confirm-body', children: [children, points?.length ? _jsx("ul", { className: 'hig-confirm-points', children: points.map((point, index) => _jsx("li", { children: point }, index)) }) : null] }), body != null && body !== false && _jsxs("div", { className: 'hig-confirm-warning', role: 'note', children: [_jsx("strong", { children: warningTitle ?? messages.sendWarningTitle ?? en.sendWarningTitle }), _jsx("p", { children: body })] }), notice, _jsxs("div", { className: 'hig-confirm-actions', children: [onCancel && _jsx(Button, { intent: 'secondary', disabled: held || cancelDisabled, "data-testid": cancelTestID, onClick: onCancel, children: cancelLabel ?? messages.cancel ?? en.cancel }), _jsx(Button, { intent: confirmIntent, busy: busy, disabled: confirmDisabled, "data-testid": confirmTestID, onClick: onConfirm, children: confirmLabel ?? messages.confirmSend ?? en.confirmSend })] }), tertiaryAction && _jsx(Button, { className: 'hig-confirm-tertiary', "data-tone": tertiaryAction.tone, "data-testid": tertiaryAction.testID, intent: 'ghost', fullWidth: true, disabled: held || tertiaryAction.disabled, onClick: tertiaryAction.onSelect, children: tertiaryAction.label })] });
|
|
31
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type ScreenHeaderControlProps } from './screen-header.js';
|
|
3
|
+
/** The colour of a section: its tint, its icon disc and its heading. */
|
|
4
|
+
export type ExplainerTone = 'up' | 'down' | 'positive' | 'negative' | 'warning';
|
|
5
|
+
/** One titled part of the explanation. Every field is optional, so a section can be a heading and a sentence, an icon row, or host media with a caption. */
|
|
6
|
+
export interface ExplainerSection {
|
|
7
|
+
/** Stable key, also used in native test IDs. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** The section's heading: Up. */
|
|
10
|
+
title?: string;
|
|
11
|
+
/** Muted text after the heading on the same line, such as what the heading means: → Momentum is rising. */
|
|
12
|
+
meaning?: string;
|
|
13
|
+
/** A glyph on the leading edge in a disc, drawn in `currentColor` (the tone's colour). Decorative: hidden from assistive technology. */
|
|
14
|
+
icon?: React.ReactNode;
|
|
15
|
+
/** Tints the section, its disc and its heading. Without it the section sits on the neutral fill. */
|
|
16
|
+
tone?: ExplainerTone;
|
|
17
|
+
/** Host content under the heading and before the body, centred, such as an example card and its caption. */
|
|
18
|
+
media?: React.ReactNode;
|
|
19
|
+
/** The section's text, muted. */
|
|
20
|
+
body?: React.ReactNode;
|
|
21
|
+
/** A small note at the end of the section, such as what the signal does not promise. */
|
|
22
|
+
caveat?: React.ReactNode;
|
|
23
|
+
/** The section's `data-testid`. */
|
|
24
|
+
testID?: string;
|
|
25
|
+
}
|
|
26
|
+
/** One action at the foot of the block. */
|
|
27
|
+
export interface ExplainerAction {
|
|
28
|
+
label: string;
|
|
29
|
+
onSelect: () => void;
|
|
30
|
+
/** Defaults to `primary` for `primaryAction` and `secondary` for `secondaryAction`. */
|
|
31
|
+
intent?: 'primary' | 'secondary' | 'destructive' | 'ghost';
|
|
32
|
+
disabled?: boolean;
|
|
33
|
+
busy?: boolean;
|
|
34
|
+
/** The button's `data-testid`. */
|
|
35
|
+
testID?: string;
|
|
36
|
+
/** A glyph after the label, such as an arrow for an action that opens something outside the app. Decorative: hidden from assistive technology, so the label alone names the button. */
|
|
37
|
+
icon?: React.ReactNode;
|
|
38
|
+
}
|
|
39
|
+
export interface ExplainerBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
|
|
40
|
+
/** Heading of the header. Leave it out inside a host dialog or sheet that draws its own title. */
|
|
41
|
+
title?: string;
|
|
42
|
+
/** A kicker above the title in small muted capitals: Builder fee. With `title` it is centred in the header over the heading; without one it is the block's first line. Host text. */
|
|
43
|
+
eyebrow?: string;
|
|
44
|
+
/** Short host text in a badge beside the title, as `ScreenHeader` `badge` (needs `title`): Demo. */
|
|
45
|
+
badge?: string;
|
|
46
|
+
/** A large figure or host media centred under the header and before the lead, such as a 68px “4% off” or a donut. Drawn as given; the host sets its size and colour, and hides decorative media from assistive technology. */
|
|
47
|
+
hero?: React.ReactNode;
|
|
48
|
+
/** A lead paragraph under the header, muted. */
|
|
49
|
+
description?: React.ReactNode;
|
|
50
|
+
/** The titled sections, in order. */
|
|
51
|
+
sections?: readonly ExplainerSection[];
|
|
52
|
+
/** Numbered steps after the sections, such as how to finish a task. */
|
|
53
|
+
steps?: readonly React.ReactNode[];
|
|
54
|
+
/** A small note after the sections and steps, such as what the whole explanation does not promise. */
|
|
55
|
+
caveat?: React.ReactNode;
|
|
56
|
+
/** Host content after the sections, steps and closing note and before the actions, such as a field, a link or a share card. Drawn as given. */
|
|
57
|
+
children?: React.ReactNode;
|
|
58
|
+
/** The main action: Got it, Copy link. */
|
|
59
|
+
primaryAction?: ExplainerAction;
|
|
60
|
+
/** A second action on the leading side of the main one, the two sharing the row equally: Not now. */
|
|
61
|
+
secondaryAction?: ExplainerAction;
|
|
62
|
+
/** Keeps the provider's feedback off the actions, for a host that plays its own cue. */
|
|
63
|
+
suppressFeedback?: boolean;
|
|
64
|
+
/** Shows Back on the leading edge of the header (needs `title`). */
|
|
65
|
+
onBack?: () => void;
|
|
66
|
+
/** Attributes for the header's Back `<button>`. */
|
|
67
|
+
backProps?: ScreenHeaderControlProps;
|
|
68
|
+
/** A control on the trailing edge of the header, such as a Close `IconButton`. */
|
|
69
|
+
headerAction?: React.ReactNode;
|
|
70
|
+
/** `id` of the header's heading, so a dialog or sheet can name itself with `aria-labelledby`. */
|
|
71
|
+
headingId?: string;
|
|
72
|
+
/** Pins the header to the top of the nearest scroller. See Pinned headers. */
|
|
73
|
+
stickyHeader?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* How something works, or how to finish a task: an optional header, a lead paragraph, titled sections (each with an optional icon and
|
|
77
|
+
* tone, a heading, media, a body and a caveat), numbered steps, a closing note, then one or two actions. Draws the “How Swing works” and
|
|
78
|
+
* “How Trend works” sheets and short task dialogs such as inviting a friend.
|
|
79
|
+
*/
|
|
80
|
+
export declare function ExplainerBlock({ title, eyebrow, badge, hero, description, sections, steps, caveat, children, primaryAction, secondaryAction, suppressFeedback, onBack, backProps, headerAction, headingId, stickyHeader, className, ...rest }: ExplainerBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from 'react';
|
|
4
|
+
import { Button } from '../button.js';
|
|
5
|
+
import { ScreenHeader } from './screen-header.js';
|
|
6
|
+
/** The actions' default intents. */
|
|
7
|
+
const primaryIntent = 'primary', secondaryIntent = 'secondary';
|
|
8
|
+
/**
|
|
9
|
+
* How something works, or how to finish a task: an optional header, a lead paragraph, titled sections (each with an optional icon and
|
|
10
|
+
* tone, a heading, media, a body and a caveat), numbered steps, a closing note, then one or two actions. Draws the “How Swing works” and
|
|
11
|
+
* “How Trend works” sheets and short task dialogs such as inviting a friend.
|
|
12
|
+
*/
|
|
13
|
+
export function ExplainerBlock({ title, eyebrow, badge, hero, description, sections = [], steps = [], caveat, children, primaryAction, secondaryAction, suppressFeedback, onBack, backProps, headerAction, headingId, stickyHeader, className, ...rest }) {
|
|
14
|
+
const id = useId();
|
|
15
|
+
const action = (entry, fallback) => _jsxs(Button, { intent: entry.intent ?? fallback, disabled: entry.disabled, busy: entry.busy, suppressFeedback: suppressFeedback, "data-testid": entry.testID, onClick: entry.onSelect, children: [entry.label, entry.icon != null && entry.icon !== false ? _jsx("span", { className: 'hig-explainer-action-icon', "aria-hidden": 'true', children: entry.icon }) : null] });
|
|
16
|
+
return _jsxs("section", { ...rest, className: `hig-explainer${className ? ` ${className}` : ''}`, children: [title !== undefined ? _jsx(ScreenHeader, { title: title, eyebrow: eyebrow, badge: badge, onBack: onBack, backProps: backProps, action: headerAction, headingId: headingId, stickyHeader: stickyHeader }) : eyebrow ? _jsx("p", { className: 'hig-explainer-eyebrow', children: eyebrow }) : null, hero != null && hero !== false && _jsx("div", { className: 'hig-explainer-hero', children: hero }), description != null && description !== false && _jsx("p", { className: 'hig-explainer-text', children: description }), sections.length > 0 && _jsx("div", { className: 'hig-explainer-sections', children: sections.map(section => {
|
|
17
|
+
const heading = section.title !== undefined ? `${id}-${section.id}` : undefined;
|
|
18
|
+
return _jsxs("div", { className: 'hig-explainer-section', "data-tone": section.tone, "data-testid": section.testID, children: [section.icon != null && _jsx("span", { className: 'hig-explainer-icon', "aria-hidden": 'true', children: section.icon }), _jsxs("div", { children: [section.title !== undefined && _jsxs("h3", { id: heading, children: [section.title, section.meaning ? _jsxs(_Fragment, { children: [" ", _jsx("span", { children: section.meaning })] }) : null] }), section.media != null && _jsx("div", { className: 'hig-explainer-media', children: section.media }), section.body != null && section.body !== false && _jsx("div", { className: 'hig-explainer-text', children: section.body }), section.caveat != null && section.caveat !== false && _jsx("p", { className: 'hig-explainer-text', "data-caveat": '', children: section.caveat })] })] }, section.id);
|
|
19
|
+
}) }), steps.length > 0 && _jsx("ol", { className: 'hig-explainer-steps hig-explainer-text', children: steps.map((step, index) => _jsx("li", { children: step }, index)) }), caveat != null && caveat !== false && _jsx("p", { className: 'hig-explainer-text', "data-caveat": '', children: caveat }), children, (primaryAction || secondaryAction) && _jsxs("div", { className: 'hig-confirm-actions', children: [secondaryAction && action(secondaryAction, secondaryIntent), primaryAction && action(primaryAction, primaryIntent)] })] });
|
|
20
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useAsyncResult } from '../async-result.js';
|
|
3
4
|
import { useState } from 'react';
|
|
4
5
|
import * as en from '@bloxwap/hig/contracts/messages';
|
|
5
6
|
import { useHIG } from '../provider.js';
|
|
@@ -10,6 +11,7 @@ import { notify } from '../notify.js';
|
|
|
10
11
|
export function InstallCommand({ command, onCopy }) {
|
|
11
12
|
const { messages } = useHIG();
|
|
12
13
|
const [status, setStatus] = useState({ text: '', toasted: false });
|
|
14
|
+
const beginCopy = useAsyncResult(command);
|
|
13
15
|
const report = (text, severity) => setStatus({ text, toasted: notify(text, { severity, id: 'hig-install-command', dismissName: (messages.dismissNotice ?? en.dismissNotice)(text, messages.dismiss ?? en.dismiss) }) });
|
|
14
|
-
return _jsxs(Surface, { children: [_jsx("pre", { className: 'hig-code', tabIndex: 0, children: _jsx("code", { children: command }) }), _jsx(Button, { intent: 'secondary', onClick: () => { Promise.resolve().then(onCopy).then(() => report(messages.copied ?? en.copied, 'success')).catch(() => report(messages.copyFailed ?? en.copyFailed, 'error')); }, children: messages.copyInstallCommand ?? en.copyInstallCommand }), _jsx("p", { role: 'status', className: status.toasted ? 'hig-sr-only' : undefined, children: status.text })] });
|
|
16
|
+
return _jsxs(Surface, { children: [_jsx("pre", { className: 'hig-code', tabIndex: 0, children: _jsx("code", { children: command }) }), _jsx(Button, { intent: 'secondary', onClick: () => { const current = beginCopy(); Promise.resolve().then(onCopy).then(() => current() && report(messages.copied ?? en.copied, 'success')).catch(() => current() && report(messages.copyFailed ?? en.copyFailed, 'error')); }, children: messages.copyInstallCommand ?? en.copyInstallCommand }), _jsx("p", { role: 'status', className: status.toasted ? 'hig-sr-only' : undefined, children: status.text })] });
|
|
15
17
|
}
|
|
@@ -17,10 +17,18 @@ export interface LanguageBlockProps extends Omit<React.HTMLAttributes<HTMLElemen
|
|
|
17
17
|
onBack?: () => void;
|
|
18
18
|
/** A control on the trailing edge of the header, usually an `IconButton` that closes the sheet. */
|
|
19
19
|
headerAction?: React.ReactNode;
|
|
20
|
+
/** Pins the header to the top of the nearest scroller: transparent at rest, filled once content scrolls under it, and still when it starts to stick. See Pinned headers. */
|
|
21
|
+
stickyHeader?: boolean;
|
|
22
|
+
/** `id` of the header's heading, so a host dialog or sheet can name itself with `aria-labelledby`. */
|
|
23
|
+
headingId?: string;
|
|
20
24
|
languages: readonly LanguageOption[];
|
|
21
25
|
/** `code` of the language in use. */
|
|
22
26
|
value?: string | null;
|
|
23
27
|
onSelect: (language: LanguageOption) => void;
|
|
28
|
+
/** Dims the rows and ignores presses, for example while a change is being applied. */
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
/** A muted line under the header that explains the screen: Choose the language used throughout the app. */
|
|
31
|
+
description?: string;
|
|
24
32
|
/** Set false to leave out the search field, for a short list. Default `true`. */
|
|
25
33
|
search?: boolean;
|
|
26
34
|
/** With a hardware pointer, focus the search field on mount so typing filters at once. */
|
|
@@ -29,4 +37,4 @@ export interface LanguageBlockProps extends Omit<React.HTMLAttributes<HTMLElemen
|
|
|
29
37
|
/** The languages whose name, description or code contains the query, ignoring case and accents. An empty query keeps every language, in the host's order. */
|
|
30
38
|
export declare function filterLanguages(languages: readonly LanguageOption[], query: string): LanguageOption[];
|
|
31
39
|
/** Choose the app's language: a header, a search field, then each language as a row with its flag, its own name over the reader's name for it, and a check on the one in use. */
|
|
32
|
-
export declare function LanguageBlock({ title, onBack, headerAction, languages, value, onSelect, search, autoFocus, className, ...rest }: LanguageBlockProps): React.JSX.Element;
|
|
40
|
+
export declare function LanguageBlock({ title, onBack, headerAction, languages, value, onSelect, search, autoFocus, disabled, description, stickyHeader, headingId, className, ...rest }: LanguageBlockProps): React.JSX.Element;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Check } from '@bloxwap/icons/react/check';
|
|
3
4
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
4
5
|
import * as en from '@bloxwap/hig/contracts/messages';
|
|
5
|
-
import { useHIG } from '../provider.js';
|
|
6
|
+
import { PressDecoration, useHIG } from '../provider.js';
|
|
6
7
|
import { SearchInput } from '../field.js';
|
|
7
8
|
import { ScreenHeader } from './screen-header.js';
|
|
8
9
|
const fold = (text) => text.normalize('NFD').replace(/[̀-ͯ]/g, '').toLowerCase();
|
|
@@ -11,9 +12,9 @@ export function filterLanguages(languages, query) {
|
|
|
11
12
|
const needle = fold(query.trim());
|
|
12
13
|
return needle === '' ? [...languages] : languages.filter(language => fold(`${language.name} ${language.description ?? ''} ${language.code}`).includes(needle));
|
|
13
14
|
}
|
|
14
|
-
const check = _jsx(
|
|
15
|
+
const check = _jsx(Check, { size: 20, className: 'hig-language-check' });
|
|
15
16
|
/** Choose the app's language: a header, a search field, then each language as a row with its flag, its own name over the reader's name for it, and a check on the one in use. */
|
|
16
|
-
export function LanguageBlock({ title, onBack, headerAction, languages, value = null, onSelect, search = true, autoFocus, className, ...rest }) {
|
|
17
|
+
export function LanguageBlock({ title, onBack, headerAction, languages, value = null, onSelect, search = true, autoFocus, disabled, description, stickyHeader, headingId, className, ...rest }) {
|
|
17
18
|
const { messages } = useHIG();
|
|
18
19
|
const heading = title ?? messages.language ?? en.language;
|
|
19
20
|
const [query, setQuery] = useState('');
|
|
@@ -39,13 +40,14 @@ export function LanguageBlock({ title, onBack, headerAction, languages, value =
|
|
|
39
40
|
const choice = rows[active] ?? (rows.length === 1 ? rows[0] : undefined);
|
|
40
41
|
if (choice) {
|
|
41
42
|
event.preventDefault();
|
|
42
|
-
|
|
43
|
+
if (!disabled)
|
|
44
|
+
onSelect(choice);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
47
|
};
|
|
46
48
|
const label = messages.searchLanguages ?? en.searchLanguages;
|
|
47
|
-
return _jsxs("section", { ...rest, className: `hig-language-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: heading, onBack: onBack, action: headerAction }), search && _jsx(SearchInput, { ref: field, "aria-label": label, placeholder: label, value: query, onChange: event => setQuery(event.target.value), onKeyDown: onKeyDown, enterKeyHint: 'search', autoComplete: 'off', autoCapitalize: 'none', autoCorrect: 'off', spellCheck: false }), rows.length === 0 && _jsx("p", { className: 'hig-swap-empty', role: 'status', children: messages.noResults ?? en.noResults }), rows.length > 0 && _jsx("div", { ref: list, className: 'hig-language-list', role: 'radiogroup', "aria-label": heading, children: rows.map((language, index) => {
|
|
49
|
+
return _jsxs("section", { ...rest, className: `hig-language-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: heading, onBack: onBack, action: headerAction, headingId: headingId, stickyHeader: stickyHeader }), description && _jsx("p", { className: 'hig-settings-description', children: description }), search && _jsx(SearchInput, { ref: field, "aria-label": label, placeholder: label, value: query, onChange: event => setQuery(event.target.value), onKeyDown: onKeyDown, enterKeyHint: 'search', autoComplete: 'off', autoCapitalize: 'none', autoCorrect: 'off', spellCheck: false }), rows.length === 0 && _jsx("p", { className: 'hig-swap-empty', role: 'status', children: messages.noResults ?? en.noResults }), rows.length > 0 && _jsx("div", { ref: list, className: 'hig-language-list', role: 'radiogroup', "aria-label": heading, "aria-disabled": disabled || undefined, children: rows.map((language, index) => {
|
|
48
50
|
const selected = language.code === value;
|
|
49
|
-
return _jsxs("button", { type: 'button', role: 'radio', "aria-checked": selected, lang: language.code, className: 'hig-language-row', "data-active": index === active || undefined, onClick: () => onSelect(language), children: [_jsx("span", { className: 'hig-language-flag', "aria-hidden": 'true', children: typeof language.flag === 'string' ? _jsx("img", { src: language.flag, alt: '' }) : language.flag ?? language.code.slice(0, 2).toUpperCase() }), _jsxs("span", { className: 'hig-language-text', children: [_jsx("strong", { children: language.name }), language.description && _jsx("span", { lang: '', children: language.description })] }), selected && check] }, language.code);
|
|
51
|
+
return _jsxs("button", { type: 'button', role: 'radio', "aria-checked": selected, lang: language.code, className: 'hig-language-row', "data-active": index === active || undefined, disabled: disabled, onClick: () => onSelect(language), children: [_jsx("span", { className: 'hig-language-flag', "aria-hidden": 'true', children: typeof language.flag === 'string' ? _jsx("img", { src: language.flag, alt: '' }) : language.flag ?? language.code.slice(0, 2).toUpperCase() }), _jsxs("span", { className: 'hig-language-text', children: [_jsx("strong", { children: language.name }), language.description && _jsx("span", { lang: '', children: language.description })] }), selected && check, _jsx(PressDecoration, { kind: 'row', disabled: !!disabled })] }, language.code);
|
|
50
52
|
}) })] });
|
|
51
53
|
}
|