@bloxwap/hig 0.7.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 +29 -2
- package/contracts/dist/index.js +123 -4
- package/contracts/dist/invariants.d.ts +17 -0
- package/contracts/dist/invariants.js +24 -0
- package/contracts/dist/messages.d.ts +56 -2
- package/contracts/dist/messages.js +20 -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 +10 -1
- package/native/dist/account-block.js +17 -7
- package/native/dist/animated-number-model.d.ts +41 -1
- package/native/dist/animated-number-model.js +201 -23
- package/native/dist/animated-number.d.ts +39 -1
- package/native/dist/animated-number.js +161 -16
- package/native/dist/announce.d.ts +2 -0
- package/native/dist/announce.js +10 -0
- package/native/dist/asset-balance-row.d.ts +3 -1
- package/native/dist/asset-balance-row.js +15 -4
- 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 +2 -0
- package/native/dist/bar-mark.js +4 -2
- package/native/dist/bar-pnl.js +2 -1
- package/native/dist/blocks.d.ts +6 -1
- package/native/dist/blocks.js +5 -0
- package/native/dist/brand.js +2 -1
- package/native/dist/button.d.ts +7 -2
- package/native/dist/button.js +13 -3
- 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.js +2 -0
- package/native/dist/explainer-block.d.ts +91 -0
- package/native/dist/explainer-block.js +34 -0
- package/native/dist/field.d.ts +5 -1
- package/native/dist/field.js +27 -6
- 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 +10 -1
- package/native/dist/language-block.js +11 -4
- package/native/dist/list-group.d.ts +3 -1
- package/native/dist/list-group.js +26 -13
- package/native/dist/manage-position-block.d.ts +8 -1
- package/native/dist/manage-position-block.js +7 -2
- package/native/dist/market-row.js +19 -8
- package/native/dist/navigation.js +5 -3
- package/native/dist/number-format.d.ts +6 -0
- package/native/dist/number-format.js +9 -0
- package/native/dist/pickers.d.ts +8 -0
- package/native/dist/pickers.js +3 -3
- package/native/dist/position-block.d.ts +5 -5
- 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 +10 -1
- package/native/dist/profile-block.js +8 -3
- package/native/dist/provider.d.ts +5 -2
- package/native/dist/provider.js +27 -5
- package/native/dist/qr-code.d.ts +33 -0
- package/native/dist/qr-code.js +29 -0
- package/native/dist/radio-group.d.ts +19 -7
- package/native/dist/radio-group.js +39 -10
- package/native/dist/reward-block.d.ts +10 -7
- package/native/dist/reward-block.js +9 -4
- package/native/dist/screen-header.d.ts +13 -3
- package/native/dist/screen-header.js +12 -4
- package/native/dist/select.js +4 -2
- package/native/dist/selection.d.ts +2 -1
- package/native/dist/selection.js +1 -0
- package/native/dist/setting-switch.d.ts +1 -1
- package/native/dist/setting-switch.js +7 -3
- package/native/dist/slider.js +5 -1
- package/native/dist/sound-haptics-block.js +1 -1
- package/native/dist/status.d.ts +41 -9
- package/native/dist/status.js +34 -17
- package/native/dist/sticky-header.js +9 -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 +9 -3
- package/native/dist/swap-panel-block.js +59 -33
- package/native/dist/swap-parts.d.ts +3 -10
- package/native/dist/swap-parts.js +22 -24
- package/native/dist/swap-shared.d.ts +2 -2
- package/native/dist/swap-shared.js +10 -6
- package/native/dist/swap-views.js +1 -1
- package/native/dist/target-block.d.ts +7 -1
- package/native/dist/target-block.js +13 -6
- package/native/dist/toast.d.ts +47 -0
- package/native/dist/toast.js +386 -0
- package/native/dist/token-action-block.d.ts +10 -1
- package/native/dist/token-action-block.js +9 -4
- package/native/dist/trade-history-list-block.js +7 -4
- package/native/dist/wallet-address-core.js +6 -3
- package/native-fonts/README.md +1 -1
- package/og-fonts/README.md +1 -1
- package/package.json +111 -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 +18 -0
- package/react/dist/animated-number-model.js +75 -5
- package/react/dist/animated-number.d.ts +45 -1
- package/react/dist/animated-number.js +137 -6
- package/react/dist/asset-balance-row.d.ts +3 -1
- package/react/dist/asset-balance-row.js +10 -4
- 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/blocks/account-block.d.ts +5 -1
- package/react/dist/blocks/account-block.js +11 -6
- 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 +5 -1
- package/react/dist/blocks/language-block.js +4 -3
- package/react/dist/blocks/manage-position-block.d.ts +3 -1
- package/react/dist/blocks/manage-position-block.js +2 -2
- package/react/dist/blocks/market-row.js +8 -3
- package/react/dist/blocks/notifications-block.d.ts +3 -1
- package/react/dist/blocks/notifications-block.js +2 -2
- package/react/dist/blocks/pickers.d.ts +9 -0
- package/react/dist/blocks/pickers.js +4 -2
- package/react/dist/blocks/position-block.d.ts +3 -3
- 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 +5 -1
- package/react/dist/blocks/profile-block.js +12 -13
- package/react/dist/blocks/reward-block.d.ts +13 -8
- package/react/dist/blocks/reward-block.js +7 -4
- package/react/dist/blocks/screen-header.d.ts +10 -2
- package/react/dist/blocks/screen-header.js +7 -4
- package/react/dist/blocks/setting-switch.js +6 -3
- package/react/dist/blocks/signals-block.d.ts +3 -1
- package/react/dist/blocks/signals-block.js +4 -3
- package/react/dist/blocks/sound-haptics-block.d.ts +3 -1
- package/react/dist/blocks/sound-haptics-block.js +2 -2
- package/react/dist/blocks/sticky-header.d.ts +14 -4
- package/react/dist/blocks/sticky-header.js +68 -8
- package/react/dist/blocks/swap/settings.js +2 -1
- package/react/dist/blocks/swap/shared.d.ts +22 -22
- package/react/dist/blocks/swap/shared.js +30 -28
- package/react/dist/blocks/swap-panel-block.d.ts +10 -3
- package/react/dist/blocks/swap-panel-block.js +71 -36
- package/react/dist/blocks/target-block.d.ts +7 -1
- package/react/dist/blocks/target-block.js +10 -4
- package/react/dist/blocks/token-action-block.d.ts +5 -1
- package/react/dist/blocks/token-action-block.js +2 -2
- package/react/dist/blocks/trade-history-detail-block.d.ts +3 -1
- package/react/dist/blocks/trade-history-detail-block.js +2 -2
- package/react/dist/blocks/trade-history-list-block.d.ts +3 -1
- package/react/dist/blocks/trade-history-list-block.js +7 -4
- package/react/dist/blocks.d.ts +5 -1
- package/react/dist/blocks.js +4 -0
- package/react/dist/brand.js +2 -1
- package/react/dist/button.d.ts +9 -3
- package/react/dist/button.js +8 -3
- package/react/dist/confetti.d.ts +27 -0
- package/react/dist/confetti.js +240 -0
- package/react/dist/data.js +8 -1
- package/react/dist/field.d.ts +6 -1
- package/react/dist/field.js +18 -9
- package/react/dist/gesture-sheet.d.ts +15 -1
- package/react/dist/gesture-sheet.js +53 -8
- package/react/dist/list-group.js +11 -7
- 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 +2 -2
- package/react/dist/provider.js +23 -6
- 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 +13 -5
- package/react/dist/selection.js +13 -8
- 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 +238 -163
- package/react/dist/toast.d.ts +19 -12
- package/react/dist/toast.js +29 -7
- package/react/dist/wallet-address-core.d.ts +8 -4
- package/react/dist/wallet-address-core.js +10 -5
- 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
package/react/dist/toast.d.ts
CHANGED
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type ToasterProps } from 'sonner';
|
|
3
|
-
import { type
|
|
3
|
+
import { type ToastBaseOptions, type ToastCall, type ToastId } from '@bloxwap/hig/contracts/toast';
|
|
4
4
|
export type { ToasterProps } from 'sonner';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
export type { ToastBaseOptions, ToastCall, ToastId, ToastPosition, ToastSeverity, ToastSwipeDirection } from '@bloxwap/hig/contracts/toast';
|
|
6
|
+
/**
|
|
7
|
+
* Sonner's host for transient HIG notices. Mount once near the app root, inside HIGProvider. It shares its defaults with the
|
|
8
|
+
* native `Toaster` (`@bloxwap/hig/contracts/toast`): three visible notices, a 14px gap, four seconds, and offsets that clear
|
|
9
|
+
* the safe area. Any Sonner prop overrides them. As on native, `offset` places the stack at every window width: Sonner's
|
|
10
|
+
* `mobileOffset`, for windows under 600px, takes `offset` unless it is given itself, and an edge neither names keeps the
|
|
11
|
+
* narrow default.
|
|
12
|
+
*/
|
|
13
|
+
export declare function Toaster({ offset, mobileOffset, ...props }: ToasterProps): React.JSX.Element;
|
|
14
|
+
export interface ToastOptions extends ToastBaseOptions {
|
|
15
|
+
action?: React.ReactNode;
|
|
13
16
|
}
|
|
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
17
|
/** Dismisses one notice by id, or every notice when the id is omitted. */
|
|
17
|
-
export declare function dismissToast(id?:
|
|
18
|
+
export declare function dismissToast(id?: ToastId): void;
|
|
19
|
+
/**
|
|
20
|
+
* Raises a transient HIG capsule through Sonner and returns its id. Needs a mounted `Toaster` (or the host's own Sonner
|
|
21
|
+
* `Toaster`). `toast.success`, `toast.error`, `toast.warning` and `toast.info` set the severity; `toast.dismiss` is
|
|
22
|
+
* `dismissToast`. The same call, options and names work in `@bloxwap/hig/native/toast`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const toast: ToastCall<ToastOptions>;
|
package/react/dist/toast.js
CHANGED
|
@@ -3,19 +3,41 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect } from 'react';
|
|
4
4
|
import { Toaster as SonnerToaster, toast as sonner } from 'sonner';
|
|
5
5
|
import * as en from '@bloxwap/hig/contracts/messages';
|
|
6
|
+
import { TOAST_DURATION, TOAST_GAP, TOAST_NARROW_OFFSET, TOAST_OFFSET, TOAST_VISIBLE, toastDuration } from '@bloxwap/hig/contracts/toast';
|
|
6
7
|
import { useHIG } from './provider.js';
|
|
7
8
|
import { ToastNotice } from './status.js';
|
|
8
9
|
import { registerNotifier } from './notify.js';
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const edges = ['top', 'right', 'bottom', 'left'];
|
|
11
|
+
/** A number, for every edge or for one named edge, is a distance added to that edge's safe-area inset, as the native host places its stack; an edge left out keeps the default. A string is the host's own CSS and reaches Sonner untouched. */
|
|
12
|
+
const inset = (offset, fallback) => typeof offset === 'string' ? offset : Object.fromEntries(edges.map(edge => { const value = typeof offset === 'object' ? offset[edge] : offset; return [edge, typeof value === 'string' ? value : `calc(env(safe-area-inset-${edge}, 0px) + ${value ?? fallback}px)`]; }));
|
|
13
|
+
/**
|
|
14
|
+
* Sonner's host for transient HIG notices. Mount once near the app root, inside HIGProvider. It shares its defaults with the
|
|
15
|
+
* native `Toaster` (`@bloxwap/hig/contracts/toast`): three visible notices, a 14px gap, four seconds, and offsets that clear
|
|
16
|
+
* the safe area. Any Sonner prop overrides them. As on native, `offset` places the stack at every window width: Sonner's
|
|
17
|
+
* `mobileOffset`, for windows under 600px, takes `offset` unless it is given itself, and an edge neither names keeps the
|
|
18
|
+
* narrow default.
|
|
19
|
+
*/
|
|
20
|
+
export function Toaster({ offset, mobileOffset, ...props }) {
|
|
21
|
+
const { direction, messages } = useHIG();
|
|
12
22
|
// While mounted, HIG components that report a result (InstallCommand) raise it here instead of inline.
|
|
13
23
|
useEffect(() => registerNotifier(toast), []);
|
|
14
|
-
return _jsx(SonnerToaster, { position: 'bottom-center', theme: 'dark', dir: direction, ...props });
|
|
24
|
+
return _jsx(SonnerToaster, { position: 'bottom-center', theme: 'dark', dir: direction, visibleToasts: TOAST_VISIBLE, gap: TOAST_GAP, duration: TOAST_DURATION, containerAriaLabel: messages.notifications ?? en.notifications, offset: inset(offset, TOAST_OFFSET), mobileOffset: inset(mobileOffset ?? offset, TOAST_NARROW_OFFSET), ...props });
|
|
15
25
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
26
|
+
/** The capsule as Sonner draws it: inside the Toaster's tree, so the close button's name comes from the provider's translation. */
|
|
27
|
+
function Raised({ message, options, onClose }) {
|
|
28
|
+
const { messages } = useHIG();
|
|
29
|
+
return _jsx(ToastNotice, { message: message, description: options.description, severity: options.severity ?? 'info', action: options.action, dismissName: options.dismissName ?? (messages.dismissNotice ?? en.dismissNotice)(message, messages.dismiss ?? en.dismiss), onDismiss: onClose });
|
|
30
|
+
}
|
|
31
|
+
function raise(message, options = {}) {
|
|
32
|
+
const { duration, id, onDismiss, onAutoClose } = options;
|
|
33
|
+
return sonner.custom(current => _jsx(Raised, { message: message, options: options, onClose: () => sonner.dismiss(current) }), { duration: toastDuration(duration), id, onDismiss: onDismiss && (() => onDismiss()), onAutoClose: onAutoClose && (() => onAutoClose()) });
|
|
19
34
|
}
|
|
20
35
|
/** Dismisses one notice by id, or every notice when the id is omitted. */
|
|
21
36
|
export function dismissToast(id) { sonner.dismiss(id); }
|
|
37
|
+
const as = (severity) => (message, options) => raise(message, { ...options, severity });
|
|
38
|
+
/**
|
|
39
|
+
* Raises a transient HIG capsule through Sonner and returns its id. Needs a mounted `Toaster` (or the host's own Sonner
|
|
40
|
+
* `Toaster`). `toast.success`, `toast.error`, `toast.warning` and `toast.info` set the severity; `toast.dismiss` is
|
|
41
|
+
* `dismissToast`. The same call, options and names work in `@bloxwap/hig/native/toast`.
|
|
42
|
+
*/
|
|
43
|
+
export const toast = Object.assign(raise, { success: as('success'), error: as('error'), warning: as('warning'), info: as('info'), dismiss: dismissToast });
|
|
@@ -5,8 +5,12 @@ export interface WalletAddressCoreProps {
|
|
|
5
5
|
address: string;
|
|
6
6
|
/** Row layout; inferred from the address when omitted (`0x…` is Ethereum-style). */
|
|
7
7
|
kind?: AddressKind;
|
|
8
|
-
/** The QR code, drawn by the host (its own encoder, or a `cuer` QR it renders itself), sized to `size`. It is named by the built-in “QR code” label, so keep the host's drawing hidden from assistive technology. */
|
|
9
|
-
qr
|
|
8
|
+
/** The QR code, drawn by the host (its own encoder, or a `cuer` QR it renders itself), sized to `size`. It is named by the built-in “QR code” label, so keep the host's drawing hidden from assistive technology. Omitted or `null`, HIG draws its own `QRCode` of `qrValue`, which needs no package. */
|
|
9
|
+
qr?: React.ReactNode;
|
|
10
|
+
/** QR payload of HIG's own code when it differs from the address, for example an EIP-681 or Solana Pay URI. Defaults to the address. Unused with `qr`. */
|
|
11
|
+
qrValue?: string;
|
|
12
|
+
/** Image URL shown in the centre of HIG's own code, which then uses high error correction. Unused with `qr`. */
|
|
13
|
+
arena?: string;
|
|
10
14
|
/** QR edge in CSS pixels; default 196. The address column is exactly as tall. */
|
|
11
15
|
size?: number;
|
|
12
16
|
/** Host clipboard adapter. When set the whole component is one button that copies the address and shows the Tap to copy hint. */
|
|
@@ -17,7 +21,7 @@ export interface WalletAddressCoreProps {
|
|
|
17
21
|
style?: React.CSSProperties;
|
|
18
22
|
}
|
|
19
23
|
/**
|
|
20
|
-
* `WalletAddress` without the
|
|
24
|
+
* `WalletAddress` without the optional `cuer` peer: the code is HIG's own `QRCode`, or the host's drawing passed as `qr`.
|
|
21
25
|
* The address column, the copy button, its hint and the notice are the same as `WalletAddress` from `wallet-address`.
|
|
22
26
|
*/
|
|
23
|
-
export declare function WalletAddress({ address, kind, qr, size, onCopy, announce, className, style }: WalletAddressCoreProps): React.JSX.Element;
|
|
27
|
+
export declare function WalletAddress({ address, kind, qr, qrValue, arena, size, onCopy, announce, className, style }: WalletAddressCoreProps): React.JSX.Element;
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Copy } from '@bloxwap/icons/react/copy';
|
|
4
|
+
import { useAsyncResult } from './async-result.js';
|
|
3
5
|
import { useState } from 'react';
|
|
4
6
|
import * as en from '@bloxwap/hig/contracts/messages';
|
|
5
7
|
import { PressDecoration, useHIG } from './provider.js';
|
|
6
8
|
import { VerticalAddress, addressKind, addressRows } from './data.js';
|
|
7
9
|
import { notify } from './notify.js';
|
|
10
|
+
import { QRCode } from './qr-code.js';
|
|
8
11
|
export { VerticalAddress, addressKind } from './data.js';
|
|
9
12
|
/**
|
|
10
|
-
* `WalletAddress` without the
|
|
13
|
+
* `WalletAddress` without the optional `cuer` peer: the code is HIG's own `QRCode`, or the host's drawing passed as `qr`.
|
|
11
14
|
* The address column, the copy button, its hint and the notice are the same as `WalletAddress` from `wallet-address`.
|
|
12
15
|
*/
|
|
13
|
-
export function WalletAddress({ address, kind, qr, size = 196, onCopy, announce = true, className, style }) {
|
|
16
|
+
export function WalletAddress({ address, kind, qr, qrValue, arena, size = 196, onCopy, announce = true, className, style }) {
|
|
14
17
|
const { messages } = useHIG();
|
|
15
18
|
const [status, setStatus] = useState('');
|
|
16
19
|
const rows = addressRows(address, kind ?? addressKind(address)).length;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
const beginCopy = useAsyncResult(address);
|
|
21
|
+
const copy = () => { const current = beginCopy(); Promise.resolve().then(onCopy).then(() => { if (!current() || !announce)
|
|
22
|
+
return; 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(() => { if (current())
|
|
23
|
+
setStatus(''); }); };
|
|
24
|
+
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: qr ?? _jsx(QRCode, { value: qrValue ?? address, arena: arena, size: size, quietZone: 0, background: 'none', color: 'currentColor', decorative: true }) }), _jsx(VerticalAddress, { address: address, kind: kind, rowHeight: size / rows })] }), onCopy && _jsxs("span", { className: 'hig-wallet-address-hint', children: [_jsx(Copy, { size: 20 }), messages.tapToCopy ?? en.tapToCopy] })] });
|
|
20
25
|
const shared = { className: `hig-wallet-address${className ? ` ${className}` : ''}`, style: { '--hig-qr': `${size}px`, ...style } };
|
|
21
26
|
return onCopy
|
|
22
27
|
? _jsxs(_Fragment, { children: [_jsxs("button", { type: 'button', ...shared, "aria-label": (messages.copyAddress ?? en.copyAddress) + ': ' + address, onClick: copy, children: [body, _jsx(PressDecoration, { kind: 'row' })] }), announce && _jsx("span", { className: 'hig-sr-only', role: 'status', children: status })] })
|
package/tokens/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/tokens
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.8.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
|
|
@@ -10,7 +10,7 @@ hosts normally set `HIGProvider primaryColor` instead.
|
|
|
10
10
|
|
|
11
11
|
## Source validation and React density
|
|
12
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.
|
|
13
|
+
`npm run generate` rejects colours without a non-empty `srgb` or `oklch`, density modes with keys that differ from `comfortable`, and motion/space/safeArea values that are not positive finite numbers. Reduced-motion CSS still overrides generated durations to zero.
|
|
14
14
|
|
|
15
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
16
|
|
package/tokens/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,14 @@ export declare const tokens: {
|
|
|
81
81
|
readonly xxxl: 32;
|
|
82
82
|
readonly section: 48;
|
|
83
83
|
};
|
|
84
|
+
readonly safeArea: {
|
|
85
|
+
readonly chromeGutter: 8;
|
|
86
|
+
readonly sheetContentGutter: 16;
|
|
87
|
+
readonly toastOffset: 60;
|
|
88
|
+
readonly fullscreenMin: 20;
|
|
89
|
+
readonly axisChromeTop: 56;
|
|
90
|
+
readonly axisChromeBottom: 88;
|
|
91
|
+
};
|
|
84
92
|
readonly radius: {
|
|
85
93
|
readonly sm: 6;
|
|
86
94
|
readonly md: 8;
|
|
@@ -221,6 +229,14 @@ export declare const nativeMetrics: {
|
|
|
221
229
|
readonly base: 260;
|
|
222
230
|
readonly slow: 320;
|
|
223
231
|
};
|
|
232
|
+
readonly safeArea: {
|
|
233
|
+
readonly chromeGutter: 8;
|
|
234
|
+
readonly sheetContentGutter: 16;
|
|
235
|
+
readonly toastOffset: 60;
|
|
236
|
+
readonly fullscreenMin: 20;
|
|
237
|
+
readonly axisChromeTop: 56;
|
|
238
|
+
readonly axisChromeBottom: 88;
|
|
239
|
+
};
|
|
224
240
|
};
|
|
225
241
|
export declare const sourceColors: {
|
|
226
242
|
readonly web: {
|
package/tokens/dist/index.js
CHANGED
|
@@ -122,6 +122,14 @@ export const tokens = {
|
|
|
122
122
|
"xxxl": 32,
|
|
123
123
|
"section": 48
|
|
124
124
|
},
|
|
125
|
+
"safeArea": {
|
|
126
|
+
"chromeGutter": 8,
|
|
127
|
+
"sheetContentGutter": 16,
|
|
128
|
+
"toastOffset": 60,
|
|
129
|
+
"fullscreenMin": 20,
|
|
130
|
+
"axisChromeTop": 56,
|
|
131
|
+
"axisChromeBottom": 88
|
|
132
|
+
},
|
|
125
133
|
"radius": {
|
|
126
134
|
"sm": 6,
|
|
127
135
|
"md": 8,
|
|
@@ -274,6 +282,14 @@ export const nativeMetrics = {
|
|
|
274
282
|
"fast": 180,
|
|
275
283
|
"base": 260,
|
|
276
284
|
"slow": 320
|
|
285
|
+
},
|
|
286
|
+
"safeArea": {
|
|
287
|
+
"chromeGutter": 8,
|
|
288
|
+
"sheetContentGutter": 16,
|
|
289
|
+
"toastOffset": 60,
|
|
290
|
+
"fullscreenMin": 20,
|
|
291
|
+
"axisChromeTop": 56,
|
|
292
|
+
"axisChromeBottom": 88
|
|
277
293
|
}
|
|
278
294
|
};
|
|
279
295
|
export const sourceColors = {
|
|
@@ -120,6 +120,14 @@
|
|
|
120
120
|
"xxxl": 32,
|
|
121
121
|
"section": 48
|
|
122
122
|
},
|
|
123
|
+
"safeArea": {
|
|
124
|
+
"chromeGutter": 8,
|
|
125
|
+
"sheetContentGutter": 16,
|
|
126
|
+
"toastOffset": 60,
|
|
127
|
+
"fullscreenMin": 20,
|
|
128
|
+
"axisChromeTop": 56,
|
|
129
|
+
"axisChromeBottom": 88
|
|
130
|
+
},
|
|
123
131
|
"radius": {
|
|
124
132
|
"sm": 6,
|
|
125
133
|
"md": 8,
|
package/tokens/dist/tokens.css
CHANGED
|
@@ -24,6 +24,12 @@
|
|
|
24
24
|
--hig-space-xxl: 1.5rem;
|
|
25
25
|
--hig-space-xxxl: 2rem;
|
|
26
26
|
--hig-space-section: 3rem;
|
|
27
|
+
--hig-safe-area-chromeGutter: 0.5rem;
|
|
28
|
+
--hig-safe-area-sheetContentGutter: 1rem;
|
|
29
|
+
--hig-safe-area-toastOffset: 3.75rem;
|
|
30
|
+
--hig-safe-area-fullscreenMin: 1.25rem;
|
|
31
|
+
--hig-safe-area-axisChromeTop: 3.5rem;
|
|
32
|
+
--hig-safe-area-axisChromeBottom: 5.5rem;
|
|
27
33
|
--hig-font-sans: var(--font-bloxwap-sans, 'Bloxwap Sans'), system-ui, sans-serif;
|
|
28
34
|
--hig-font-mono: var(--font-bloxwap-mono, 'Bloxwap Mono'), ui-monospace, monospace;
|
|
29
35
|
--hig-radius-sm: 0.375rem;
|