@bloxwap/hig 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/chart/README.md +1 -1
- package/contracts/README.md +1 -1
- package/contracts/dist/login.d.ts +34 -0
- package/contracts/dist/login.js +43 -0
- package/contracts/dist/messages.d.ts +1 -1
- package/feedback/README.md +1 -1
- package/native/README.md +1 -1
- package/native/dist/animated-number.js +3 -1
- package/native/dist/blocks.d.ts +3 -1
- package/native/dist/blocks.js +3 -1
- package/native/dist/data.d.ts +1 -1
- package/native/dist/data.js +3 -1
- package/native/dist/deposit-block.d.ts +19 -0
- package/native/dist/deposit-block.js +17 -0
- package/native/dist/login-block.d.ts +4 -0
- package/native/dist/login-block.js +22 -0
- package/native/dist/{swap-panel-block.d.ts → swap-block.d.ts} +10 -6
- package/native/dist/{swap-panel-block.js → swap-block.js} +5 -3
- package/native/dist/swap-sheet.d.ts +3 -3
- package/native/dist/swap-sheet.js +3 -3
- package/native/dist/token-action-block.d.ts +1 -1
- package/native/dist/token-action-block.js +2 -1
- package/native-fonts/README.md +1 -1
- package/og-fonts/README.md +1 -1
- package/package.json +45 -10
- package/react/README.md +1 -1
- package/react/dist/blocks/deposit-block.d.ts +19 -0
- package/react/dist/blocks/deposit-block.js +15 -0
- package/react/dist/blocks/login-block.d.ts +4 -0
- package/react/dist/blocks/login-block.js +14 -0
- package/react/dist/blocks/{swap-panel-block.d.ts → swap-block.d.ts} +10 -6
- package/react/dist/blocks/{swap-panel-block.js → swap-block.js} +5 -3
- package/react/dist/blocks/swap-sheet.d.ts +3 -3
- package/react/dist/blocks/swap-sheet.js +3 -3
- package/react/dist/blocks/token-action-block.d.ts +1 -1
- package/react/dist/blocks/token-action-block.js +2 -1
- package/react/dist/blocks.d.ts +3 -1
- package/react/dist/blocks.js +3 -1
- package/react/dist/overlay.d.ts +1 -29
- package/react/dist/overlay.js +3 -31
- package/react/dist/popover.d.ts +30 -0
- package/react/dist/popover.js +34 -0
- package/react/dist/styles.css +22 -2
- package/tokens/README.md +1 -1
- package/tokens/assets/onramps/apple-pay.svg +33 -0
- package/tokens/assets/onramps/bank.svg +98 -0
- package/tokens/assets/onramps/blink.svg +37 -0
- package/tokens/assets/onramps/cashapp.svg +33 -0
- package/tokens/assets/onramps/crypto.svg +121 -0
- package/tokens/assets/onramps/exchange.svg +105 -0
- package/tokens/dist/deposit-icons.d.ts +1 -0
- package/tokens/dist/deposit-icons.js +28 -0
package/chart/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/chart
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.9.0, an entry of `@bloxwap/hig`. `AltimeterChart` is the Bloxwap live chart on its
|
|
4
4
|
own: a plus grid and price trail that flow left at 50px per second, a price ladder centered on the current price,
|
|
5
5
|
and the current price at the trail's tip. Pass `price` or a `feed`; with neither it shows live Bitcoin through
|
|
6
6
|
`bitcoinPrice`. Optional `targets` (`AltimeterTarget`: `{id, price, label?, color?}`) add full-width horizontal dotted lines
|
package/contracts/README.md
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Provider ids and artwork match the Bloxwap app login drawer. */
|
|
2
|
+
export declare const loginProviders: readonly ['twitter', 'apple', 'google'];
|
|
3
|
+
export type LoginProvider = typeof loginProviders[number];
|
|
4
|
+
export declare const loginArtwork: Record<LoginProvider, readonly {
|
|
5
|
+
d: string;
|
|
6
|
+
fill: string | null;
|
|
7
|
+
}[]>;
|
|
8
|
+
export declare const loginCopy: {
|
|
9
|
+
title: string;
|
|
10
|
+
close: string;
|
|
11
|
+
lastUsed: string;
|
|
12
|
+
twitter: string;
|
|
13
|
+
apple: string;
|
|
14
|
+
google: string;
|
|
15
|
+
analytics: string;
|
|
16
|
+
analyticsInfo: string;
|
|
17
|
+
description: string;
|
|
18
|
+
terms: string;
|
|
19
|
+
privacy: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const loginTermsUrl = "https://bloxwap.com/docs/terms";
|
|
22
|
+
export declare const loginPrivacyUrl = "https://bloxwap.com/docs/privacy";
|
|
23
|
+
export interface LoginBlockProps {
|
|
24
|
+
onLogin: (provider: LoginProvider) => void;
|
|
25
|
+
onClose: () => void;
|
|
26
|
+
lastUsed?: LoginProvider | null;
|
|
27
|
+
/** Disable provider rows while the host starts authentication. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
analyticsEnabled: boolean;
|
|
30
|
+
onAnalyticsChange: (enabled: boolean) => void;
|
|
31
|
+
labels?: Partial<typeof loginCopy>;
|
|
32
|
+
termsUrl?: string;
|
|
33
|
+
privacyUrl?: string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** Provider ids and artwork match the Bloxwap app login drawer. */
|
|
2
|
+
export const loginProviders = ['twitter', 'apple', 'google'];
|
|
3
|
+
export const loginArtwork = {
|
|
4
|
+
"twitter": [
|
|
5
|
+
{
|
|
6
|
+
"d": "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z",
|
|
7
|
+
"fill": null
|
|
8
|
+
}
|
|
9
|
+
],
|
|
10
|
+
"apple": [
|
|
11
|
+
{
|
|
12
|
+
"d": "M16.365 1.43c0 1.14-.427 2.2-1.28 3.18-1.03 1.17-2.276 1.85-3.44 1.75a3.9 3.9 0 0 1-.03-.44c0-1.1.472-2.26 1.31-3.21.42-.48.95-.88 1.6-1.2.64-.31 1.25-.48 1.82-.51.01.14.02.28.02.43zm4.377 16.44c-.35.81-.77 1.55-1.25 2.24-.66.94-1.2 1.59-1.62 1.95-.65.6-1.34.9-2.08.92-.53 0-1.17-.15-1.92-.46-.75-.3-1.44-.45-2.06-.45-.66 0-1.37.15-2.13.45-.76.31-1.37.47-1.84.48-.71.03-1.42-.28-2.12-.93-.45-.39-1.02-1.06-1.7-2.02-.73-1.02-1.33-2.21-1.8-3.56-.5-1.46-.76-2.87-.76-4.24 0-1.57.34-2.92 1.02-4.06a5.98 5.98 0 0 1 2.14-2.16 5.75 5.75 0 0 1 2.89-.82c.56 0 1.3.17 2.22.52.91.35 1.5.53 1.75.53.19 0 .84-.21 1.94-.62 1.04-.38 1.92-.54 2.64-.48 1.95.16 3.42.93 4.4 2.32-1.75 1.06-2.61 2.54-2.59 4.44.01 1.48.55 2.71 1.61 3.69.48.46 1.02.81 1.62 1.06-.13.38-.27.74-.42 1.09z",
|
|
13
|
+
"fill": null
|
|
14
|
+
}
|
|
15
|
+
],
|
|
16
|
+
"google": [
|
|
17
|
+
{
|
|
18
|
+
"d": "M23.49 12.27c0-.79-.07-1.54-.19-2.27H12v4.51h6.47a5.57 5.57 0 0 1-2.4 3.58v3h3.86c2.26-2.09 3.56-5.17 3.56-8.82z",
|
|
19
|
+
"fill": "#4285F4"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"d": "M12 24c3.24 0 5.95-1.08 7.93-2.91l-3.86-3c-1.08.72-2.45 1.16-4.07 1.16-3.13 0-5.78-2.11-6.73-4.96H1.29v3.09A11.99 11.99 0 0 0 12 24z",
|
|
23
|
+
"fill": "#34A853"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"d": "M5.27 14.29A7.19 7.19 0 0 1 4.89 12c0-.8.14-1.57.38-2.29V6.62H1.29a11.99 11.99 0 0 0 0 10.76z",
|
|
27
|
+
"fill": "#FBBC05"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"d": "M12 4.75c1.77 0 3.35.61 4.6 1.8l3.42-3.42C17.95 1.19 15.24 0 12 0A11.99 11.99 0 0 0 1.29 6.62l3.98 3.09C6.22 6.86 8.87 4.75 12 4.75z",
|
|
31
|
+
"fill": "#EA4335"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
};
|
|
35
|
+
export const loginCopy = {
|
|
36
|
+
title: 'Log in', close: 'Close', lastUsed: 'Last used',
|
|
37
|
+
twitter: 'Continue with X', apple: 'Continue with Apple', google: 'Continue with Google',
|
|
38
|
+
analytics: 'Product analytics', analyticsInfo: 'About product analytics',
|
|
39
|
+
description: 'Share optional analytics to help us understand onboarding. We exclude wallet details and form inputs.',
|
|
40
|
+
terms: 'Terms of Use', privacy: 'Privacy Policy',
|
|
41
|
+
};
|
|
42
|
+
export const loginTermsUrl = 'https://bloxwap.com/docs/terms';
|
|
43
|
+
export const loginPrivacyUrl = 'https://bloxwap.com/docs/privacy';
|
|
@@ -178,7 +178,7 @@ export interface HIGMessages {
|
|
|
178
178
|
swapRecipient: string;
|
|
179
179
|
/** Accessible name of the recipient QR scan button. */
|
|
180
180
|
swapScan: string;
|
|
181
|
-
/** Accessible name of a wallet address that copies on press (WalletAddress, the
|
|
181
|
+
/** Accessible name of a wallet address that copies on press (WalletAddress, the SwapBlock receive view); the address follows it. */
|
|
182
182
|
copyAddress: string;
|
|
183
183
|
/** Notice after a wallet address is copied. */
|
|
184
184
|
addressCopied: string;
|
package/feedback/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/feedback
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.9.0, an entry of `@bloxwap/hig`. Root contract imports no React, DOM, RN, audio or device API. Use independent web/native entries and opt in to each channel. Successful API invocation never certifies physical output. See docs/feedback for timing, storage, capability and device verification.
|
|
4
4
|
|
|
5
5
|
`createWebSoundAdapter` passes a per-adapter abort signal to SFX. The signal-aware engine cancels that root's active voices while other roots and host-owned playback continue. The shared default engine remains reference-counted.
|
|
6
6
|
|
package/native/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/native
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.9.0, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
|
|
4
4
|
|
|
5
5
|
UI symbols come from `@bloxwap/icons` (install `@bloxwap/icons@^0.1.0`). Native symbols also require the `expo-image` version for your Expo SDK.
|
|
6
6
|
Use `npx expo install expo-image`, then rebuild a development client so the native
|
|
@@ -10,7 +10,7 @@ import { tokens } from '@bloxwap/hig/tokens';
|
|
|
10
10
|
import { createNumberFlowRoll, createNumberReelModel, formatNumberReadout, numberFlowReelOffset, numberReelPlace, numberReelPlaces, numberTrendDirection, safeNumberLayout, sampleReelEasing } from './animated-number-model.js';
|
|
11
11
|
import { useColors, useHIG, useNumberLocale } from './provider.js';
|
|
12
12
|
import { detectScript, Text } from './surface.js';
|
|
13
|
-
const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign']);
|
|
13
|
+
const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign', 'textDecorationLine', 'textDecorationColor', 'textDecorationStyle']);
|
|
14
14
|
// Android Fabric reads colour 0 as "unset", so 'transparent' (0x00000000) drew the hidden reading in the default
|
|
15
15
|
// black under the reels. Clear white is non-zero there and still invisible.
|
|
16
16
|
const hiddenColor = '#ffffff00';
|
|
@@ -181,6 +181,8 @@ export function AnimatedNumberReadout({ value, options: requested, formattedValu
|
|
|
181
181
|
const previousValue = useRef(value), directionTrend = numberTrendDirection(trend, previousValue.current, value);
|
|
182
182
|
useEffect(() => { previousValue.current = value; }, [value]);
|
|
183
183
|
const typography = Object.fromEntries(Object.entries(StyleSheet.flatten(style) ?? {}).filter(([key]) => numberTypographyKeys.has(key)));
|
|
184
|
+
if (typography.fontSize !== undefined && typography.lineHeight === undefined)
|
|
185
|
+
typography.lineHeight = undefined;
|
|
184
186
|
const color = colors[tone === 'positive' || tone === 'negative' || tone === 'warning' || tone === 'muted' || tone === 'faint' || tone === 'up' || tone === 'down' ? tone : 'text'];
|
|
185
187
|
const textStyle = [typography, { color, fontVariant: ['tabular-nums'] }];
|
|
186
188
|
const script = detectScript(`${reading.text}${staleSuffix}`, locale);
|
package/native/dist/blocks.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ export declare function MarketingHero({ title, description, href, cta }: {
|
|
|
21
21
|
cta: string;
|
|
22
22
|
}): React.JSX.Element;
|
|
23
23
|
export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow, type AccountBlockProps, type AccountAsset, type AccountSection, type AccountOrder, type AccountRowsOptions, type AssetArtwork, type AssetBalanceRowProps } from './account-block.js';
|
|
24
|
+
export { LoginBlock, type LoginBlockProps, type LoginProvider } from './login-block.js';
|
|
25
|
+
export { DepositBlock, type DepositBlockProps, type DepositMethod } from './deposit-block.js';
|
|
24
26
|
export { LanguageBlock, filterLanguages, type LanguageBlockProps, type LanguageOption } from './language-block.js';
|
|
25
27
|
export { TokenActionBlock, tokenActionLabel, type TokenActionBlockProps, type TokenAction, type TokenActionId } from './token-action-block.js';
|
|
26
28
|
export { ManagePositionBlock, positionCorridor, type ManagePositionBlockProps, type ManagePositionBlockLabels, type ManagePositionBlockAction, type ManagePositionBlockSummary, type ManagePositionBlockFigure, type ManagePositionIcon } from './manage-position-block.js';
|
|
@@ -37,7 +39,7 @@ export { NotificationsBlock, type NotificationsBlockProps, type NotificationsIte
|
|
|
37
39
|
export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, type FromPickerBlockProps, type ToPickerBlockProps, type FromPickerProps, type ToPickerProps, type PickerListProps, type PickerInputProps, type PickerRowProps, SwapHostContext } from './pickers.js';
|
|
38
40
|
export { SwapKeypad, SwapCapsule } from './swap-parts.js';
|
|
39
41
|
export { SwapAmountCard, SwapPill, type SwapAmountCardProps, type SwapPillProps } from './swap-amount-card.js';
|
|
40
|
-
export { SwapPanelBlock, SwapPanel, swapAction, type SwapPanelBlockProps, type SwapPanelProps, type SwapToken, type SwapArtwork, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapFigure, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-
|
|
42
|
+
export { SwapBlock, SwapPanelBlock, SwapPanel, swapAction, type SwapBlockProps, type SwapPanelBlockProps, type SwapPanelProps, type SwapToken, type SwapArtwork, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapFigure, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-block.js';
|
|
41
43
|
export { ConfirmBlock, type ConfirmBlockProps, type ConfirmDetail, type ConfirmTertiaryAction } from './confirm-block.js';
|
|
42
44
|
export { PresetPickerBlock, type PresetPickerBlockProps, type PresetPickerCustom, type PresetPickerAdjustable } from './preset-picker-block.js';
|
|
43
45
|
export { ExplainerBlock, type ExplainerBlockProps, type ExplainerSection, type ExplainerAction, type ExplainerTone } from './explainer-block.js';
|
package/native/dist/blocks.js
CHANGED
|
@@ -25,6 +25,8 @@ export function InstallCommand({ command, onCopy }) {
|
|
|
25
25
|
}
|
|
26
26
|
export function MarketingHero({ title, description, href, cta }) { return _jsxs(Stack, { children: [_jsx(Heading, { children: title }), _jsx(Text, { children: description }), _jsx(Link, { href: href, children: cta })] }); }
|
|
27
27
|
export { AccountBlock, accountRows, accountSectionRows, accountSectionTotal, assetValue, AssetBalanceRow } from './account-block.js';
|
|
28
|
+
export { LoginBlock } from './login-block.js';
|
|
29
|
+
export { DepositBlock } from './deposit-block.js';
|
|
28
30
|
export { LanguageBlock, filterLanguages } from './language-block.js';
|
|
29
31
|
export { TokenActionBlock, tokenActionLabel } from './token-action-block.js';
|
|
30
32
|
export { ManagePositionBlock, positionCorridor } from './manage-position-block.js';
|
|
@@ -41,7 +43,7 @@ export { NotificationsBlock } from './notifications-block.js';
|
|
|
41
43
|
export { FromPickerBlock, ToPickerBlock, FromPicker, ToPicker, SwapHostContext } from './pickers.js';
|
|
42
44
|
export { SwapKeypad, SwapCapsule } from './swap-parts.js';
|
|
43
45
|
export { SwapAmountCard, SwapPill } from './swap-amount-card.js';
|
|
44
|
-
export { SwapPanelBlock, SwapPanel, swapAction } from './swap-
|
|
46
|
+
export { SwapBlock, SwapPanelBlock, SwapPanel, swapAction } from './swap-block.js';
|
|
45
47
|
export { ConfirmBlock } from './confirm-block.js';
|
|
46
48
|
export { PresetPickerBlock } from './preset-picker-block.js';
|
|
47
49
|
export { ExplainerBlock } from './explainer-block.js';
|
package/native/dist/data.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type StyleProp, type TextStyle } from 'react-native';
|
|
|
3
3
|
/** `up`/`down` are market direction (rising/long/gain, falling/short/loss) and follow `HIGProvider marketColors`; `positive`/`negative` stay success/error. */
|
|
4
4
|
export type NumberTone = 'text' | 'positive' | 'negative' | 'warning' | 'muted' | 'faint' | 'up' | 'down';
|
|
5
5
|
/** Typography only: semantic tone owns colour and numeric glyphs remain tabular. */
|
|
6
|
-
export type NumberReadoutStyle = Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'textAlign'>;
|
|
6
|
+
export type NumberReadoutStyle = Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'textAlign' | 'textDecorationLine' | 'textDecorationColor' | 'textDecorationStyle'>;
|
|
7
7
|
export interface NumberProps {
|
|
8
8
|
value: number | null | undefined;
|
|
9
9
|
options?: Intl.NumberFormatOptions; /** Host-owned display text for a finite value. Empty text falls back to locale formatting; never parse this text for submission. */
|
package/native/dist/data.js
CHANGED
|
@@ -8,7 +8,7 @@ import * as en from '@bloxwap/hig/contracts/messages';
|
|
|
8
8
|
import { useColors, useHIG, useNumberLocale } from './provider.js';
|
|
9
9
|
import { Text, Surface, Separator } from './surface.js';
|
|
10
10
|
import { Button } from './button.js';
|
|
11
|
-
const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign']);
|
|
11
|
+
const numberTypographyKeys = new Set(['fontFamily', 'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textAlign', 'textDecorationLine', 'textDecorationColor', 'textDecorationStyle']);
|
|
12
12
|
export function NumberReadout({ value, options, formattedValue, stale, label, tone = 'text', style, testID, maxFontSizeMultiplier, prefix, suffix }) {
|
|
13
13
|
const { messages, numberFormat } = useHIG();
|
|
14
14
|
const locale = useNumberLocale();
|
|
@@ -17,6 +17,8 @@ export function NumberReadout({ value, options, formattedValue, stale, label, to
|
|
|
17
17
|
const staleSuffix = stale ? ` ${messages.stale ?? en.stale}` : '';
|
|
18
18
|
// Keep the same boundary for untyped hosts and registered/array styles: no raw colour, glyph or layout overrides.
|
|
19
19
|
const typography = Object.fromEntries(Object.entries(StyleSheet.flatten(style) ?? {}).filter(([key]) => numberTypographyKeys.has(key)));
|
|
20
|
+
if (typography.fontSize !== undefined && typography.lineHeight === undefined)
|
|
21
|
+
typography.lineHeight = undefined;
|
|
20
22
|
const color = colors[tone === 'positive' || tone === 'negative' || tone === 'warning' || tone === 'muted' || tone === 'faint' || tone === 'up' || tone === 'down' ? tone : 'text'];
|
|
21
23
|
return _jsxs(Text, { accessibilityLabel: label ? `${label}: ${reading}${staleSuffix}` : undefined, testID: testID, maxFontSizeMultiplier: maxFontSizeMultiplier, style: [typography, { color, fontVariant: ['tabular-nums'] }], children: [reading, staleSuffix] });
|
|
22
24
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DepositMethod {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
/** Optional artwork for a custom method or a replacement for its built-in icon. */
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DepositBlockProps {
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
methods: readonly DepositMethod[];
|
|
14
|
+
onSelect: (method: DepositMethod) => void;
|
|
15
|
+
onBack?: () => void;
|
|
16
|
+
headerAction?: React.ReactNode;
|
|
17
|
+
headingId?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function DepositBlock({ title, description, methods, onSelect, onBack, headerAction, headingId }: DepositBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { depositIcon } from '@bloxwap/hig/tokens/deposit-icons';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import { SvgXml } from 'react-native-svg';
|
|
5
|
+
import { useColors, useMessages } from './provider.js';
|
|
6
|
+
import { Text } from './surface.js';
|
|
7
|
+
import { ListGroup, ListRow } from './list-group.js';
|
|
8
|
+
import { ScreenHeader } from './screen-header.js';
|
|
9
|
+
export function DepositBlock({ title, description, methods, onSelect, onBack, headerAction, headingId }) {
|
|
10
|
+
const messages = useMessages();
|
|
11
|
+
const colors = useColors();
|
|
12
|
+
return _jsxs(View, { style: { gap: 12 }, children: [_jsx(ScreenHeader, { title: title ?? messages.deposit, onBack: onBack, action: headerAction, headingId: headingId }), description && _jsx(Text, { style: { color: colors.muted, fontSize: 14, textAlign: 'center' }, children: description }), _jsx(ListGroup, { children: methods.map(method => {
|
|
13
|
+
const svg = depositIcon(method.id);
|
|
14
|
+
const leading = method.icon ?? (svg && _jsx(SvgXml, { xml: svg, width: 44, height: 44 }));
|
|
15
|
+
return _jsx(ListRow, { leading: leading, label: method.label, description: method.description, disabled: method.disabled, onSelect: () => onSelect(method) }, method.id);
|
|
16
|
+
}) })] });
|
|
17
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type LoginBlockProps } from '@bloxwap/hig/contracts/login';
|
|
3
|
+
export type { LoginBlockProps, LoginProvider } from '@bloxwap/hig/contracts/login';
|
|
4
|
+
export declare function LoginBlock({ onLogin, onClose, lastUsed, disabled, analyticsEnabled, onAnalyticsChange, labels, termsUrl, privacyUrl }: LoginBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { View } from 'react-native';
|
|
4
|
+
import Svg, { Path } from 'react-native-svg';
|
|
5
|
+
import { HeaderClose, ScreenHeader } from './screen-header.js';
|
|
6
|
+
import { Switch } from './switch.js';
|
|
7
|
+
import { Dialog } from './overlay.js';
|
|
8
|
+
import { SeverityIcon } from './icons.js';
|
|
9
|
+
import { ListRow } from './list-group.js';
|
|
10
|
+
import { Badge } from './status.js';
|
|
11
|
+
import { Text } from './surface.js';
|
|
12
|
+
import { Button, Link } from './button.js';
|
|
13
|
+
import { useColors } from './provider.js';
|
|
14
|
+
import { loginProviders, loginArtwork, loginCopy, loginTermsUrl, loginPrivacyUrl } from '@bloxwap/hig/contracts/login';
|
|
15
|
+
export function LoginBlock({ onLogin, onClose, lastUsed, disabled, analyticsEnabled, onAnalyticsChange, labels, termsUrl = loginTermsUrl, privacyUrl = loginPrivacyUrl }) {
|
|
16
|
+
const copy = { ...loginCopy, ...labels };
|
|
17
|
+
const colors = useColors();
|
|
18
|
+
const [infoOpen, setInfoOpen] = React.useState(false);
|
|
19
|
+
const infoTrigger = React.useRef(null);
|
|
20
|
+
const linkStyle = { color: colors.muted, textDecorationLine: 'underline' };
|
|
21
|
+
return _jsxs(View, { style: { gap: 16 }, children: [_jsx(ScreenHeader, { title: copy.title, action: _jsx(HeaderClose, { label: copy.close, onClose: onClose }) }), _jsx(View, { style: { gap: 8 }, children: loginProviders.map(provider => _jsx(View, { style: { borderRadius: 16, overflow: 'hidden' }, children: _jsx(ListRow, { label: copy[provider], disabled: disabled, disclosure: "none", onSelect: () => onLogin(provider), leading: _jsx(Svg, { width: 20, height: 20, viewBox: "0 0 24 24", children: loginArtwork[provider].map(path => _jsx(Path, { d: path.d, fill: path.fill ?? colors.text }, path.d)) }), accessibilityLabel: lastUsed === provider ? `${copy[provider]}, ${copy.lastUsed}` : copy[provider], trailing: lastUsed === provider ? _jsx(Badge, { tone: "positive", children: copy.lastUsed }) : undefined }) }, provider)) }), _jsxs(View, { style: { flexDirection: 'row', alignItems: 'center' }, children: [_jsx(Text, { style: { flexShrink: 1 }, children: copy.analytics }), _jsx(Button, { ref: infoTrigger, intent: "ghost", contentMode: "custom", accessibilityLabel: copy.analyticsInfo, style: { width: 44, paddingHorizontal: 0 }, onPress: () => setInfoOpen(true), children: _jsx(SeverityIcon, { kind: "info", color: colors.muted }) }), _jsx(View, { style: { marginStart: 'auto' }, children: _jsx(Switch, { hideLabel: true, label: copy.analytics, checked: analyticsEnabled, onCheckedChange: onAnalyticsChange }) })] }), _jsx(Dialog, { open: infoOpen, onOpenChange: setInfoOpen, title: copy.analyticsInfo, closeLabel: copy.close, returnFocusRef: infoTrigger, children: _jsx(Text, { children: copy.description }) }), _jsxs(View, { style: { flexDirection: 'row', justifyContent: 'center', flexWrap: 'wrap', gap: 16 }, children: [_jsx(Link, { href: termsUrl, contentMode: "custom", children: _jsx(Text, { style: linkStyle, children: copy.terms }) }), _jsx(Link, { href: privacyUrl, contentMode: "custom", children: _jsx(Text, { style: linkStyle, children: copy.privacy }) })] })] });
|
|
22
|
+
}
|
|
@@ -36,7 +36,7 @@ export interface SwapReceive {
|
|
|
36
36
|
qr?: React.ReactNode; /** Host clipboard adapter. When set, the whole view copies the address. */
|
|
37
37
|
onCopy?: () => Promise<void> | void;
|
|
38
38
|
}
|
|
39
|
-
export interface
|
|
39
|
+
export interface SwapBlockProps {
|
|
40
40
|
/** Catalog for the To side, and for the From side unless `fromTokens` is given. */
|
|
41
41
|
tokens: readonly SwapToken[];
|
|
42
42
|
/** Assets offered on the From side, typically the connected wallet's holdings. */
|
|
@@ -144,8 +144,12 @@ export interface SwapPanelBlockProps {
|
|
|
144
144
|
* or token units through the keypad, token pickers, settings, and one action that names itself from the chosen pair.
|
|
145
145
|
* Presentation only. The host owns tokens, balances, prices, the quote, the wallet and the transaction.
|
|
146
146
|
*/
|
|
147
|
-
export declare function
|
|
148
|
-
/** @deprecated Renamed `
|
|
149
|
-
export declare const SwapPanel: typeof
|
|
150
|
-
/** @deprecated Renamed `
|
|
151
|
-
export type SwapPanelProps =
|
|
147
|
+
export declare function SwapBlock({ tokens, fromTokens, fromTokensLoading, chains, hotTokenIds, from: fromProp, to: toProp, defaultFrom, defaultTo, onFromChange, onToChange, amount, onAmountChange, received, fee, fees, quoteLoading, slippage, onSlippageChange, denomination, onDenominationChange, wallet, onConnect, onDisconnect, recipient, onRecipientChange, onScanRecipient, receive, receiving, onReceivingChange, onSubmit, submitting, submittingLabel, onReset, keypad, destination, details, note, noteTone, title, onBack, headingId, controls, actionIcon, lockFrom, lockTo, actionLabel, actionDisabled, actionStatus, actionIntent, limitToBalance, banner, footer, oneWay: oneWayProp, denominationSwitch, settings, view: viewProp, onViewChange, style }: SwapBlockProps): React.JSX.Element;
|
|
148
|
+
/** @deprecated Renamed `SwapBlock`. The old name keeps working until the next major release. */
|
|
149
|
+
export declare const SwapPanel: typeof SwapBlock;
|
|
150
|
+
/** @deprecated Renamed `SwapBlockProps`. */
|
|
151
|
+
export type SwapPanelProps = SwapBlockProps;
|
|
152
|
+
/** @deprecated Use SwapBlock. */
|
|
153
|
+
export declare const SwapPanelBlock: typeof SwapBlock;
|
|
154
|
+
/** @deprecated Use SwapBlockProps. */
|
|
155
|
+
export type SwapPanelBlockProps = SwapBlockProps;
|
|
@@ -25,7 +25,7 @@ export { SwapAmountCard, SwapPill } from './swap-amount-card.js';
|
|
|
25
25
|
* or token units through the keypad, token pickers, settings, and one action that names itself from the chosen pair.
|
|
26
26
|
* Presentation only. The host owns tokens, balances, prices, the quote, the wallet and the transaction.
|
|
27
27
|
*/
|
|
28
|
-
export function
|
|
28
|
+
export function SwapBlock({ tokens, fromTokens, fromTokensLoading, chains, hotTokenIds, from: fromProp, to: toProp, defaultFrom = null, defaultTo = null, onFromChange, onToChange, amount, onAmountChange, received, fee, fees, quoteLoading, slippage = 0.005, onSlippageChange, denomination, onDenominationChange, wallet, onConnect, onDisconnect, recipient, onRecipientChange, onScanRecipient, receive, receiving, onReceivingChange, onSubmit, submitting = false, submittingLabel, onReset, keypad = 'auto', destination, details, note, noteTone = 'muted', title, onBack, headingId, controls = true, actionIcon, lockFrom = false, lockTo = false, actionLabel, actionDisabled = false, actionStatus, actionIntent = 'primary', limitToBalance = false, banner, footer, oneWay: oneWayProp = false, denominationSwitch = true, settings, view: viewProp, onViewChange, style }) {
|
|
29
29
|
const env = useHIG();
|
|
30
30
|
const { direction } = env;
|
|
31
31
|
const locale = useNumberLocale();
|
|
@@ -212,5 +212,7 @@ function SwapStage({ view, animateHeight, children }) {
|
|
|
212
212
|
const fitted = sizing && sized;
|
|
213
213
|
return _jsx(Animated.View, { testID: 'swap-stage', style: fitted ? { height, overflow: 'hidden' } : undefined, children: _jsx(Animated.View, { onLayout: onLayout, style: [fitted ? { position: 'absolute', left: 0, right: 0, top: 0 } : null, { opacity: slide, transform: [{ translateX: slide.interpolate({ inputRange: [0, 1], outputRange: [travel.current * 48, 0] }) }] }], children: children }) });
|
|
214
214
|
}
|
|
215
|
-
/** @deprecated Renamed `
|
|
216
|
-
export const SwapPanel =
|
|
215
|
+
/** @deprecated Renamed `SwapBlock`. The old name keeps working until the next major release. */
|
|
216
|
+
export const SwapPanel = SwapBlock;
|
|
217
|
+
/** @deprecated Use SwapBlock. */
|
|
218
|
+
export const SwapPanelBlock = SwapBlock;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { type
|
|
3
|
-
export interface SwapSheetProps extends
|
|
2
|
+
import { type SwapBlockProps } from './swap-block.js';
|
|
3
|
+
export interface SwapSheetProps extends SwapBlockProps {
|
|
4
4
|
open: boolean;
|
|
5
5
|
onOpenChange: (open: boolean) => void;
|
|
6
6
|
/** Accessible name of the sheet. */
|
|
7
7
|
title: string;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* SwapBlock presented in the gesture sheet. Pickers and settings push inside the same sheet, which resizes to the view
|
|
11
11
|
* on show. A back press or a dismiss gesture pops a pushed view first and closes the sheet only from the main form;
|
|
12
12
|
* closing always returns to the main form. Needs the optional gesture-sheet backend, which `blocks` does not load.
|
|
13
13
|
*/
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { BottomSheetFlatList } from '@gorhom/bottom-sheet';
|
|
4
4
|
import { GestureSheet } from './gesture-sheet.js';
|
|
5
|
-
import { SwapHostContext,
|
|
5
|
+
import { SwapHostContext, SwapBlock, swapParentView } from './swap-block.js';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* SwapBlock presented in the gesture sheet. Pickers and settings push inside the same sheet, which resizes to the view
|
|
8
8
|
* on show. A back press or a dismiss gesture pops a pushed view first and closes the sheet only from the main form;
|
|
9
9
|
* closing always returns to the main form. Needs the optional gesture-sheet backend, which `blocks` does not load.
|
|
10
10
|
*/
|
|
@@ -22,5 +22,5 @@ export function SwapSheet({ open, onOpenChange, title, view: viewProp, onViewCha
|
|
|
22
22
|
return false; show(swapParentView(view)); return true; };
|
|
23
23
|
return _jsx(GestureSheet, { open: open, onOpenChange: next => { if (!next && leave())
|
|
24
24
|
return; onOpenChange(next); }, title: title, contentMode: 'custom', enableDynamicSizing: true, keyboardBehavior: 'interactive', onHardwareBackPress: () => { if (!leave())
|
|
25
|
-
onOpenChange(false); return true; }, children: _jsx(SwapHostContext.Provider, { value: host, children: _jsx(
|
|
25
|
+
onOpenChange(false); return true; }, children: _jsx(SwapHostContext.Provider, { value: host, children: _jsx(SwapBlock, { ...panel, view: view, onViewChange: show, style: [{ paddingHorizontal: 12, paddingBottom: 16 }, style] }) }) });
|
|
26
26
|
}
|
|
@@ -38,7 +38,7 @@ export interface TokenActionBlockProps {
|
|
|
38
38
|
onBack?: () => void;
|
|
39
39
|
/** A control on the trailing edge of the header, usually an IconButton. */
|
|
40
40
|
headerAction?: React.ReactNode;
|
|
41
|
-
/** A line under the actions, for example why some are missing. `noteTone` tints it as in
|
|
41
|
+
/** A line under the actions, for example why some are missing. `noteTone` tints it as in SwapBlock. */
|
|
42
42
|
note?: React.ReactNode;
|
|
43
43
|
noteTone?: 'muted' | 'warning' | 'negative';
|
|
44
44
|
/** Keeps the header pinned while the rest scrolls: the block becomes its own scroll view with the header as its sticky first child, transparent at rest and filled once content scrolls under it. Place it in a bounded container, such as a sheet body. */
|
|
@@ -23,10 +23,11 @@ export function TokenActionBlock({ symbol, name, value, units, unitsSuffix, unit
|
|
|
23
23
|
const colors = useColors(), t = useMessages(), { direction } = useHIG(), locale = useNumberLocale();
|
|
24
24
|
const total = value !== undefined ? value : (assets ?? []).reduce((sum, asset) => sum + (held(asset.value) ? asset.value : 0), 0);
|
|
25
25
|
// With no dollar value the units are the headline, as an AccountBlock row headlines them.
|
|
26
|
+
const showChains = chains !== undefined && chains.length > 1;
|
|
26
27
|
const headline = units !== undefined && value == null ? _jsx(AnimatedNumberReadout, { value: units, options: unitsOptions, suffix: unitsSuffix, tone: 'muted', testID: 'token-units', style: { fontSize: 14, lineHeight: 21 } }, 'units') : _jsx(AnimatedNumberReadout, { value: total, options: usd, tone: 'muted', testID: 'token-value', style: { fontSize: 14, lineHeight: 21 } }, 'value');
|
|
27
28
|
const tone = noteTone === 'warning' ? colors.warning : noteTone === 'negative' ? colors.negative : null;
|
|
28
29
|
const header = _jsxs(View, { testID: 'token-header', style: { flexDirection: 'row', alignItems: 'center', minHeight: 44 }, children: [_jsx(View, { style: { minWidth: 44, alignItems: 'flex-start' }, children: onBack ? _jsx(IconButton, { intent: 'ghost', label: t.back, suppressFeedback: true, testID: 'token-back', onPress: onBack, children: _jsx(View, { style: { transform: [{ rotate: direction === 'rtl' ? '-90deg' : '90deg' }] }, children: _jsx(ChevronIcon, { color: colors.text }) }) }) : null }), _jsx(Text, { testID: 'token-title', nativeID: headingId, accessibilityRole: 'header', numberOfLines: 1, style: { flex: 1, textAlign: 'center', fontSize: 17, lineHeight: 24, fontWeight: '600', color: colors.text }, children: symbol }), _jsx(View, { style: { minWidth: 44, alignItems: 'flex-end' }, children: headerAction })] });
|
|
29
|
-
const body = _jsxs(_Fragment, { children: [assets ||
|
|
30
|
+
const body = _jsxs(_Fragment, { children: [assets || showChains ? _jsx(BarMarkFigureContext.Provider, { value: animatedFigure, children: _jsxs(View, { testID: 'token-bars', style: { gap: 20, marginTop: 16, paddingHorizontal: 4 }, children: [assets ? _jsx(BarMark, { testID: 'token-assets', surface: false, title: name ?? symbol, elements: assets, description: headline }) : null, showChains ? _jsx(BarMark, { testID: 'token-chains', surface: false, title: chainsTitle ?? t.swapChains, elements: chains, description: formatNumber(chains.filter(chain => held(chain.value)).length, locale) }) : null] }) }) : null, actions.length > 0 ? _jsx(View, { testID: 'token-actions', style: { gap: 8, marginTop: 16 }, children: actions.map(action => _jsx(Button, { testID: `token-action-${action.id}`, fullWidth: true, intent: action.intent ?? 'secondary', disabled: action.disabled, onPress: action.onSelect, children: tokenActionLabel(action, t) }, action.id)) }) : null, note != null && note !== false ? _jsx(View, { testID: 'token-note', style: [{ marginTop: actions.length > 0 ? 8 : 16 }, tone ? { paddingVertical: 12, paddingHorizontal: 16, borderRadius: 16, backgroundColor: withAlpha(tone, 0.1) } : { paddingHorizontal: 4 }], children: _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: tone ?? colors.muted }, children: note }) }) : null] });
|
|
30
31
|
if (stickyHeader)
|
|
31
32
|
return _jsx(StickyHeaderLayout, { testID: testID, headerTestID: 'token-sticky-header', header: header, background: stickyHeaderBackground, scrollComponent: scrollComponent, children: body });
|
|
32
33
|
return _jsxs(View, { testID: testID, style: { padding: 16 }, children: [header, body] });
|
package/native-fonts/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/native-fonts
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.9.0, an entry of `@bloxwap/hig`. Static Bloxwap Sans/Mono (and Korean/Simplified Chinese Sans) TTF faces for React Native and Expo hosts, derived reproducibly from pinned `@bloxwap/font` 0.1.4 by `npm run generate:fonts`.
|
|
4
4
|
|
|
5
5
|
Web hosts never import this entry: load fonts through `@bloxwap/font` and use `@bloxwap/hig/tokens/css`. Open Graph card renderers (Satori, `next/og`) use the much smaller `@bloxwap/hig/og-fonts` entry instead (#99).
|
|
6
6
|
|
package/og-fonts/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/og-fonts
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.9.0, an entry of `@bloxwap/hig`. Five static Latin Bloxwap Sans/Mono TTF faces for Open Graph card renderers: Satori, `next/og` `ImageResponse` and `@vercel/og`. Satori reads TTF/OTF but not WOFF2, and `@bloxwap/font` ships only WOFF2.
|
|
4
4
|
|
|
5
5
|
| Face | File | Weight |
|
|
6
6
|
| --- | --- | --- |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bloxwap/hig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Bloxwap Human Interface Guidelines: tokens, contracts, React and React Native components, chart adapter, feedback and fonts in one package.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -10,6 +10,11 @@
|
|
|
10
10
|
"import": "./tokens/dist/index.js",
|
|
11
11
|
"default": "./tokens/dist/index.js"
|
|
12
12
|
},
|
|
13
|
+
"./tokens/deposit-icons": {
|
|
14
|
+
"types": "./tokens/dist/deposit-icons.d.ts",
|
|
15
|
+
"import": "./tokens/dist/deposit-icons.js",
|
|
16
|
+
"default": "./tokens/dist/deposit-icons.js"
|
|
17
|
+
},
|
|
13
18
|
"./tokens/brand": {
|
|
14
19
|
"types": "./tokens/dist/brand.d.ts",
|
|
15
20
|
"import": "./tokens/dist/brand.js",
|
|
@@ -41,6 +46,11 @@
|
|
|
41
46
|
"import": "./contracts/dist/number-flow.js",
|
|
42
47
|
"default": "./contracts/dist/number-flow.js"
|
|
43
48
|
},
|
|
49
|
+
"./contracts/login": {
|
|
50
|
+
"types": "./contracts/dist/login.d.ts",
|
|
51
|
+
"import": "./contracts/dist/login.js",
|
|
52
|
+
"default": "./contracts/dist/login.js"
|
|
53
|
+
},
|
|
44
54
|
"./contracts/messages": {
|
|
45
55
|
"types": "./contracts/dist/messages.d.ts",
|
|
46
56
|
"import": "./contracts/dist/messages.js",
|
|
@@ -215,20 +225,25 @@
|
|
|
215
225
|
"import": "./react/dist/blocks/trade-entry.js",
|
|
216
226
|
"default": "./react/dist/blocks/trade-entry.js"
|
|
217
227
|
},
|
|
228
|
+
"./react/blocks/swap-block": {
|
|
229
|
+
"types": "./react/dist/blocks/swap-block.d.ts",
|
|
230
|
+
"import": "./react/dist/blocks/swap-block.js",
|
|
231
|
+
"default": "./react/dist/blocks/swap-block.js"
|
|
232
|
+
},
|
|
218
233
|
"./react/blocks/swap-panel-block": {
|
|
219
|
-
"types": "./react/dist/blocks/swap-
|
|
220
|
-
"import": "./react/dist/blocks/swap-
|
|
221
|
-
"default": "./react/dist/blocks/swap-
|
|
234
|
+
"types": "./react/dist/blocks/swap-block.d.ts",
|
|
235
|
+
"import": "./react/dist/blocks/swap-block.js",
|
|
236
|
+
"default": "./react/dist/blocks/swap-block.js"
|
|
222
237
|
},
|
|
223
238
|
"./react/blocks/swap-panel": {
|
|
224
|
-
"types": "./react/dist/blocks/swap-
|
|
225
|
-
"import": "./react/dist/blocks/swap-
|
|
226
|
-
"default": "./react/dist/blocks/swap-
|
|
239
|
+
"types": "./react/dist/blocks/swap-block.d.ts",
|
|
240
|
+
"import": "./react/dist/blocks/swap-block.js",
|
|
241
|
+
"default": "./react/dist/blocks/swap-block.js"
|
|
227
242
|
},
|
|
228
243
|
"./react/recipes/swap-panel": {
|
|
229
|
-
"types": "./react/dist/blocks/swap-
|
|
230
|
-
"import": "./react/dist/blocks/swap-
|
|
231
|
-
"default": "./react/dist/blocks/swap-
|
|
244
|
+
"types": "./react/dist/blocks/swap-block.d.ts",
|
|
245
|
+
"import": "./react/dist/blocks/swap-block.js",
|
|
246
|
+
"default": "./react/dist/blocks/swap-block.js"
|
|
232
247
|
},
|
|
233
248
|
"./react/blocks/pickers": {
|
|
234
249
|
"types": "./react/dist/blocks/pickers.d.ts",
|
|
@@ -318,6 +333,16 @@
|
|
|
318
333
|
"import": "./react/dist/blocks/token-action-block.js",
|
|
319
334
|
"default": "./react/dist/blocks/token-action-block.js"
|
|
320
335
|
},
|
|
336
|
+
"./react/blocks/login-block": {
|
|
337
|
+
"types": "./react/dist/blocks/login-block.d.ts",
|
|
338
|
+
"import": "./react/dist/blocks/login-block.js",
|
|
339
|
+
"default": "./react/dist/blocks/login-block.js"
|
|
340
|
+
},
|
|
341
|
+
"./react/blocks/deposit-block": {
|
|
342
|
+
"types": "./react/dist/blocks/deposit-block.d.ts",
|
|
343
|
+
"import": "./react/dist/blocks/deposit-block.js",
|
|
344
|
+
"default": "./react/dist/blocks/deposit-block.js"
|
|
345
|
+
},
|
|
321
346
|
"./react/blocks/language-block": {
|
|
322
347
|
"types": "./react/dist/blocks/language-block.d.ts",
|
|
323
348
|
"import": "./react/dist/blocks/language-block.js",
|
|
@@ -473,6 +498,16 @@
|
|
|
473
498
|
"import": "./native/dist/token-action-block.js",
|
|
474
499
|
"default": "./native/dist/token-action-block.js"
|
|
475
500
|
},
|
|
501
|
+
"./native/login-block": {
|
|
502
|
+
"types": "./native/dist/login-block.d.ts",
|
|
503
|
+
"import": "./native/dist/login-block.js",
|
|
504
|
+
"default": "./native/dist/login-block.js"
|
|
505
|
+
},
|
|
506
|
+
"./native/deposit-block": {
|
|
507
|
+
"types": "./native/dist/deposit-block.d.ts",
|
|
508
|
+
"import": "./native/dist/deposit-block.js",
|
|
509
|
+
"default": "./native/dist/deposit-block.js"
|
|
510
|
+
},
|
|
476
511
|
"./native/language-block": {
|
|
477
512
|
"types": "./native/dist/language-block.d.ts",
|
|
478
513
|
"import": "./native/dist/language-block.js",
|
package/react/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @bloxwap/hig/react
|
|
2
2
|
|
|
3
|
-
Version 0.
|
|
3
|
+
Version 0.9.0, an entry of `@bloxwap/hig`. Import individual entries; see docs/components for platform and accessibility contracts.
|
|
4
4
|
|
|
5
5
|
UI symbols come from `@bloxwap/icons` (install `@bloxwap/icons@^0.1.0`). The web entry renders inline SVG and imports individual icon modules.
|
|
6
6
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface DepositMethod {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
description: string;
|
|
6
|
+
/** Optional artwork for a custom method or a replacement for its built-in icon. */
|
|
7
|
+
icon?: React.ReactNode;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface DepositBlockProps {
|
|
11
|
+
title?: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
methods: readonly DepositMethod[];
|
|
14
|
+
onSelect: (method: DepositMethod) => void;
|
|
15
|
+
onBack?: () => void;
|
|
16
|
+
headerAction?: React.ReactNode;
|
|
17
|
+
headingId?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare function DepositBlock({ title, description, methods, onSelect, onBack, headerAction, headingId }: DepositBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { deposit } from '@bloxwap/hig/contracts/messages';
|
|
4
|
+
import { useHIG } from '../provider.js';
|
|
5
|
+
import { ListGroup, ListRow } from '../list-group.js';
|
|
6
|
+
import { ScreenHeader } from './screen-header.js';
|
|
7
|
+
const builtInMethods = new Set(['apple-pay', 'cash-app', 'exchange', 'crypto', 'bank', 'blink']);
|
|
8
|
+
export function DepositBlock({ title, description, methods, onSelect, onBack, headerAction, headingId }) {
|
|
9
|
+
const { messages } = useHIG();
|
|
10
|
+
return _jsxs("section", { className: "hig-deposit-block", children: [_jsx(ScreenHeader, { title: title ?? messages.deposit ?? deposit, onBack: onBack, action: headerAction, headingId: headingId }), description && _jsx("p", { className: "hig-settings-description", children: description }), _jsx(ListGroup, { children: methods.map(method => {
|
|
11
|
+
const leading = method.icon ?? (builtInMethods.has(method.id) &&
|
|
12
|
+
_jsx("span", { "aria-hidden": "true", className: "hig-deposit-icon", "data-method": method.id }));
|
|
13
|
+
return _jsx(ListRow, { leading: leading, label: method.label, description: method.description, disabled: method.disabled, onSelect: () => onSelect(method) }, method.id);
|
|
14
|
+
}) })] });
|
|
15
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type LoginBlockProps } from '@bloxwap/hig/contracts/login';
|
|
3
|
+
export type { LoginBlockProps, LoginProvider } from '@bloxwap/hig/contracts/login';
|
|
4
|
+
export declare function LoginBlock({ onLogin, onClose, lastUsed, disabled, analyticsEnabled, onAnalyticsChange, labels, termsUrl, privacyUrl }: LoginBlockProps): React.JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { HeaderClose, ScreenHeader } from './screen-header.js';
|
|
4
|
+
import { Info } from '@bloxwap/icons/react/info';
|
|
5
|
+
import { IconButton } from '../button.js';
|
|
6
|
+
import { Switch } from '../selection.js';
|
|
7
|
+
import { Popover } from '../popover.js';
|
|
8
|
+
import { ListRow } from '../list-group.js';
|
|
9
|
+
import { Badge } from '../status.js';
|
|
10
|
+
import { loginProviders, loginArtwork, loginCopy, loginTermsUrl, loginPrivacyUrl } from '@bloxwap/hig/contracts/login';
|
|
11
|
+
export function LoginBlock({ onLogin, onClose, lastUsed, disabled, analyticsEnabled, onAnalyticsChange, labels, termsUrl = loginTermsUrl, privacyUrl = loginPrivacyUrl }) {
|
|
12
|
+
const copy = { ...loginCopy, ...labels };
|
|
13
|
+
return _jsxs("section", { className: "hig-login-block", children: [_jsx(ScreenHeader, { title: copy.title, action: _jsx(HeaderClose, { label: copy.close, onClose: onClose }) }), _jsx("div", { className: "hig-login-providers", children: loginProviders.map(provider => _jsx(ListRow, { label: copy[provider], disabled: disabled, disclosure: "none", onSelect: () => onLogin(provider), leading: _jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", "aria-hidden": "true", children: loginArtwork[provider].map(path => _jsx("path", { d: path.d, fill: path.fill ?? 'currentColor' }, path.d)) }), trailing: lastUsed === provider ? _jsx(Badge, { tone: "positive", children: copy.lastUsed }) : undefined }, provider)) }), _jsxs("div", { className: "hig-login-analytics", children: [_jsx("span", { children: copy.analytics }), _jsx(Popover, { label: copy.analyticsInfo, closeLabel: copy.close, trigger: _jsx(IconButton, { label: copy.analyticsInfo, intent: "ghost", children: _jsx(Info, { size: 18 }) }), children: _jsx("p", { children: copy.description }) }), _jsx(Switch, { hideLabel: true, label: copy.analytics, checked: analyticsEnabled, onCheckedChange: onAnalyticsChange })] }), _jsxs("footer", { children: [_jsx("a", { href: termsUrl, children: copy.terms }), _jsx("a", { href: privacyUrl, children: copy.privacy })] })] });
|
|
14
|
+
}
|