@bloxwap/hig 0.2.0 → 0.5.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.
Files changed (119) hide show
  1. package/README.md +1 -1
  2. package/chart/README.md +3 -3
  3. package/contracts/README.md +1 -1
  4. package/contracts/dist/messages.d.ts +138 -0
  5. package/contracts/dist/messages.js +48 -2
  6. package/css.d.ts +2 -0
  7. package/feedback/README.md +1 -1
  8. package/feedback/assets/error.wav +0 -0
  9. package/feedback/assets/manifest.json +29 -19
  10. package/feedback/assets/tick.wav +0 -0
  11. package/feedback/assets/toggle.wav +0 -0
  12. package/feedback/dist/contract.d.ts +1 -57
  13. package/feedback/dist/contract.js +2 -1
  14. package/feedback/dist/native.d.ts +2 -1
  15. package/feedback/dist/presets.d.ts +57 -0
  16. package/feedback/dist/presets.js +1 -0
  17. package/native/README.md +6 -1
  18. package/native/dist/animated-number.js +11 -7
  19. package/native/dist/brand.d.ts +1 -1
  20. package/native/dist/brand.js +4 -3
  21. package/native/dist/button.d.ts +3 -2
  22. package/native/dist/button.js +8 -6
  23. package/native/dist/data.d.ts +18 -1
  24. package/native/dist/data.js +22 -2
  25. package/native/dist/field.d.ts +1 -0
  26. package/native/dist/field.js +18 -5
  27. package/native/dist/gesture-sheet.js +5 -3
  28. package/native/dist/icons.d.ts +21 -0
  29. package/native/dist/icons.js +20 -0
  30. package/native/dist/navigation.d.ts +1 -0
  31. package/native/dist/navigation.js +49 -7
  32. package/native/dist/overlay.js +3 -3
  33. package/native/dist/pickers.d.ts +54 -0
  34. package/native/dist/pickers.js +60 -0
  35. package/native/dist/provider.d.ts +25 -6
  36. package/native/dist/provider.js +19 -4
  37. package/native/dist/radio-group.d.ts +17 -1
  38. package/native/dist/radio-group.js +45 -7
  39. package/native/dist/recipes.d.ts +3 -0
  40. package/native/dist/recipes.js +15 -2
  41. package/native/dist/selection.d.ts +1 -0
  42. package/native/dist/selection.js +1 -0
  43. package/native/dist/slider.js +3 -2
  44. package/native/dist/status.d.ts +16 -5
  45. package/native/dist/status.js +55 -15
  46. package/native/dist/surface.d.ts +2 -1
  47. package/native/dist/surface.js +4 -3
  48. package/native/dist/swap-panel.d.ts +125 -0
  49. package/native/dist/swap-panel.js +177 -0
  50. package/native/dist/swap-parts.d.ts +86 -0
  51. package/native/dist/swap-parts.js +66 -0
  52. package/native/dist/swap-shared.d.ts +65 -0
  53. package/native/dist/swap-shared.js +76 -0
  54. package/native/dist/swap-sheet.d.ts +14 -0
  55. package/native/dist/swap-sheet.js +26 -0
  56. package/native/dist/swap-views.d.ts +41 -0
  57. package/native/dist/swap-views.js +37 -0
  58. package/native/dist/switch.d.ts +1 -1
  59. package/native/dist/switch.js +20 -13
  60. package/native/dist/wallet-address.d.ts +37 -0
  61. package/native/dist/wallet-address.js +50 -0
  62. package/native-fonts/README.md +1 -1
  63. package/native-fonts/dist/index.d.ts +1 -1
  64. package/native-fonts/dist/index.js +1 -1
  65. package/native-fonts/fonts/manifest.json +1 -1
  66. package/og-fonts/README.md +2 -2
  67. package/og-fonts/dist/index.d.ts +1 -1
  68. package/og-fonts/dist/index.js +1 -1
  69. package/og-fonts/fonts/manifest.json +1 -1
  70. package/package.json +181 -63
  71. package/react/README.md +22 -1
  72. package/react/dist/animated-number.js +2 -1
  73. package/react/dist/brand.d.ts +1 -1
  74. package/react/dist/brand.js +3 -2
  75. package/react/dist/button.d.ts +2 -2
  76. package/react/dist/button.js +1 -1
  77. package/react/dist/data.d.ts +15 -0
  78. package/react/dist/data.js +13 -0
  79. package/react/dist/field.d.ts +1 -0
  80. package/react/dist/field.js +2 -1
  81. package/react/dist/navigation.js +1 -1
  82. package/react/dist/notify.d.ts +14 -0
  83. package/react/dist/notify.js +6 -0
  84. package/react/dist/recipes/install-command.d.ts +1 -0
  85. package/react/dist/recipes/install-command.js +8 -1
  86. package/react/dist/recipes/pickers.d.ts +57 -0
  87. package/react/dist/recipes/pickers.js +78 -0
  88. package/react/dist/recipes/swap/amount-card.d.ts +40 -0
  89. package/react/dist/recipes/swap/amount-card.js +7 -0
  90. package/react/dist/recipes/swap/picker.d.ts +26 -0
  91. package/react/dist/recipes/swap/picker.js +20 -0
  92. package/react/dist/recipes/swap/settings.d.ts +24 -0
  93. package/react/dist/recipes/swap/settings.js +25 -0
  94. package/react/dist/recipes/swap/shared.d.ts +98 -0
  95. package/react/dist/recipes/swap/shared.js +106 -0
  96. package/react/dist/recipes/swap-panel.d.ts +127 -0
  97. package/react/dist/recipes/swap-panel.js +170 -0
  98. package/react/dist/recipes/swap-sheet.d.ts +16 -0
  99. package/react/dist/recipes/swap-sheet.js +22 -0
  100. package/react/dist/recipes/trade-entry.js +1 -1
  101. package/react/dist/recipes.d.ts +3 -1
  102. package/react/dist/recipes.js +3 -1
  103. package/react/dist/select.js +2 -0
  104. package/react/dist/selection.d.ts +13 -0
  105. package/react/dist/selection.js +7 -0
  106. package/react/dist/status.d.ts +15 -5
  107. package/react/dist/status.js +8 -4
  108. package/react/dist/styles.css +406 -92
  109. package/react/dist/toast.d.ts +17 -0
  110. package/react/dist/toast.js +21 -0
  111. package/react/dist/wallet-address.d.ts +23 -0
  112. package/react/dist/wallet-address.js +24 -0
  113. package/tokens/README.md +9 -1
  114. package/tokens/dist/brand.d.ts +19 -0
  115. package/tokens/dist/brand.js +24 -0
  116. package/tokens/dist/index.d.ts +9 -1
  117. package/tokens/dist/index.js +8 -1
  118. package/tokens/dist/manifest.json +4 -1
  119. package/tokens/dist/tokens.css +1 -0
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { type ToasterProps } from 'sonner';
3
+ import { type Notice } from './status.js';
4
+ export type { ToasterProps } from 'sonner';
5
+ /** Sonner's host for transient HIG notices. Mount once near the app root, inside HIGProvider; any Sonner prop overrides the defaults. */
6
+ export declare function Toaster(props: ToasterProps): React.JSX.Element;
7
+ export interface ToastOptions {
8
+ severity?: Notice['severity'];
9
+ action?: React.ReactNode; /** Accessible name of the close button; defaults to the English `dismissNotice`. Pass the provider's translation from a component. */
10
+ dismissName?: string; /** Milliseconds before auto-dismiss; Sonner's default when omitted. */
11
+ duration?: number; /** Reuse an id to replace a notice instead of stacking it. */
12
+ id?: string | number;
13
+ }
14
+ /** Raises a transient HIG capsule through Sonner and returns its id. Needs a mounted `Toaster` (or the host's own Sonner `Toaster`). */
15
+ export declare function toast(message: string, { severity, action, dismissName, duration, id }?: ToastOptions): string | number;
16
+ /** Dismisses one notice by id, or every notice when the id is omitted. */
17
+ export declare function dismissToast(id?: string | number): void;
@@ -0,0 +1,21 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { useEffect } from 'react';
4
+ import { Toaster as SonnerToaster, toast as sonner } from 'sonner';
5
+ import * as en from '@bloxwap/hig/contracts/messages';
6
+ import { useHIG } from './provider.js';
7
+ import { ToastNotice } from './status.js';
8
+ import { registerNotifier } from './notify.js';
9
+ /** Sonner's host for transient HIG notices. Mount once near the app root, inside HIGProvider; any Sonner prop overrides the defaults. */
10
+ export function Toaster(props) {
11
+ const { direction } = useHIG();
12
+ // While mounted, HIG components that report a result (InstallCommand) raise it here instead of inline.
13
+ useEffect(() => registerNotifier(toast), []);
14
+ return _jsx(SonnerToaster, { position: 'bottom-center', theme: 'dark', dir: direction, ...props });
15
+ }
16
+ /** Raises a transient HIG capsule through Sonner and returns its id. Needs a mounted `Toaster` (or the host's own Sonner `Toaster`). */
17
+ export function toast(message, { severity = 'info', action, dismissName, duration, id } = {}) {
18
+ return sonner.custom(current => _jsx(ToastNotice, { message: message, severity: severity, action: action, dismissName: dismissName ?? en.dismissNotice(message, en.dismiss), onDismiss: () => sonner.dismiss(current) }), { duration, id });
19
+ }
20
+ /** Dismisses one notice by id, or every notice when the id is omitted. */
21
+ export function dismissToast(id) { sonner.dismiss(id); }
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { type AddressKind } from './data.js';
3
+ export { VerticalAddress, addressKind, type AddressKind } from './data.js';
4
+ export interface WalletAddressProps {
5
+ address: string;
6
+ /** Row layout; inferred from the address when omitted (`0x…` is Ethereum-style). */
7
+ kind?: AddressKind;
8
+ /** QR payload when it differs from the address, for example an EIP-681 or Solana Pay URI. Defaults to the address. */
9
+ qrValue?: string;
10
+ /** Image URL shown in the centre of the QR; the code then uses high error correction. */
11
+ arena?: string;
12
+ /** QR edge in CSS pixels; default 196. The address column is exactly as tall. */
13
+ size?: number;
14
+ /** Host clipboard adapter. When set the whole component is one button that copies the address and shows the Tap to copy hint. */
15
+ onCopy?: () => Promise<void> | void;
16
+ className?: string;
17
+ style?: React.CSSProperties;
18
+ }
19
+ /**
20
+ * A wallet address to scan or copy: a Cuer QR code beside the address in HIG's vertical style, for Ethereum-style and
21
+ * Solana addresses. Needs the optional `cuer` peer. The host owns the clipboard through `onCopy`.
22
+ */
23
+ export declare function WalletAddress({ address, kind, qrValue, arena, size, onCopy, className, style }: WalletAddressProps): React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from 'react';
4
+ import { Cuer } from 'cuer';
5
+ import * as en from '@bloxwap/hig/contracts/messages';
6
+ import { useHIG } from './provider.js';
7
+ import { VerticalAddress, addressKind, addressRows } from './data.js';
8
+ import { notify } from './notify.js';
9
+ export { VerticalAddress, addressKind } from './data.js';
10
+ /**
11
+ * A wallet address to scan or copy: a Cuer QR code beside the address in HIG's vertical style, for Ethereum-style and
12
+ * Solana addresses. Needs the optional `cuer` peer. The host owns the clipboard through `onCopy`.
13
+ */
14
+ export function WalletAddress({ address, kind, qrValue, arena, size = 196, onCopy, className, style }) {
15
+ const { messages } = useHIG();
16
+ const [status, setStatus] = useState('');
17
+ const rows = addressRows(address, kind ?? addressKind(address)).length;
18
+ const copy = () => { Promise.resolve().then(onCopy).then(() => { const text = messages.addressCopied ?? en.addressCopied; setStatus(notify(text, { severity: 'success', id: 'hig-wallet-address', dismissName: (messages.dismissNotice ?? en.dismissNotice)(text, messages.dismiss ?? en.dismiss) }) ? '' : text); }).catch(() => setStatus('')); };
19
+ const body = _jsxs(_Fragment, { children: [_jsxs("span", { className: 'hig-wallet-address-body', children: [_jsx("span", { className: 'hig-wallet-address-qr', role: 'img', "aria-label": messages.qrCode ?? en.qrCode, children: _jsxs(Cuer.Root, { value: qrValue ?? address, errorCorrection: arena ? 'high' : 'medium', color: 'currentColor', "aria-hidden": 'true', children: [_jsx(Cuer.Finder, {}), _jsx(Cuer.Cells, {}), arena && _jsx(Cuer.Arena, { children: _jsx("img", { src: arena, alt: '', style: { width: '100%', height: '100%', objectFit: 'cover', borderRadius: 1 } }) })] }) }), _jsx(VerticalAddress, { address: address, kind: kind, rowHeight: size / rows })] }), onCopy && _jsxs("span", { className: 'hig-wallet-address-hint', children: [_jsxs("svg", { "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', children: [_jsx("rect", { x: '7', y: '7', width: '9.5', height: '9.5', rx: '2' }), _jsx("path", { d: 'M4.5 13H4a1.5 1.5 0 0 1-1.5-1.5V5A1.5 1.5 0 0 1 4 3.5h6.5A1.5 1.5 0 0 1 12 5v.5' })] }), messages.tapToCopy ?? en.tapToCopy] })] });
20
+ const shared = { className: `hig-wallet-address${className ? ` ${className}` : ''}`, style: { '--hig-qr': `${size}px`, ...style } };
21
+ return onCopy
22
+ ? _jsxs(_Fragment, { children: [_jsx("button", { type: 'button', ...shared, "aria-label": (messages.copyAddress ?? en.copyAddress) + ': ' + address, onClick: copy, children: body }), _jsx("span", { className: 'hig-sr-only', role: 'status', children: status })] })
23
+ : _jsx("div", { ...shared, children: body });
24
+ }
package/tokens/README.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # @bloxwap/hig/tokens
2
2
 
3
- Version 0.2.0, an entry of `@bloxwap/hig`. See the HIG architecture and platform limitations before adoption.
3
+ Version 0.5.1, an entry of `@bloxwap/hig`. See the HIG architecture and platform limitations before adoption.
4
4
 
5
5
  `resolvePrimaryColor('#ff0000')` resolves a custom brand's `action`, `focus`, and
6
6
  `onAction` roles. Input is opaque sRGB hex (`#RGB` or `#RRGGBB`); the foreground
7
7
  is black or white, whichever gives more contrast. An optional second argument,
8
8
  `'display-p3'`, converts the accent into native P3 channel hex. React and native
9
9
  hosts normally set `HIGProvider primaryColor` instead.
10
+
11
+ ## Source validation and React density
12
+
13
+ `npm run generate` rejects colours without a non-empty `srgb` or `oklch`, density modes with keys that differ from `comfortable`, and motion/space values that are not positive finite numbers. Reduced-motion CSS still overrides generated durations to zero.
14
+
15
+ React CSS keeps pixel-based `--hig-control` and `--hig-gap` values for existing layout behavior; `tests/token-source.test.ts` compares both density modes directly with `source.json` so token changes require matching CSS updates.
16
+
17
+ React buttons intentionally retain the existing 44px comfortable minimum (`--hig-button`), a smaller web button geometry than the 48px `density.comfortable.target` used for general control targets. This preserves existing layouts; the target token does not describe every web button's rendered hit area. Compact buttons and targets are both 36px. These are minimum dimensions and content can make a button larger.
@@ -0,0 +1,19 @@
1
+ /** The approved Bloxwap mark: geometry and fills read from the pinned SVG. `displayP3` is the same fill as Display P3 channel hex. These are the asset's own colours, not token roles: they do not follow `primaryColor` or a palette change. */
2
+ export declare const brandMark: {
3
+ readonly source: "packages/hig/tokens/assets/bloxwap-icon.svg";
4
+ readonly sourceSha256: "a1f1cea3e2e6d7173b674d72225314cedb76ec1fd62b1fe5649d9e361bb4fea8";
5
+ readonly viewBox: "0 0 100 100";
6
+ readonly size: 100;
7
+ readonly radius: 22.37;
8
+ readonly fill: {
9
+ readonly srgb: "#00ff3f";
10
+ readonly displayP3: "#00ff3d";
11
+ };
12
+ readonly stroke: {
13
+ readonly srgb: "#0a0a0a";
14
+ readonly displayP3: "#0a0a0a";
15
+ };
16
+ readonly strokeWidth: 16;
17
+ readonly strokeLinecap: "round";
18
+ readonly paths: readonly ["M25 75L75 25", "M24 24L35 35", "M65 65L76 76"];
19
+ };
@@ -0,0 +1,24 @@
1
+ // Generated by npm run generate from packages/hig/tokens/assets/bloxwap-icon.svg. Do not edit.
2
+ /** The approved Bloxwap mark: geometry and fills read from the pinned SVG. `displayP3` is the same fill as Display P3 channel hex. These are the asset's own colours, not token roles: they do not follow `primaryColor` or a palette change. */
3
+ export const brandMark = {
4
+ "source": "packages/hig/tokens/assets/bloxwap-icon.svg",
5
+ "sourceSha256": "a1f1cea3e2e6d7173b674d72225314cedb76ec1fd62b1fe5649d9e361bb4fea8",
6
+ "viewBox": "0 0 100 100",
7
+ "size": 100,
8
+ "radius": 22.37,
9
+ "fill": {
10
+ "srgb": "#00ff3f",
11
+ "displayP3": "#00ff3d"
12
+ },
13
+ "stroke": {
14
+ "srgb": "#0a0a0a",
15
+ "displayP3": "#0a0a0a"
16
+ },
17
+ "strokeWidth": 16,
18
+ "strokeLinecap": "round",
19
+ "paths": [
20
+ "M25 75L75 25",
21
+ "M24 24L35 35",
22
+ "M65 65L76 76"
23
+ ]
24
+ };
@@ -1,6 +1,6 @@
1
1
  export { resolvePrimaryColor, type PrimaryColors } from './theme.js';
2
2
  export declare const tokens: {
3
- readonly version: "0.1.1";
3
+ readonly version: "0.1.2";
4
4
  readonly mode: "dark";
5
5
  readonly provenance: "bloxwap/monorepo@d47cef4c40363184bdfda8d8c263ead108ef9ff6/packages/hig/tokens/src/colors.ts; HIG semantic intent/density aliases documented in docs/foundations/source-reconciliation.md";
6
6
  readonly colors: {
@@ -17,6 +17,9 @@ export declare const tokens: {
17
17
  readonly srgb: "#262626";
18
18
  readonly oklch: "oklch(0.269 0 0)";
19
19
  };
20
+ readonly overlay: {
21
+ readonly srgb: "#111111";
22
+ };
20
23
  readonly text: {
21
24
  readonly srgb: "#fafafa";
22
25
  readonly oklch: "oklch(0.985 0 0)";
@@ -149,6 +152,7 @@ export declare const nativeSrgb: {
149
152
  readonly background: "#0a0a0a";
150
153
  readonly surface: "#171717";
151
154
  readonly nested: "#262626";
155
+ readonly overlay: "#111111";
152
156
  readonly text: "#fafafa";
153
157
  readonly muted: "#a1a1a1";
154
158
  readonly faint: "#858585";
@@ -167,6 +171,7 @@ export declare const nativeDisplayP3: {
167
171
  readonly background: "#0a0a0a";
168
172
  readonly surface: "#171717";
169
173
  readonly nested: "#262626";
174
+ readonly overlay: "#111111";
170
175
  readonly text: "#fafafa";
171
176
  readonly muted: "#a1a1a1";
172
177
  readonly faint: "#858585";
@@ -323,6 +328,7 @@ export declare const nativeColors: {
323
328
  readonly background: "#0a0a0a";
324
329
  readonly surface: "#171717";
325
330
  readonly nested: "#262626";
331
+ readonly overlay: "#111111";
326
332
  readonly text: "#fafafa";
327
333
  readonly muted: "#a1a1a1";
328
334
  readonly faint: "#858585";
@@ -341,6 +347,7 @@ export declare const nativeColors: {
341
347
  readonly background: "#0a0a0a";
342
348
  readonly surface: "#171717";
343
349
  readonly nested: "#262626";
350
+ readonly overlay: "#111111";
344
351
  readonly text: "#fafafa";
345
352
  readonly muted: "#a1a1a1";
346
353
  readonly faint: "#858585";
@@ -359,6 +366,7 @@ export declare const nativeColors: {
359
366
  readonly background: "#0a0a0a";
360
367
  readonly surface: "#171717";
361
368
  readonly nested: "#262626";
369
+ readonly overlay: "#111111";
362
370
  readonly text: "#fafafa";
363
371
  readonly muted: "#a1a1a1";
364
372
  readonly faint: "#858585";
@@ -1,7 +1,7 @@
1
1
  // Generated by npm run generate.
2
2
  export { resolvePrimaryColor } from './theme.js';
3
3
  export const tokens = {
4
- "version": "0.1.1",
4
+ "version": "0.1.2",
5
5
  "mode": "dark",
6
6
  "provenance": "bloxwap/monorepo@d47cef4c40363184bdfda8d8c263ead108ef9ff6/packages/hig/tokens/src/colors.ts; HIG semantic intent/density aliases documented in docs/foundations/source-reconciliation.md",
7
7
  "colors": {
@@ -22,6 +22,9 @@ export const tokens = {
22
22
  "srgb": "#262626",
23
23
  "oklch": "oklch(0.269 0 0)"
24
24
  },
25
+ "overlay": {
26
+ "srgb": "#111111"
27
+ },
25
28
  "text": {
26
29
  "srgb": "#fafafa",
27
30
  "oklch": "oklch(0.985 0 0)"
@@ -202,6 +205,7 @@ export const nativeSrgb = {
202
205
  "background": "#0a0a0a",
203
206
  "surface": "#171717",
204
207
  "nested": "#262626",
208
+ "overlay": "#111111",
205
209
  "text": "#fafafa",
206
210
  "muted": "#a1a1a1",
207
211
  "faint": "#858585",
@@ -221,6 +225,7 @@ export const nativeDisplayP3 = {
221
225
  "background": "#0a0a0a",
222
226
  "surface": "#171717",
223
227
  "nested": "#262626",
228
+ "overlay": "#111111",
224
229
  "text": "#fafafa",
225
230
  "muted": "#a1a1a1",
226
231
  "faint": "#858585",
@@ -377,6 +382,7 @@ export const nativeColors = {
377
382
  "background": "#0a0a0a",
378
383
  "surface": "#171717",
379
384
  "nested": "#262626",
385
+ "overlay": "#111111",
380
386
  "text": "#fafafa",
381
387
  "muted": "#a1a1a1",
382
388
  "faint": "#858585",
@@ -395,6 +401,7 @@ export const nativeColors = {
395
401
  "background": "#0a0a0a",
396
402
  "surface": "#171717",
397
403
  "nested": "#262626",
404
+ "overlay": "#111111",
398
405
  "text": "#fafafa",
399
406
  "muted": "#a1a1a1",
400
407
  "faint": "#858585",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.1",
2
+ "version": "0.1.2",
3
3
  "mode": "dark",
4
4
  "provenance": "bloxwap/monorepo@d47cef4c40363184bdfda8d8c263ead108ef9ff6/packages/hig/tokens/src/colors.ts; HIG semantic intent/density aliases documented in docs/foundations/source-reconciliation.md",
5
5
  "colors": {
@@ -20,6 +20,9 @@
20
20
  "srgb": "#262626",
21
21
  "oklch": "oklch(0.269 0 0)"
22
22
  },
23
+ "overlay": {
24
+ "srgb": "#111111"
25
+ },
23
26
  "text": {
24
27
  "srgb": "#fafafa",
25
28
  "oklch": "oklch(0.985 0 0)"
@@ -2,6 +2,7 @@
2
2
  --hig-background: #0a0a0a;
3
3
  --hig-surface: #171717;
4
4
  --hig-nested: #262626;
5
+ --hig-overlay: #111111;
5
6
  --hig-text: #fafafa;
6
7
  --hig-muted: #a1a1a1;
7
8
  --hig-faint: #858585;