@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.
Files changed (199) hide show
  1. package/README.md +1 -1
  2. package/chart/README.md +1 -1
  3. package/contracts/README.md +1 -1
  4. package/contracts/dist/index.d.ts +16 -0
  5. package/contracts/dist/index.js +22 -0
  6. package/contracts/dist/messages.d.ts +37 -4
  7. package/contracts/dist/messages.js +13 -2
  8. package/feedback/README.md +1 -1
  9. package/native/README.md +1 -1
  10. package/native/dist/account-block.d.ts +92 -0
  11. package/native/dist/account-block.js +61 -0
  12. package/native/dist/animated-number-model.d.ts +7 -1
  13. package/native/dist/animated-number-model.js +50 -1
  14. package/native/dist/animated-number.d.ts +3 -1
  15. package/native/dist/animated-number.js +8 -5
  16. package/native/dist/asset-balance-row.d.ts +36 -0
  17. package/native/dist/asset-balance-row.js +26 -0
  18. package/native/dist/bar-mark.d.ts +57 -0
  19. package/native/dist/bar-mark.js +48 -0
  20. package/native/dist/bar-pnl.d.ts +50 -0
  21. package/native/dist/bar-pnl.js +60 -0
  22. package/native/dist/blocks.d.ts +38 -0
  23. package/native/dist/blocks.js +42 -0
  24. package/native/dist/button.js +3 -1
  25. package/native/dist/data.d.ts +1 -1
  26. package/native/dist/data.js +6 -4
  27. package/native/dist/field.d.ts +14 -5
  28. package/native/dist/field.js +33 -8
  29. package/native/dist/figure.d.ts +23 -0
  30. package/native/dist/figure.js +10 -0
  31. package/native/dist/icons.d.ts +8 -0
  32. package/native/dist/icons.js +4 -0
  33. package/native/dist/language-block.d.ts +35 -0
  34. package/native/dist/language-block.js +30 -0
  35. package/native/dist/list-group.d.ts +60 -0
  36. package/native/dist/list-group.js +85 -0
  37. package/native/dist/manage-position-block.d.ts +95 -0
  38. package/native/dist/manage-position-block.js +82 -0
  39. package/native/dist/market-row.d.ts +46 -0
  40. package/native/dist/market-row.js +30 -0
  41. package/native/dist/notifications-block.d.ts +53 -0
  42. package/native/dist/notifications-block.js +22 -0
  43. package/native/dist/pickers.d.ts +35 -5
  44. package/native/dist/pickers.js +21 -9
  45. package/native/dist/position-block.d.ts +107 -0
  46. package/native/dist/position-block.js +55 -0
  47. package/native/dist/profile-block.d.ts +66 -0
  48. package/native/dist/profile-block.js +48 -0
  49. package/native/dist/provider.d.ts +9 -3
  50. package/native/dist/provider.js +7 -3
  51. package/native/dist/radio-group.d.ts +9 -3
  52. package/native/dist/radio-group.js +4 -5
  53. package/native/dist/recipes.d.ts +6 -46
  54. package/native/dist/recipes.js +6 -33
  55. package/native/dist/reward-block.d.ts +122 -0
  56. package/native/dist/reward-block.js +53 -0
  57. package/native/dist/screen-header.d.ts +49 -0
  58. package/native/dist/screen-header.js +29 -0
  59. package/native/dist/selection.d.ts +2 -2
  60. package/native/dist/setting-header.d.ts +2 -0
  61. package/native/dist/setting-header.js +2 -0
  62. package/native/dist/setting-switch.d.ts +31 -0
  63. package/native/dist/setting-switch.js +20 -0
  64. package/native/dist/signals-block.d.ts +61 -0
  65. package/native/dist/signals-block.js +26 -0
  66. package/native/dist/sound-haptics-block.d.ts +66 -0
  67. package/native/dist/sound-haptics-block.js +32 -0
  68. package/native/dist/status.d.ts +6 -5
  69. package/native/dist/status.js +5 -5
  70. package/native/dist/sticky-header.d.ts +28 -0
  71. package/native/dist/sticky-header.js +21 -0
  72. package/native/dist/surface.d.ts +3 -1
  73. package/native/dist/surface.js +2 -1
  74. package/native/dist/{swap-panel.d.ts → swap-panel-block.d.ts} +8 -3
  75. package/native/dist/{swap-panel.js → swap-panel-block.js} +13 -8
  76. package/native/dist/swap-parts.d.ts +5 -3
  77. package/native/dist/swap-parts.js +2 -2
  78. package/native/dist/swap-shared.d.ts +6 -0
  79. package/native/dist/swap-sheet.d.ts +4 -4
  80. package/native/dist/swap-sheet.js +4 -4
  81. package/native/dist/swap-views.d.ts +1 -1
  82. package/native/dist/swap-views.js +9 -7
  83. package/native/dist/switch-row.d.ts +3 -2
  84. package/native/dist/switch-row.js +5 -3
  85. package/native/dist/switch.d.ts +4 -2
  86. package/native/dist/switch.js +3 -3
  87. package/native/dist/target-block.d.ts +110 -0
  88. package/native/dist/target-block.js +74 -0
  89. package/native/dist/token-action-block.d.ts +47 -0
  90. package/native/dist/token-action-block.js +28 -0
  91. package/native/dist/trade-history-detail-block.d.ts +84 -0
  92. package/native/dist/trade-history-detail-block.js +46 -0
  93. package/native/dist/trade-history-list-block.d.ts +110 -0
  94. package/native/dist/trade-history-list-block.js +64 -0
  95. package/native/dist/wallet-address-core.d.ts +25 -0
  96. package/native/dist/wallet-address-core.js +31 -0
  97. package/native/dist/wallet-address.d.ts +6 -10
  98. package/native/dist/wallet-address.js +16 -20
  99. package/native-fonts/README.md +1 -1
  100. package/og-fonts/README.md +1 -1
  101. package/package.json +266 -41
  102. package/react/README.md +1 -1
  103. package/react/dist/animated-number-model.d.ts +6 -0
  104. package/react/dist/animated-number-model.js +33 -0
  105. package/react/dist/animated-number.d.ts +5 -1
  106. package/react/dist/animated-number.js +12 -8
  107. package/react/dist/asset-balance-row.d.ts +35 -0
  108. package/react/dist/asset-balance-row.js +18 -0
  109. package/react/dist/bar-mark.d.ts +38 -0
  110. package/react/dist/bar-mark.js +23 -0
  111. package/react/dist/bar-pnl.d.ts +49 -0
  112. package/react/dist/bar-pnl.js +45 -0
  113. package/react/dist/blocks/account-block.d.ts +92 -0
  114. package/react/dist/blocks/account-block.js +62 -0
  115. package/react/dist/blocks/language-block.d.ts +36 -0
  116. package/react/dist/blocks/language-block.js +52 -0
  117. package/react/dist/blocks/manage-position-block.d.ts +93 -0
  118. package/react/dist/blocks/manage-position-block.js +47 -0
  119. package/react/dist/blocks/market-row.d.ts +36 -0
  120. package/react/dist/blocks/market-row.js +16 -0
  121. package/react/dist/blocks/notifications-block.d.ts +46 -0
  122. package/react/dist/blocks/notifications-block.js +17 -0
  123. package/react/dist/{recipes → blocks}/pickers.d.ts +32 -4
  124. package/react/dist/{recipes → blocks}/pickers.js +35 -11
  125. package/react/dist/blocks/position-block.d.ts +72 -0
  126. package/react/dist/blocks/position-block.js +25 -0
  127. package/react/dist/blocks/profile-block.d.ts +71 -0
  128. package/react/dist/blocks/profile-block.js +41 -0
  129. package/react/dist/blocks/reward-block.d.ts +120 -0
  130. package/react/dist/blocks/reward-block.js +34 -0
  131. package/react/dist/blocks/screen-header.d.ts +33 -0
  132. package/react/dist/blocks/screen-header.js +20 -0
  133. package/react/dist/blocks/setting-switch.d.ts +23 -0
  134. package/react/dist/blocks/setting-switch.js +12 -0
  135. package/react/dist/blocks/signals-block.d.ts +54 -0
  136. package/react/dist/blocks/signals-block.js +15 -0
  137. package/react/dist/blocks/sound-haptics-block.d.ts +59 -0
  138. package/react/dist/blocks/sound-haptics-block.js +22 -0
  139. package/react/dist/blocks/sticky-header.d.ts +9 -0
  140. package/react/dist/blocks/sticky-header.js +43 -0
  141. package/react/dist/blocks/swap/amount-card.js +8 -0
  142. package/react/dist/{recipes → blocks}/swap/picker.d.ts +1 -1
  143. package/react/dist/{recipes → blocks}/swap/picker.js +4 -4
  144. package/react/dist/{recipes → blocks}/swap/settings.js +2 -2
  145. package/react/dist/{recipes → blocks}/swap/shared.d.ts +8 -1
  146. package/react/dist/{recipes → blocks}/swap/shared.js +7 -4
  147. package/react/dist/{recipes/swap-panel.d.ts → blocks/swap-panel-block.d.ts} +8 -2
  148. package/react/dist/{recipes/swap-panel.js → blocks/swap-panel-block.js} +9 -7
  149. package/react/dist/{recipes → blocks}/swap-sheet.d.ts +4 -4
  150. package/react/dist/{recipes → blocks}/swap-sheet.js +4 -4
  151. package/react/dist/blocks/target-block.d.ts +103 -0
  152. package/react/dist/blocks/target-block.js +73 -0
  153. package/react/dist/blocks/token-action-block.d.ts +46 -0
  154. package/react/dist/blocks/token-action-block.js +21 -0
  155. package/react/dist/{recipes → blocks}/trade-entry.js +2 -2
  156. package/react/dist/blocks/trade-history-detail-block.d.ts +78 -0
  157. package/react/dist/blocks/trade-history-detail-block.js +17 -0
  158. package/react/dist/blocks/trade-history-list-block.d.ts +67 -0
  159. package/react/dist/blocks/trade-history-list-block.js +28 -0
  160. package/react/dist/blocks.d.ts +20 -0
  161. package/react/dist/blocks.js +21 -0
  162. package/react/dist/button.js +6 -4
  163. package/react/dist/data.js +3 -3
  164. package/react/dist/field.d.ts +14 -6
  165. package/react/dist/field.js +19 -8
  166. package/react/dist/figure.d.ts +23 -0
  167. package/react/dist/figure.js +12 -0
  168. package/react/dist/list-group.d.ts +59 -0
  169. package/react/dist/list-group.js +52 -0
  170. package/react/dist/provider.d.ts +40 -3
  171. package/react/dist/provider.js +63 -6
  172. package/react/dist/selection.d.ts +8 -2
  173. package/react/dist/selection.js +11 -6
  174. package/react/dist/styles.css +425 -5
  175. package/react/dist/surface.d.ts +5 -1
  176. package/react/dist/surface.js +1 -1
  177. package/react/dist/wallet-address-core.d.ts +23 -0
  178. package/react/dist/wallet-address-core.js +24 -0
  179. package/react/dist/wallet-address.d.ts +6 -12
  180. package/react/dist/wallet-address.js +5 -16
  181. package/tokens/README.md +1 -1
  182. package/react/dist/recipes/activity-list.d.ts +0 -8
  183. package/react/dist/recipes/activity-list.js +0 -6
  184. package/react/dist/recipes/balance-card.d.ts +0 -6
  185. package/react/dist/recipes/balance-card.js +0 -5
  186. package/react/dist/recipes/code-window.d.ts +0 -4
  187. package/react/dist/recipes/code-window.js +0 -4
  188. package/react/dist/recipes/market-row.d.ts +0 -25
  189. package/react/dist/recipes/market-row.js +0 -8
  190. package/react/dist/recipes/swap/amount-card.js +0 -7
  191. package/react/dist/recipes.d.ts +0 -10
  192. package/react/dist/recipes.js +0 -11
  193. /package/react/dist/{recipes → blocks}/install-command.d.ts +0 -0
  194. /package/react/dist/{recipes → blocks}/install-command.js +0 -0
  195. /package/react/dist/{recipes → blocks}/marketing-hero.d.ts +0 -0
  196. /package/react/dist/{recipes → blocks}/marketing-hero.js +0 -0
  197. /package/react/dist/{recipes → blocks}/swap/amount-card.d.ts +0 -0
  198. /package/react/dist/{recipes → blocks}/swap/settings.d.ts +0 -0
  199. /package/react/dist/{recipes → blocks}/trade-entry.d.ts +0 -0
@@ -0,0 +1,120 @@
1
+ import React from 'react';
2
+ import { type Figure } from '../figure.js';
3
+ import type { AssetArtwork } from '../asset-balance-row.js';
4
+ /** A way onward from the promotion. `href` draws a real link (an `<a>`), with `target` such as `_blank`; `onSelect` is still called on the press. */
5
+ export type RewardLink = {
6
+ label: string;
7
+ onSelect: () => void;
8
+ href?: undefined;
9
+ target?: undefined;
10
+ } | {
11
+ label: string;
12
+ href: string;
13
+ target?: string;
14
+ onSelect?: () => void;
15
+ };
16
+ /** The promotion above the standings: a prize pool filling towards a goal, or a draw with a top prize. Every word is host text. */
17
+ export interface RewardPromo {
18
+ /** The small capitals line: Season 01. */
19
+ eyebrow: string;
20
+ /** A text link with a chevron on the trailing edge of the eyebrow: Rules. */
21
+ rules?: RewardLink;
22
+ /** The headline figure: the pool so far, or the top prize. `null` reads as unknown. */
23
+ amount: number | null;
24
+ /** Format of `amount` and `goal`. Defaults to whole US dollars. */
25
+ amountOptions?: Intl.NumberFormatOptions;
26
+ /** The amount the pool is filling towards. Draws the progress bar under the caption. */
27
+ goal?: number;
28
+ /** The line under the figure. A function receives the formatted goal: `goal => 'of ' + goal + ' prize pool'`. A string is drawn as given: top prize. */
29
+ caption?: string | ((goal: string) => string);
30
+ /** The lead of the explaining sentence, in the text colour: Top 100 traders split the pool. Host text, or host elements for an accented word. */
31
+ headline?: React.ReactNode;
32
+ /** Continues the sentence after the headline in the muted colour: Funded by builder fees on every trade. */
33
+ description?: string;
34
+ /** A quiet row under a hairline at the foot of the card, with a chevron on its trailing edge: Draws and winners. The host opens its own destination. */
35
+ action?: RewardLink;
36
+ }
37
+ /** A host figure that updates place by place: `{value:1090779, options:{style:'currency',currency:'USD',maximumFractionDigits:0}, suffix:' vol'}`. */
38
+ export type RewardFigure = Figure;
39
+ /** One trader in the standings. */
40
+ export interface RewardEntry {
41
+ id: string;
42
+ rank: number;
43
+ /** A short address, a handle, or the host's word for the viewer. */
44
+ name: string;
45
+ /** An image URL or a host element. Without one the first letters of the name are shown. */
46
+ avatar?: AssetArtwork;
47
+ /** Shows the verified mark after the name. */
48
+ verified?: boolean;
49
+ /** The line under the name: `$1,090,779 vol` as text, or the same as a live figure. */
50
+ detail?: string | RewardFigure;
51
+ /** Points or entries. `null` reads as unknown. */
52
+ score: number | null;
53
+ /** Format of this entry's score, in place of the block's `scoreOptions`, for a prize list where some amounts have cents. */
54
+ scoreOptions?: Intl.NumberFormatOptions;
55
+ /** Marks the viewer's own row: the name and score take the action colour. */
56
+ you?: boolean;
57
+ }
58
+ /** One step of the paging control under the list. */
59
+ export interface RewardPageStep {
60
+ label: string;
61
+ onSelect: () => void;
62
+ disabled?: boolean;
63
+ }
64
+ export interface RewardBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
65
+ /** Heading: Leaderboard. */
66
+ title: string;
67
+ promo?: RewardPromo;
68
+ /** A choice between standings, such as Upcoming draw and Top winners. `label` names the control and is not drawn. */
69
+ tabs?: {
70
+ label: string;
71
+ options: readonly {
72
+ value: string;
73
+ label: string;
74
+ }[];
75
+ value: string;
76
+ onValueChange: (value: string) => void;
77
+ };
78
+ /** The viewer's own standing, pinned above the list on a tinted row. */
79
+ you?: RewardEntry;
80
+ /** Names the pinned row for assistive technology: Your rank. */
81
+ youLabel?: string;
82
+ /** A muted line between the pinned row and the list, announced when it changes: You're not ranked yet. */
83
+ status?: string;
84
+ /** The column heading over the names: Top 25 by volume. */
85
+ listTitle?: string;
86
+ /** The column heading over the scores: Entries. */
87
+ scoreTitle?: string;
88
+ entries: readonly RewardEntry[];
89
+ /** Format of every score. Defaults to a whole number. An entry's own `scoreOptions` wins. */
90
+ scoreOptions?: Intl.NumberFormatOptions;
91
+ /** Accessible name of the verified mark. The mark is decorative without it. */
92
+ verifiedLabel?: string;
93
+ /** Host artwork in place of the built-in verified mark, drawn inside the mark's image role. */
94
+ verifiedMark?: React.ReactNode;
95
+ /** The `verifiedMark` is a control, such as a badge with a popover: it stays in the accessibility tree outside the image role, and `verifiedLabel` is read before it. */
96
+ verifiedMarkInteractive?: boolean;
97
+ /** Draws skeleton rows in place of the entries while the host loads them. */
98
+ loading?: boolean;
99
+ /** Host text that names the skeleton rows for assistive technology and announces them: Loading standings. Without it the block is only marked busy. */
100
+ loadingLabel?: string;
101
+ /** Paging under the list: Previous and Next as buttons with the host's range between them, such as 1–25. */
102
+ pagination?: {
103
+ previous?: RewardPageStep;
104
+ next?: RewardPageStep;
105
+ label?: string;
106
+ };
107
+ /** A line under the list: Entries are provisional until audited. */
108
+ footnote?: string;
109
+ onBack?: () => void;
110
+ /** A control on the trailing edge of the header, usually an `IconButton` that shares. */
111
+ headerAction?: React.ReactNode;
112
+ /** Keeps the header pinned to the top of the scrolling container. It is transparent at rest and fills with `--hig-sticky-header-background` (`--hig-background` by default) once the standings scroll under it; inside a sheet remap it, for example `--hig-sticky-header-background: var(--hig-overlay)`. */
113
+ stickyHeader?: boolean;
114
+ /** Set false to leave the header out, when the host pins its own `ScreenHeader` above the block. */
115
+ header?: boolean;
116
+ }
117
+ /** The share of the goal reached, from 0 to 1. Unknown amounts and goals that are not above zero give `null`. */
118
+ export declare function rewardProgress(amount: number | null | undefined, goal: number | null | undefined): number | null;
119
+ /** A competition as a screen: an optional promotion (a prize pool filling towards its goal, or a draw with its top prize), an optional choice of standings, the viewer's own standing pinned on a tinted row, and the ranked list. */
120
+ export declare function RewardBlock({ title, promo, tabs, you, youLabel, status, listTitle, scoreTitle, entries, scoreOptions, verifiedLabel, verifiedMark, verifiedMarkInteractive, loading, loadingLabel, pagination, footnote, onBack, headerAction, stickyHeader, header, className, ...rest }: RewardBlockProps): React.JSX.Element;
@@ -0,0 +1,34 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { formatNumber } from '@bloxwap/hig/contracts';
4
+ import { PressDecoration, usePresentNumber, useNumberLocale } from '../provider.js';
5
+ import { figureProps } from '../figure.js';
6
+ import { SegmentedControl } from '../selection.js';
7
+ import { Button } from '../button.js';
8
+ import { AnimatedNumberReadout } from '../animated-number.js';
9
+ import { ScreenHeader } from './screen-header.js';
10
+ import { SwapIcon, SwapNumber } from './swap/shared.js';
11
+ const wholeDollars = { style: 'currency', currency: 'USD', maximumFractionDigits: 0 }, whole = { maximumFractionDigits: 0 };
12
+ const skeletons = [0, 1, 2, 3, 4];
13
+ /** The share of the goal reached, from 0 to 1. Unknown amounts and goals that are not above zero give `null`. */
14
+ export function rewardProgress(amount, goal) {
15
+ return amount == null || goal == null || !Number.isFinite(amount) || !Number.isFinite(goal) || !(goal > 0) ? null : Math.min(1, Math.max(0, amount / goal));
16
+ }
17
+ const verifiedGlyph = _jsxs("svg", { className: 'hig-reward-verified-mark', "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', width: '16', height: '16', fill: 'none', stroke: 'currentColor', strokeWidth: '1.8', strokeLinecap: 'round', strokeLinejoin: 'round', children: [_jsx("circle", { cx: '10', cy: '10', r: '7.5' }), _jsx("path", { d: 'm6.75 10.25 2.25 2.25 4.25-4.75' })] });
18
+ function Standing({ entry, scoreOptions, verifiedLabel, verifiedMark, verifiedMarkInteractive, as: Tag = 'li' }) {
19
+ const detail = entry.detail;
20
+ return _jsxs(Tag, { className: 'hig-reward-row', "data-you": entry.you || undefined, children: [_jsx("span", { className: 'hig-reward-rank hig-number', children: entry.rank }), _jsx("span", { className: 'hig-reward-avatar', "aria-hidden": 'true', children: typeof entry.avatar === 'string' ? _jsx("img", { src: entry.avatar, alt: '' }) : entry.avatar ?? entry.name.slice(0, 2) }), _jsxs("span", { className: 'hig-reward-identity', children: [_jsxs("strong", { className: 'hig-number', children: [entry.name, entry.verified && (verifiedMark != null && verifiedMarkInteractive ? _jsxs("span", { className: 'hig-reward-verified', children: [verifiedLabel && _jsx("span", { className: 'hig-sr-only', children: verifiedLabel }), verifiedMark] }) : _jsx("span", { className: 'hig-reward-verified', role: verifiedLabel ? 'img' : undefined, "aria-label": verifiedLabel, children: verifiedMark ?? verifiedGlyph }))] }), detail != null && detail !== '' && _jsx("span", { className: 'hig-number', children: typeof detail === 'string' ? detail : _jsx(SwapNumber, { ...figureProps(detail) }) })] }), _jsx("span", { className: 'hig-reward-score', children: _jsx(AnimatedNumberReadout, { value: entry.score, options: entry.scoreOptions ?? scoreOptions }) })] });
21
+ }
22
+ function Onward({ link, className, children }) {
23
+ return link.href !== undefined ? _jsxs("a", { className: className, href: link.href, target: link.target, rel: link.target === '_blank' ? 'noopener noreferrer' : undefined, onClick: link.onSelect, children: [children, _jsx(PressDecoration, { kind: 'row' })] })
24
+ : _jsxs("button", { type: 'button', className: className, onClick: link.onSelect, children: [children, _jsx(PressDecoration, { kind: 'row' })] });
25
+ }
26
+ /** A competition as a screen: an optional promotion (a prize pool filling towards its goal, or a draw with its top prize), an optional choice of standings, the viewer's own standing pinned on a tinted row, and the ranked list. */
27
+ export function RewardBlock({ title, promo, tabs, you, youLabel, status, listTitle, scoreTitle, entries, scoreOptions = whole, verifiedLabel, verifiedMark, verifiedMarkInteractive, loading, loadingLabel, pagination, footnote, onBack, headerAction, stickyHeader, header = true, className, ...rest }) {
28
+ const locale = useNumberLocale();
29
+ const present = usePresentNumber();
30
+ const money = promo?.amountOptions ?? wholeDollars, share = promo ? rewardProgress(promo.amount, promo.goal) : null;
31
+ const caption = typeof promo?.caption === 'function' ? promo.goal !== undefined ? promo.caption(formatNumber(promo.goal, locale, present(money))) : undefined : promo?.caption;
32
+ const pinned = you && _jsx(Standing, { as: 'div', entry: { ...you, you: true }, scoreOptions: scoreOptions, verifiedLabel: verifiedLabel, verifiedMark: verifiedMark, verifiedMarkInteractive: verifiedMarkInteractive });
33
+ return _jsxs("section", { ...rest, className: `hig-reward-block${className ? ` ${className}` : ''}`, children: [header && _jsx(ScreenHeader, { title: title, onBack: onBack, action: headerAction, stickyHeader: stickyHeader }), promo && _jsxs("section", { className: 'hig-surface hig-reward-promo', children: [_jsxs("div", { className: 'hig-reward-promo-top', children: [_jsx("span", { className: 'hig-reward-eyebrow hig-number', children: promo.eyebrow }), promo.rules && _jsxs(Onward, { link: promo.rules, className: 'hig-reward-rules', children: [promo.rules.label, _jsx(SwapIcon, { name: 'chevron', size: 16 })] })] }), _jsx("p", { className: 'hig-reward-amount', children: _jsx(AnimatedNumberReadout, { value: promo.amount, options: money }) }), caption && _jsx("p", { className: 'hig-reward-caption hig-number', children: caption }), promo.goal !== undefined && _jsx("div", { className: 'hig-reward-track', "aria-hidden": 'true', children: _jsx("span", { style: { width: `${(share ?? 0) * 100}%` } }) }), (promo.headline || promo.description) && _jsxs("p", { className: 'hig-reward-summary', children: [promo.headline && _jsx("strong", { children: promo.headline }), promo.headline && promo.description ? ' ' : null, promo.description] }), promo.action && _jsxs(Onward, { link: promo.action, className: 'hig-reward-action', children: [_jsx("span", { children: promo.action.label }), _jsx(SwapIcon, { name: 'chevron', size: 16 })] })] }), tabs && _jsx(SegmentedControl, { label: tabs.label, options: tabs.options, value: tabs.value, onValueChange: tabs.onValueChange }), pinned && (youLabel ? _jsx("div", { className: 'hig-reward-you', role: 'group', "aria-label": youLabel, children: pinned }) : _jsx("div", { className: 'hig-reward-you', children: pinned })), status && _jsx("p", { className: 'hig-reward-status', role: 'status', children: status }), loading ? _jsxs(_Fragment, { children: [loadingLabel && _jsx("p", { className: 'hig-sr-only', role: 'status', children: loadingLabel }), _jsx("div", { className: 'hig-reward-list', "aria-busy": 'true', children: skeletons.map(index => _jsx("div", { className: 'hig-skeleton hig-reward-skeleton', "aria-hidden": 'true' }, index)) })] }) : (entries.length > 0 || listTitle || scoreTitle) && _jsxs("div", { className: 'hig-reward-list', children: [(listTitle || scoreTitle) && _jsxs("div", { className: 'hig-reward-columns hig-number', children: [_jsx("span", { children: listTitle }), _jsx("span", { children: scoreTitle })] }), entries.length > 0 && _jsx("ol", { className: 'hig-reward-rows', children: entries.map(entry => _jsx(Standing, { entry: entry, scoreOptions: scoreOptions, verifiedLabel: verifiedLabel, verifiedMark: verifiedMark, verifiedMarkInteractive: verifiedMarkInteractive }, entry.id)) })] }), pagination && _jsxs("div", { className: 'hig-reward-pagination', children: [pagination.previous ? _jsx(Button, { intent: 'secondary', disabled: pagination.previous.disabled, onClick: pagination.previous.onSelect, children: pagination.previous.label }) : _jsx("span", {}), pagination.label ? _jsx("span", { className: 'hig-reward-page hig-number', "aria-live": 'polite', children: pagination.label }) : _jsx("span", {}), pagination.next ? _jsx(Button, { intent: 'secondary', disabled: pagination.next.disabled, onClick: pagination.next.onSelect, children: pagination.next.label }) : _jsx("span", {})] }), footnote && _jsx("p", { className: 'hig-reward-footnote', children: footnote })] });
34
+ }
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ /** Attributes passed through to a header control's `<button>`, such as a data attribute or a pointer handler. HIG keeps its own type, class, name and click. */
3
+ export type ScreenHeaderControlProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'className' | 'onClick' | 'aria-label' | 'children' | 'disabled'>;
4
+ export interface ScreenHeaderProps {
5
+ /** The heading, centred. Host text. */
6
+ title: string;
7
+ /** Shows Back on the leading edge. */
8
+ onBack?: () => void;
9
+ /** Draws Back unavailable: dimmed, `disabled` and not pressable, for example while a close is being signed. */
10
+ backDisabled?: boolean;
11
+ /** Attributes for the Back `<button>`. */
12
+ backProps?: ScreenHeaderControlProps;
13
+ /** A control on the trailing edge, usually an `IconButton`. */
14
+ action?: React.ReactNode;
15
+ /** `id` of the heading, so a dialog or sheet can name itself with `aria-labelledby` instead of repeating the title. */
16
+ headingId?: string;
17
+ /** Short host text in a badge beside the title, read as part of the heading after a pause: Demo. */
18
+ badge?: string;
19
+ /** Hides the title visually while it stays the accessible heading, for a host that draws its own visible title and must not have it read twice. The header keeps its height and its two sides. */
20
+ hideTitle?: boolean;
21
+ /** Pins the header to the top of the nearest scrolling container. It is transparent at rest and takes its fill (`--hig-sticky-header-background`) only once content has scrolled under it. */
22
+ stickyHeader?: boolean;
23
+ }
24
+ /** The block header's Close control, shared by the blocks that draw one. */
25
+ export declare function HeaderClose({ onClose, label, closeProps }: {
26
+ onClose: () => void;
27
+ label: string;
28
+ closeProps?: ScreenHeaderControlProps;
29
+ }): React.JSX.Element;
30
+ /** Header of a card that is its own screen: Back on the leading edge, the title centred, and an optional control on the trailing edge. The title stays centred with either, both or neither. Every block draws it; import it from `@bloxwap/hig/react/blocks/screen-header` for a host pane that has no block. */
31
+ export declare function ScreenHeader({ title, onBack, backDisabled, backProps, action, headingId, badge, hideTitle, stickyHeader }: ScreenHeaderProps): React.JSX.Element;
32
+ /** The QR glyph of a control that shows an address. */
33
+ export declare const qrIcon: 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 { useRef } from 'react';
4
+ import * as en from '@bloxwap/hig/contracts/messages';
5
+ import { PressDecoration, useHIG } from '../provider.js';
6
+ import { SwapIcon } from './swap/shared.js';
7
+ import { useStickyHeader } from './sticky-header.js';
8
+ /** The block header's Close control, shared by the blocks that draw one. */
9
+ export function HeaderClose({ onClose, label, closeProps }) {
10
+ return _jsxs("button", { ...closeProps, type: 'button', className: 'hig-swap-back', "aria-label": label, onClick: onClose, children: [_jsx(SwapIcon, { name: 'close' }), _jsx(PressDecoration, { kind: 'back' })] });
11
+ }
12
+ /** Header of a card that is its own screen: Back on the leading edge, the title centred, and an optional control on the trailing edge. The title stays centred with either, both or neither. Every block draws it; import it from `@bloxwap/hig/react/blocks/screen-header` for a host pane that has no block. */
13
+ export function ScreenHeader({ title, onBack, backDisabled, backProps, action, headingId, badge, hideTitle, stickyHeader }) {
14
+ const { messages } = useHIG();
15
+ const header = useRef(null);
16
+ useStickyHeader(header, !!stickyHeader);
17
+ return _jsxs("div", { ref: header, className: 'hig-screen-header', "data-sticky": stickyHeader || undefined, children: [_jsx("span", { className: 'hig-screen-header-side', children: onBack && _jsxs("button", { ...backProps, type: 'button', className: 'hig-swap-back', "aria-label": messages.back ?? en.back, disabled: backDisabled || undefined, onClick: onBack, children: [_jsx(SwapIcon, { name: 'back' }), _jsx(PressDecoration, { kind: 'back', disabled: !!backDisabled })] }) }), _jsx("h2", { id: headingId, className: `hig-screen-title${hideTitle ? ' hig-sr-only' : ''}`, children: badge ? _jsxs(_Fragment, { children: [title, _jsx("span", { className: 'hig-sr-only', children: "," }), " ", _jsx("span", { className: 'hig-badge hig-screen-badge', children: badge })] }) : title }), _jsx("span", { className: 'hig-screen-header-side', children: action })] });
18
+ }
19
+ /** The QR glyph of a control that shows an address. */
20
+ export const qrIcon = _jsxs("svg", { "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', width: '20', height: '20', fill: 'none', stroke: 'currentColor', strokeWidth: '1.6', strokeLinejoin: 'round', children: [_jsx("rect", { x: '3', y: '3', width: '5.5', height: '5.5', rx: '1' }), _jsx("rect", { x: '11.5', y: '3', width: '5.5', height: '5.5', rx: '1' }), _jsx("rect", { x: '3', y: '11.5', width: '5.5', height: '5.5', rx: '1' }), _jsx("path", { d: 'M11.5 11.5h2v2h-2zM15 15h2v2h-2z', fill: 'currentColor', stroke: 'none' })] });
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ /** A secondary button under a setting, such as Open Settings. `feedback: false` keeps the provider's press feedback off this one button, for a host that plays its own cue for it; by default it plays like any `Button`. */
3
+ export interface SettingAction {
4
+ label: string;
5
+ onSelect: () => void;
6
+ disabled?: boolean;
7
+ feedback?: boolean;
8
+ }
9
+ export interface SettingSwitchProps {
10
+ label: string;
11
+ description?: string;
12
+ checked: boolean;
13
+ onCheckedChange: (checked: boolean) => void;
14
+ disabled?: boolean;
15
+ /** Always on and not changeable: the switch shows on at full strength and is read as unavailable. Presses do nothing. */
16
+ locked?: boolean;
17
+ /** Host content after the label, such as a badge. It is part of the switch's name, read after the label and a pause, so give artwork a text alternative or hide it. */
18
+ labelAccessory?: React.ReactNode;
19
+ /** Host words for the `labelAccessory`, read after the label and a pause in place of the accessory's own content, which is then hidden from assistive technology: `Feed, New`. Same prop on native. */
20
+ labelAccessoryLabel?: string;
21
+ }
22
+ /** One setting as a switch: the label over an optional description on the leading edge, the track on the trailing edge. The whole row is the `label.hig-choice` hit target, at least `--hig-control` tall, and toggles it; the label names the switch and the description describes it. */
23
+ export declare function SettingSwitch({ label, description, checked, onCheckedChange, disabled, locked, labelAccessory, labelAccessoryLabel }: SettingSwitchProps): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useRef } from 'react';
4
+ import { PressDecoration } from '../provider.js';
5
+ /** One setting as a switch: the label over an optional description on the leading edge, the track on the trailing edge. The whole row is the `label.hig-choice` hit target, at least `--hig-control` tall, and toggles it; the label names the switch and the description describes it. */
6
+ export function SettingSwitch({ label, description, checked, onCheckedChange, disabled, locked, labelAccessory, labelAccessoryLabel }) {
7
+ const id = useId(), name = `${id}-label`, about = `${id}-description`;
8
+ const input = useRef(null);
9
+ // The comma is read, not drawn, so the name pauses between the label and the accessory instead of running them together.
10
+ return _jsxs("label", { className: 'hig-choice hig-setting-switch', "data-disabled": disabled || undefined, "data-locked": locked || undefined, children: [_jsxs("span", { className: 'hig-setting-switch-text', children: [_jsxs("span", { id: name, children: [label, labelAccessory != null && labelAccessory !== false && _jsxs(_Fragment, { children: [_jsx("span", { className: 'hig-sr-only', children: labelAccessoryLabel ? `, ${labelAccessoryLabel}` : ', ' }), _jsx("span", { className: 'hig-setting-switch-accessory', "aria-hidden": labelAccessoryLabel ? true : undefined, children: labelAccessory })] })] }), description && _jsx("span", { id: about, className: 'hig-setting-switch-description', children: description })] }), _jsx("span", { className: 'hig-switch', children: _jsx("input", { ref: input, type: 'checkbox', role: 'switch', "aria-labelledby": name, "aria-describedby": description ? about : undefined, "aria-disabled": locked || undefined, checked: locked ? true : checked, disabled: disabled, onChange: event => { if (!locked)
11
+ onCheckedChange(event.target.checked); } }) }), _jsx(PressDecoration, { kind: 'switch', disabled: !!disabled || !!locked, input: input })] });
12
+ }
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ /** One signal the viewer can turn on. */
3
+ export interface SignalsItem {
4
+ id: string;
5
+ label: string;
6
+ description?: string;
7
+ checked: boolean;
8
+ onCheckedChange: (checked: boolean) => void;
9
+ disabled?: boolean;
10
+ /** Always on and not changeable: shown on at full strength and read as unavailable. */
11
+ locked?: boolean;
12
+ /** Host content after the label, such as a badge. It is part of the switch's name. */
13
+ labelAccessory?: React.ReactNode;
14
+ /** Host words for the `labelAccessory`, read after the label and a pause in place of its content: `Feed, New`. */
15
+ labelAccessoryLabel?: string;
16
+ /** A neutral line under the switch, announced when it changes: Needs this browser's permission. */
17
+ hint?: string;
18
+ /** A failure under the switch, in the negative role and announced. */
19
+ error?: string;
20
+ }
21
+ /** A family of signals under one heading: Trend, Swing. Every word is host text. */
22
+ export interface SignalsGroup {
23
+ id: string;
24
+ title: string;
25
+ /** Shows the verified mark after the title. */
26
+ verified?: boolean;
27
+ /** A small pill on the trailing edge of the heading: How it works. The host opens its own explanation. `ref` reaches the pill, so the host can return focus to it when the explanation closes. */
28
+ help?: {
29
+ label: string;
30
+ onSelect: () => void;
31
+ ref?: React.Ref<HTMLButtonElement>;
32
+ };
33
+ items: readonly SignalsItem[];
34
+ }
35
+ export interface SignalsBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
36
+ /** Heading: Signals. */
37
+ title: string;
38
+ /** A muted line under the header that explains the screen. */
39
+ description?: string;
40
+ groups: readonly SignalsGroup[];
41
+ /** Accessible name of the verified mark. The mark is decorative without it. */
42
+ verifiedLabel?: string;
43
+ /** Host artwork in place of the built-in verified mark, drawn inside the mark's image role. */
44
+ verifiedMark?: React.ReactNode;
45
+ /** The `verifiedMark` is a control, such as a badge with a popover: it stays in the accessibility tree outside the image role, and `verifiedLabel` is read before it. */
46
+ verifiedMarkInteractive?: boolean;
47
+ onBack?: () => void;
48
+ /** A control on the trailing edge of the header, usually an `IconButton`. */
49
+ headerAction?: React.ReactNode;
50
+ /** Pins the header to the top of the nearest scrolling container, transparent at rest and filled with `--hig-sticky-header-background` once content scrolls under it. */
51
+ stickyHeader?: boolean;
52
+ }
53
+ /** The signals the viewer receives, in groups: each group has a heading with an optional verified mark and a small help pill, and its signals as switches with a line of explanation, sharing one rounded container. */
54
+ export declare function SignalsBlock({ title, description, groups, verifiedLabel, verifiedMark, verifiedMarkInteractive, onBack, headerAction, stickyHeader, className, ...rest }: SignalsBlockProps): React.JSX.Element;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId } from 'react';
4
+ import { ScreenHeader } from './screen-header.js';
5
+ import { SettingSwitch } from './setting-switch.js';
6
+ import { SwapPill } from './swap/shared.js';
7
+ const verifiedGlyph = _jsxs("svg", { "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', width: '16', height: '16', fill: 'none', stroke: 'currentColor', strokeWidth: '1.8', strokeLinecap: 'round', strokeLinejoin: 'round', children: [_jsx("circle", { cx: '10', cy: '10', r: '7.5' }), _jsx("path", { d: 'm6.75 10.25 2.25 2.25 4.25-4.75' })] });
8
+ function Group({ group, verifiedLabel, verifiedMark, verifiedMarkInteractive }) {
9
+ const id = useId();
10
+ return _jsxs("section", { className: 'hig-signals-group', "aria-labelledby": id, children: [_jsxs("div", { className: 'hig-signals-group-header', children: [_jsxs("h3", { id: id, children: [group.title, group.verified && (verifiedMark != null && verifiedMarkInteractive ? _jsxs("span", { className: 'hig-reward-verified', children: [verifiedLabel && _jsx("span", { className: 'hig-sr-only', children: verifiedLabel }), verifiedMark] }) : _jsx("span", { className: 'hig-reward-verified', role: verifiedLabel ? 'img' : undefined, "aria-label": verifiedLabel, children: verifiedMark ?? verifiedGlyph }))] }), group.help && _jsx(SwapPill, { ref: group.help.ref, onClick: group.help.onSelect, children: group.help.label })] }), group.items.length > 0 && _jsx("div", { className: 'hig-setting-list', children: group.items.map(item => _jsxs("div", { className: 'hig-setting-card', children: [_jsx(SettingSwitch, { 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 || item.error) && _jsxs("div", { className: 'hig-setting-notes', children: [item.hint && _jsx("p", { role: 'status', className: 'hig-setting-hint', children: item.hint }), item.error && _jsx("p", { role: 'alert', className: 'hig-setting-error', children: item.error })] })] }, item.id)) })] });
11
+ }
12
+ /** The signals the viewer receives, in groups: each group has a heading with an optional verified mark and a small help pill, and its signals as switches with a line of explanation, sharing one rounded container. */
13
+ export function SignalsBlock({ title, description, groups, verifiedLabel, verifiedMark, verifiedMarkInteractive, onBack, headerAction, stickyHeader, className, ...rest }) {
14
+ return _jsxs("section", { ...rest, className: `hig-settings-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: title, onBack: onBack, action: headerAction, stickyHeader: stickyHeader }), description && _jsx("p", { className: 'hig-settings-description', children: description }), groups.map(group => _jsx(Group, { group: group, verifiedLabel: verifiedLabel, verifiedMark: verifiedMark, verifiedMarkInteractive: verifiedMarkInteractive }, group.id))] });
15
+ }
@@ -0,0 +1,59 @@
1
+ import React from 'react';
2
+ import { type Choice } from '../selection.js';
3
+ import { type SettingAction } from './setting-switch.js';
4
+ export type { SettingAction } from './setting-switch.js';
5
+ /** A volume as a few fixed steps. `value` and `options` are fractions: 0.25 reads 25%. */
6
+ export interface SoundVolume {
7
+ /** Names the steps and is drawn above them: Volume. */
8
+ label: string;
9
+ /** Defaults to 25%, 50%, 75% and 100%. */
10
+ options?: readonly number[];
11
+ value: number;
12
+ onValueChange: (value: number) => void;
13
+ }
14
+ /** A choice of device under the source, such as which microphone to use. `label` names the group and is drawn above it. */
15
+ export interface SoundChoices {
16
+ label: string;
17
+ options: readonly Choice[];
18
+ value: string;
19
+ onValueChange: (value: string) => void;
20
+ }
21
+ /** One feedback channel: sound effects, the microphone, haptics, the flash. Every word is host text. */
22
+ export interface SoundSection {
23
+ id: string;
24
+ label: string;
25
+ description?: string;
26
+ checked: boolean;
27
+ onCheckedChange: (checked: boolean) => void;
28
+ disabled?: boolean;
29
+ /** The device in use, under the switch: iPhone Microphone. */
30
+ source?: string;
31
+ /** A choice between devices, as radios under the source: Automatic, iPhone Microphone, AirPods. Shown while the channel is on. */
32
+ choices?: SoundChoices;
33
+ /** A live input level from 0 to 1, drawn as a meter. `null` draws an empty meter. */
34
+ level?: number | null;
35
+ /** Names the meter for assistive technology, which then reads the level as a percentage. Without it the meter is decorative. */
36
+ levelLabel?: string;
37
+ volume?: SoundVolume;
38
+ /** What the volume does while the channel is off: `hidden` (the default) leaves it out, `disabled` keeps it in place and unavailable. */
39
+ volumeWhenOff?: 'hidden' | 'disabled';
40
+ /** A secondary action at the foot of the card, shown whether the channel is on or off: Open Settings. */
41
+ action?: SettingAction;
42
+ }
43
+ export interface SoundHapticsBlockProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {
44
+ /** Heading: Sound & Haptics. */
45
+ title: string;
46
+ /** A muted line under the header that explains the screen. */
47
+ description?: string;
48
+ /** One card each, in order. A section's source, choices and meter show only while it is on; its volume too unless `volumeWhenOff` is `disabled`. */
49
+ sections: readonly SoundSection[];
50
+ onBack?: () => void;
51
+ /** A control on the trailing edge of the header, usually an `IconButton`. */
52
+ headerAction?: React.ReactNode;
53
+ /** Pins the header to the top of the nearest scrolling container, transparent at rest and filled with `--hig-sticky-header-background` once content scrolls under it. */
54
+ stickyHeader?: boolean;
55
+ }
56
+ /** The share of the meter filled, from 0 to 1. Unknown and out-of-range levels are clamped. */
57
+ export declare const soundLevel: (level: number | null | undefined) => number;
58
+ /** The settings for what the app plays and feels like: each channel is a card with a switch, and a channel that is on can show the device it uses, a choice of devices, a live input meter and its volume as fixed steps. */
59
+ export declare function SoundHapticsBlock({ title, description, sections, onBack, headerAction, stickyHeader, className, ...rest }: SoundHapticsBlockProps): React.JSX.Element;
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { formatNumber } from '@bloxwap/hig/contracts';
4
+ import { useNumberLocale } from '../provider.js';
5
+ import { Button } from '../button.js';
6
+ import { RadioGroup } from '../selection.js';
7
+ import { ScreenHeader } from './screen-header.js';
8
+ import { SettingSwitch } from './setting-switch.js';
9
+ const steps = [0.25, 0.5, 0.75, 1], percent = { style: 'percent', maximumFractionDigits: 0 };
10
+ /** The share of the meter filled, from 0 to 1. Unknown and out-of-range levels are clamped. */
11
+ export const soundLevel = (level) => level == null || !Number.isFinite(level) ? 0 : Math.min(1, Math.max(0, level));
12
+ /** The settings for what the app plays and feels like: each channel is a card with a switch, and a channel that is on can show the device it uses, a choice of devices, a live input meter and its volume as fixed steps. */
13
+ export function SoundHapticsBlock({ title, description, sections, onBack, headerAction, stickyHeader, className, ...rest }) {
14
+ const locale = useNumberLocale();
15
+ return _jsxs("section", { ...rest, className: `hig-settings-block${className ? ` ${className}` : ''}`, children: [_jsx(ScreenHeader, { title: title, onBack: onBack, action: headerAction, stickyHeader: stickyHeader }), description && _jsx("p", { className: 'hig-settings-description', children: description }), sections.length > 0 && _jsx("div", { className: 'hig-setting-cards', children: sections.map(section => {
16
+ const { source, choices, level, levelLabel, volume, action } = section, on = section.checked;
17
+ const showVolume = !!volume && (on || section.volumeWhenOff === 'disabled'), volumeOff = !!section.disabled || !on;
18
+ const open = (on && (!!source || !!choices || level !== undefined)) || showVolume || !!action;
19
+ return _jsxs("div", { className: 'hig-setting-card', children: [_jsx(SettingSwitch, { label: section.label, description: section.description, checked: section.checked, disabled: section.disabled, onCheckedChange: section.onCheckedChange }), open && _jsxs("div", { className: 'hig-setting-body', children: [on && source && _jsx("span", { className: 'hig-setting-caption', children: source }), on && choices && _jsx("div", { className: 'hig-setting-choices', children: _jsx(RadioGroup, { label: choices.label, options: choices.options, value: choices.value, disabled: section.disabled, onValueChange: choices.onValueChange }) }), on && level !== undefined && (levelLabel ? _jsx("div", { className: 'hig-setting-meter', role: 'meter', "aria-label": levelLabel, "aria-valuemin": 0, "aria-valuemax": 100, "aria-valuenow": Math.round(soundLevel(level) * 100), "aria-valuetext": formatNumber(soundLevel(level), locale, percent), children: _jsx("span", { style: { width: `${soundLevel(level) * 100}%` } }) })
20
+ : _jsx("div", { className: 'hig-setting-meter', "aria-hidden": 'true', children: _jsx("span", { style: { width: `${soundLevel(level) * 100}%` } }) })), showVolume && volume && _jsxs("div", { className: 'hig-setting-volume', role: 'group', "aria-label": volume.label, children: [_jsx("span", { className: 'hig-setting-caption', "aria-hidden": 'true', children: volume.label }), _jsx("div", { className: 'hig-setting-steps', children: (volume.options ?? steps).map(option => _jsx(Button, { fullWidth: true, intent: option === volume.value ? 'primary' : 'secondary', "aria-pressed": option === volume.value, disabled: on ? section.disabled : volumeOff, onClick: () => volume.onValueChange(option), children: formatNumber(option, locale, percent) }, option)) })] }), action && _jsx(Button, { className: 'hig-setting-action', intent: 'secondary', fullWidth: true, disabled: action.disabled, suppressFeedback: action.feedback === false, onClick: action.onSelect, children: action.label })] })] }, section.id);
21
+ }) })] });
22
+ }
@@ -0,0 +1,9 @@
1
+ import { type RefObject } from 'react';
2
+ /**
3
+ * Marks a pinned header `data-scrolled` once content has scrolled under it, so its fill appears only then and it stays
4
+ * transparent at rest. The header's parent is the content: the header is scrolled once the parent's top edge has passed
5
+ * the top of the nearest scroller (or the scroller is the parent and has moved). Where the browser supports scroll-driven
6
+ * animations the stylesheet already fades the fill in on the same rule; this keeps every other browser, and reduced
7
+ * motion, in step with it.
8
+ */
9
+ export declare function useStickyHeader(header: RefObject<HTMLElement | null>, enabled: boolean): void;
@@ -0,0 +1,43 @@
1
+ "use client";
2
+ import { useEffect } from 'react';
3
+ const scrolls = /(auto|scroll|overlay)/;
4
+ /** The nearest ancestor of `node` (itself included) that scrolls vertically, or `null` for the document. */
5
+ function scroller(node) {
6
+ for (let current = node; current && current !== document.body && current !== document.documentElement; current = current.parentElement) {
7
+ if (scrolls.test(getComputedStyle(current).overflowY))
8
+ return current;
9
+ }
10
+ return null;
11
+ }
12
+ /**
13
+ * Marks a pinned header `data-scrolled` once content has scrolled under it, so its fill appears only then and it stays
14
+ * transparent at rest. The header's parent is the content: the header is scrolled once the parent's top edge has passed
15
+ * the top of the nearest scroller (or the scroller is the parent and has moved). Where the browser supports scroll-driven
16
+ * animations the stylesheet already fades the fill in on the same rule; this keeps every other browser, and reduced
17
+ * motion, in step with it.
18
+ */
19
+ export function useStickyHeader(header, enabled) {
20
+ useEffect(() => {
21
+ const element = header.current;
22
+ if (!enabled || !element)
23
+ return;
24
+ const content = element.parentElement;
25
+ if (!content)
26
+ return;
27
+ const root = scroller(content);
28
+ const target = root ?? window;
29
+ // When the parent is the scroller itself a view timeline on it tracks an outer scroller, never its own scrolling, so the
30
+ // stylesheet leaves the scroll-driven fill off (data-sticky-own) and this script alone marks the moment.
31
+ const own = root === content;
32
+ element.toggleAttribute('data-sticky-own', own);
33
+ const update = () => {
34
+ const scrolled = own ? content.scrollTop > 0 : content.getBoundingClientRect().top < (root ? root.getBoundingClientRect().top : 0) - 0.5;
35
+ if (element.hasAttribute('data-scrolled') !== scrolled)
36
+ element.toggleAttribute('data-scrolled', scrolled);
37
+ };
38
+ update();
39
+ target.addEventListener('scroll', update, { passive: true });
40
+ window.addEventListener('resize', update, { passive: true });
41
+ return () => { target.removeEventListener('scroll', update); window.removeEventListener('resize', update); element.removeAttribute('data-scrolled'); element.removeAttribute('data-sticky-own'); };
42
+ }, [header, enabled]);
43
+ }
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { AnimatedNumberReadout } from '../../animated-number.js';
4
+ import { PressDecoration } from '../../provider.js';
5
+ /** The swap panel's From card on its own: the asset with its actions and balance in the slot, the entered amount under it. The host owns the entry, the keypad and what the amount means. */
6
+ export function SwapAmountCard({ name, symbol, icon, chainIcon, context, actions, meta, value, amountLabel, prefix = '', suffix = '', fractionDigits = 0, trailingDot = false, maximumFractionDigits = 8, conversion, onSelect, selectLabel, className, style }) {
7
+ return _jsxs("div", { className: `hig-swap-card${className ? ` ${className}` : ''}`, style: style, "data-side": 'from', children: [_jsxs("div", { className: 'hig-swap-slot', children: [onSelect && _jsx("button", { type: 'button', className: 'hig-swap-hit', "aria-label": selectLabel, onClick: onSelect, children: _jsx(PressDecoration, { kind: 'row' }) }), _jsx("div", { className: 'hig-swap-slot-content', children: _jsxs("div", { className: 'hig-swap-selected', children: [_jsxs("span", { className: 'hig-swap-stack', "aria-hidden": 'true', children: [chainIcon && _jsx("img", { src: chainIcon, alt: '' }), typeof icon === 'string' ? _jsx("img", { src: icon, alt: '' }) : icon ?? _jsx("span", { className: 'hig-swap-initials', children: symbol.slice(0, 3) })] }), _jsxs("span", { className: 'hig-swap-identity', children: [context != null && _jsx("span", { children: context }), _jsx("strong", { children: name })] }), (actions != null || meta != null) && _jsxs("span", { className: 'hig-swap-meta', children: [actions != null && _jsx("span", { className: 'hig-swap-pills', children: actions }), meta != null && _jsx("span", { className: 'hig-number', children: meta })] })] }) })] }), _jsx("div", { className: 'hig-swap-amount-area', children: _jsxs("div", { className: 'hig-swap-amount-content', children: [_jsx("div", { className: 'hig-swap-amount', role: 'textbox', tabIndex: 0, "aria-readonly": 'true', "aria-label": amountLabel, children: _jsx(AnimatedNumberReadout, { value: value, prefix: prefix, suffix: (trailingDot ? '.' : '') + suffix, options: { minimumFractionDigits: Math.min(fractionDigits, maximumFractionDigits), maximumFractionDigits, useGrouping: false } }) }), conversion] }) })] });
8
+ }
@@ -22,5 +22,5 @@ export interface SwapPickerProps {
22
22
  onRecipientChange?: (address: string) => void;
23
23
  onScanRecipient?: () => void;
24
24
  }
25
- /** The panel's pushed picker view: a header with Back above the From or To picker recipe. */
25
+ /** The panel's pushed picker view: a header with Back above the From or To picker block. */
26
26
  export declare function SwapPicker({ side, onBack, selected, onSelect, wallet, onConnect, onDisconnect, receiving, onReceivingChange, recipient, onRecipientChange, onScanRecipient, ...list }: SwapPickerProps): React.JSX.Element;
@@ -3,9 +3,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useRef } from 'react';
4
4
  import * as en from '@bloxwap/hig/contracts/messages';
5
5
  import { useHIG } from '../../provider.js';
6
- import { FromPicker, ToPicker } from '../pickers.js';
6
+ import { FromPickerBlock, ToPickerBlock } from '../pickers.js';
7
7
  import { SwapViewHeader, shortAddress } from './shared.js';
8
- /** The panel's pushed picker view: a header with Back above the From or To picker recipe. */
8
+ /** The panel's pushed picker view: a header with Back above the From or To picker block. */
9
9
  export function SwapPicker({ side, onBack, selected, onSelect, wallet, onConnect, onDisconnect, receiving, onReceivingChange, recipient, onRecipientChange, onScanRecipient, ...list }) {
10
10
  const { messages } = useHIG();
11
11
  const title = side === 'from' ? messages.swapFrom ?? en.swapFrom : messages.swapTo ?? en.swapTo;
@@ -15,6 +15,6 @@ export function SwapPicker({ side, onBack, selected, onSelect, wallet, onConnect
15
15
  heading.current?.focus(); }, []);
16
16
  const choose = (token) => { onSelect(token); onBack(); };
17
17
  return _jsxs("div", { className: 'hig-swap-picker', children: [_jsx(SwapViewHeader, { title: title, titleRef: heading, backLabel: messages.back ?? en.back, onBack: onBack }), side === 'from'
18
- ? _jsx(FromPicker, { ...list, autoFocus: true, selected: selected, onSelect: choose, wallet: wallet ?? { connected: false }, onConnect: onConnect, onDisconnect: onDisconnect, generateAddress: !!receiving, onGenerateAddressChange: onReceivingChange })
19
- : _jsx(ToPicker, { ...list, autoFocus: true, selected: selected, onSelect: choose, address: recipient, onAddressChange: onRecipientChange, addressPlaceholder: wallet?.address ? shortAddress(wallet.address) : undefined, onScan: onScanRecipient })] });
18
+ ? _jsx(FromPickerBlock, { ...list, autoFocus: true, selected: selected, onSelect: choose, wallet: wallet ?? { connected: false }, onConnect: onConnect, onDisconnect: onDisconnect, generateAddress: !!receiving, onGenerateAddressChange: onReceivingChange })
19
+ : _jsx(ToPickerBlock, { ...list, autoFocus: true, selected: selected, onSelect: choose, address: recipient, onAddressChange: onRecipientChange, addressPlaceholder: wallet?.address ? shortAddress(wallet.address) : undefined, onScan: onScanRecipient })] });
20
20
  }
@@ -2,7 +2,7 @@
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useEffect, useRef, useState } from 'react';
4
4
  import * as en from '@bloxwap/hig/contracts/messages';
5
- import { useHIG } from '../../provider.js';
5
+ import { PressDecoration, useHIG } from '../../provider.js';
6
6
  import { Field, Input } from '../../field.js';
7
7
  import { SegmentedControl } from '../../selection.js';
8
8
  import { SwapIcon, SwapNumber, SwapViewHeader, formatPercent, percentNumber, usdNumber } from './shared.js';
@@ -16,7 +16,7 @@ export function SwapSettings({ view, onViewChange, onBack, denomination, onDenom
16
16
  const title = view === 'slippage' ? (messages.swapSlippageTitle ?? en.swapSlippageTitle) : view === 'fees' ? (messages.swapFees ?? en.swapFees) : (messages.swapSettings ?? en.swapSettings);
17
17
  const feeText = quoteLoading ? '…' : fee != null ? _jsx(SwapNumber, { ...usdNumber(fee) }) : '—';
18
18
  const preset = slippagePresets.find(value => Math.abs(value - slippage) < 1e-9);
19
- const row = (label, value, target) => _jsxs("button", { type: 'button', className: 'hig-swap-setting', onClick: () => onViewChange(target), children: [_jsx("span", { children: label }), _jsxs("span", { className: 'hig-swap-setting-value', children: [value, _jsx(SwapIcon, { name: 'chevron', size: 16 })] })] });
19
+ const row = (label, value, target) => _jsxs("button", { type: 'button', className: 'hig-swap-setting', onClick: () => onViewChange(target), children: [_jsx("span", { children: label }), _jsxs("span", { className: 'hig-swap-setting-value', children: [value, _jsx(SwapIcon, { name: 'chevron', size: 16 })] }), _jsx(PressDecoration, { kind: 'row' })] });
20
20
  const slippageRow = row(messages.swapSlippageTitle ?? en.swapSlippageTitle, _jsx(SwapNumber, { ...percentNumber(slippage) }), 'slippage'), feesRow = row(messages.swapFees ?? en.swapFees, feeText, 'fees');
21
21
  return _jsxs("div", { className: 'hig-swap-settings-view', role: 'group', "aria-label": title, children: [_jsx(SwapViewHeader, { title: title, titleRef: heading, backLabel: messages.back ?? en.back, onBack: onBack }), view === 'settings' && _jsxs("div", { className: 'hig-swap-settings', children: [onDenominationChange && _jsx(SegmentedControl, { label: (messages.swapDenomination ?? en.swapDenomination), options: [{ value: 'usd', label: (messages.swapDollars ?? en.swapDollars) }, { value: 'token', label: (messages.swapUnits ?? en.swapUnits) }], value: denomination, onValueChange: value => onDenominationChange(value) }), onSlippageChange && slippageRow, feesRow, children] }), view === 'slippage' && onSlippageChange && _jsxs("div", { className: 'hig-swap-settings hig-swap-presets', children: [_jsx(SegmentedControl, { label: (messages.swapSlippageTitle ?? en.swapSlippageTitle), options: slippagePresets.map(value => ({ value: String(value), label: formatPercent(value) })), value: preset === undefined ? '' : String(preset), onValueChange: value => { setCustom(null); onSlippageChange(Number(value)); } }), _jsx(Field, { label: (messages.swapSlippageCustom ?? en.swapSlippageCustom), children: _jsx(Input, { inputMode: 'decimal', value: custom ?? String(Number((slippage * 100).toFixed(4))), onChange: event => { const raw = event.target.value.replace(/[^0-9.]/g, ''); setCustom(raw); const percent = Number.parseFloat(raw); if (Number.isFinite(percent) && percent >= 0 && percent <= 50)
22
22
  onSlippageChange(percent / 100); } }) })] }), view === 'fees' && _jsxs("dl", { className: 'hig-swap-fees', children: [fees?.map(item => _jsxs("div", { children: [_jsx("dt", { children: item.label }), _jsx("dd", { children: _jsx(SwapNumber, { ...usdNumber(item.usd) }) })] }, item.label)), _jsxs("div", { className: 'hig-swap-fees-total', children: [_jsx("dt", { children: (messages.swapFeeTotal ?? en.swapFeeTotal) }), _jsx("dd", { className: 'hig-number', children: feeText })] })] })] });
@@ -23,6 +23,10 @@ export interface SwapToken {
23
23
  caption?: string | SwapFigure;
24
24
  /** Extra text matched by the picker search, such as the contract address. */
25
25
  keywords?: string;
26
+ /** Picker rows: host text after the balance figure, such as ` HYPE`. */
27
+ unitsSuffix?: string;
28
+ /** Picker rows: the second line under the name in place of the chain, for a list that is not about chains. The search still matches the chain. */
29
+ detail?: string;
26
30
  }
27
31
  /** An image URL, or an element the host draws. */
28
32
  export type SwapArtwork = string | React.ReactElement;
@@ -57,6 +61,8 @@ export interface SwapFigure {
57
61
  options?: Intl.NumberFormatOptions;
58
62
  prefix?: string;
59
63
  suffix?: string;
64
+ /** Host-formatted text for `value`, drawn and read in place of Intl's and still moving place by place. Never parsed back. */
65
+ formattedValue?: string;
60
66
  }
61
67
  /** Host text that is either a fixed string or a live figure. */
62
68
  export declare const swapFigure: (text: string | SwapFigure) => string | React.JSX.Element;
@@ -99,6 +105,7 @@ declare const paths: {
99
105
  flame: React.JSX.Element;
100
106
  logout: React.JSX.Element;
101
107
  wallet: React.JSX.Element;
108
+ info: React.JSX.Element;
102
109
  lock: React.JSX.Element;
103
110
  };
104
111
  export type SwapIconName = keyof typeof paths;
@@ -113,7 +120,7 @@ export declare function TokenIcon({ token, size }: {
113
120
  size?: number;
114
121
  }): React.JSX.Element;
115
122
  /** Small capsule action that sits on a card: Max, Test, the slippage setting and the denomination switch. */
116
- export declare function SwapPill({ children, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement>): React.JSX.Element;
123
+ export declare function SwapPill({ children, ...props }: React.ComponentPropsWithRef<'button'>): React.JSX.Element;
117
124
  /** Numeric keypad. Emits `0`–`9`, `.` or `back`. */
118
125
  export declare function SwapKeypad({ onKey, label, deleteLabel }: {
119
126
  onKey: (key: string) => void;