@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
@@ -6,8 +6,8 @@ export interface ButtonProps extends Omit<PressableProps, 'children'> {
6
6
  children: React.ReactNode; /** Custom content renders host nodes directly; the host owns visible busy content. Root disabled/busy/feedback semantics stay canonical. */
7
7
  contentMode?: 'default' | 'custom';
8
8
  intent?: Intent;
9
- busy?: boolean; /** Busy suffix for this button; defaults to HIGProvider `messages.busy`. `''` hides it (accessibilityState.busy stays set). */
10
- busyLabel?: string; /** Overrides the provider's text scale cap for the label and busy suffix. */
9
+ busy?: boolean; /** Busy text for this button's accessible name; defaults to HIGProvider `messages.busy`. `''` leaves the name unchanged (accessibilityState.busy stays set). The visible busy state is a leading spinner. */
10
+ busyLabel?: string; /** Overrides the provider's text scale cap for the label. */
11
11
  maxFontSizeMultiplier?: number;
12
12
  script?: TextScript;
13
13
  fullWidth?: boolean;
@@ -16,6 +16,7 @@ export interface ButtonProps extends Omit<PressableProps, 'children'> {
16
16
  /** Android appends its localized busy state; including the suffix there would speak it twice. */
17
17
  export declare function busyAccessibilityLabel(text: string, busyText: string, os?: string): string | undefined;
18
18
  export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<React.ComponentRef<typeof View>>>;
19
+ /** While busy, the spinner takes the icon's place. */
19
20
  export declare function IconButton({ label, children, style, ...props }: ButtonProps & {
20
21
  label: string;
21
22
  }): React.JSX.Element;
@@ -1,9 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import React, { forwardRef, useId, useRef } from 'react';
3
- import { Pressable, Linking, Platform, View } from 'react-native';
4
- import { nativeMetrics as tokens } from '@bloxwap/hig/tokens';
3
+ import { ActivityIndicator, Pressable, Linking, Platform, View } from 'react-native';
5
4
  import * as en from '@bloxwap/hig/contracts/messages';
6
- import { useColors, useHIG } from './provider.js';
5
+ import { useColors, useFills, useHIG } from './provider.js';
7
6
  import { Text } from './surface.js';
8
7
  import { plainText } from './text-content.js';
9
8
  /** Adjacent text children such as `{label}: {value}` form one Text run so the label wraps as words, not gapped fragments. */
@@ -15,17 +14,20 @@ function labelRuns(children) { const runs = []; for (const child of React.Childr
15
14
  else
16
15
  runs.push(text ?? child);
17
16
  } return runs; }
17
+ /** A 44dp control keeps a 48dp touch target. */
18
+ const touchSlop = { top: 2, bottom: 2 };
18
19
  /** Android appends its localized busy state; including the suffix there would speak it twice. */
19
20
  export function busyAccessibilityLabel(text, busyText, os = Platform.OS) { return text ? (busyText && os !== 'android' ? `${text} · ${busyText}` : text) : undefined; }
20
- export const Button = /* @__PURE__ */ forwardRef(function Button({ children, contentMode = 'default', intent = 'primary', disabled, busy, busyLabel, maxFontSizeMultiplier, script, fullWidth, suppressFeedback, onPress, style, ...props }, ref) { const env = useHIG(); const colors = useColors(); const id = useId(); const sequence = useRef(0); const busyText = busyLabel ?? env.messages.busy ?? en.busy; const filled = intent === 'primary' || intent === 'destructive'; const label = plainText(children); const accessibleLabel = props.accessibilityLabel ?? (busy ? busyAccessibilityLabel(label, busyText) : undefined); const labelStyle = { color: intent === 'destructive' ? colors.background : intent === 'primary' ? colors.onAction : intent === 'ghost' ? colors.muted : colors.text, fontSize: 16, fontWeight: '600', textAlign: 'center' }; return _jsx(Pressable, { ...props, ref: ref, disabled: disabled || busy, accessibilityRole: 'button', accessibilityLabel: accessibleLabel, accessibilityState: { ...props.accessibilityState, disabled: !!disabled || !!busy, busy: !!busy }, "aria-busy": !!busy, onPress: e => { if (disabled || busy)
21
+ export const Button = /* @__PURE__ */ forwardRef(function Button({ children, contentMode = 'default', intent = 'primary', disabled, busy, busyLabel, maxFontSizeMultiplier, script, fullWidth, suppressFeedback, onPress, style, ...props }, ref) { const env = useHIG(); const colors = useColors(); const fills = useFills(); const id = useId(); const sequence = useRef(0); const busyText = busyLabel ?? env.messages.busy ?? en.busy; const filled = intent === 'primary' || intent === 'destructive'; /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ /* Unavailable is neutral: a well fill and muted text. Busy keeps the intent colour under its spinner. */ const inert = !!disabled && !busy; const label = plainText(children); const accessibleLabel = props.accessibilityLabel ?? (busy ? busyAccessibilityLabel(label, busyText) : undefined); const labelStyle = { color: inert ? (intent === 'ghost' ? colors.faint : colors.muted) : intent === 'destructive' ? colors.background : intent === 'primary' ? colors.onAction : intent === 'ghost' ? colors.muted : colors.text, fontSize: 16, fontWeight: '600', textAlign: 'center' }; return _jsx(Pressable, { ...props, ref: ref, disabled: disabled || busy, accessibilityRole: 'button', accessibilityLabel: accessibleLabel, accessibilityState: { ...props.accessibilityState, disabled: !!disabled || !!busy, busy: !!busy }, "aria-busy": !!busy, onPress: e => { if (disabled || busy)
21
22
  return; e.stopPropagation(); onPress?.(e); if (!e.isDefaultPrevented() && !disabled && !busy && !suppressFeedback) {
22
23
  try {
23
24
  env.onAccepted?.(id);
24
25
  env.feedback?.emit({ id: `${id}/${++sequence.current}`, source: id, intent: 'activate', origin: 'native' });
25
26
  }
26
27
  catch { /* Best effort only. */ }
27
- } }, style: state => [{ minHeight: Math.max(48, tokens.density[env.density].target), paddingHorizontal: 20, paddingVertical: 12, borderRadius: 9999, alignItems: 'center', justifyContent: 'center', backgroundColor: filled ? (intent === 'destructive' ? colors.negative : colors.action) : intent === 'ghost' && !state.pressed ? 'transparent' : colors.nested, opacity: disabled || busy ? 0.5 : state.pressed ? 0.85 : 1, alignSelf: fullWidth ? 'stretch' : 'flex-start' }, typeof style === 'function' ? style(state) : style], children: contentMode === 'custom' ? children : _jsxs(View, { style: { direction: env.direction, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8 }, children: [labelRuns(children).map((child, i) => typeof child === 'string' ? _jsx(Text, { script: script, maxFontSizeMultiplier: maxFontSizeMultiplier, style: labelStyle, children: child }, `label-${i}`) : child), busy && busyText ? _jsxs(Text, { script: script, maxFontSizeMultiplier: maxFontSizeMultiplier, style: labelStyle, children: ["\u00B7 ", busyText] }) : null] }) }); });
28
- export function IconButton({ label, children, style, ...props }) { return _jsx(Button, { ...props, accessibilityLabel: label, style: state => [{ minWidth: 48, paddingHorizontal: 12 }, typeof style === 'function' ? style(state) : style], children: children }); }
28
+ } }, hitSlop: props.hitSlop ?? touchSlop, style: state => [{ minHeight: 44, paddingHorizontal: 20, paddingVertical: 10, borderRadius: 9999, alignItems: 'center', justifyContent: 'center', backgroundColor: inert ? (intent === 'ghost' ? 'transparent' : fills.well) : filled ? (intent === 'destructive' ? colors.negative : colors.action) : intent === 'ghost' && !state.pressed ? 'transparent' : colors.nested, opacity: busy ? 0.7 : state.pressed && !inert ? 0.85 : 1, alignSelf: fullWidth ? 'stretch' : 'flex-start' }, typeof style === 'function' ? style(state) : style], children: contentMode === 'custom' ? children : _jsxs(View, { style: { direction: env.direction, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', justifyContent: 'center', gap: 8 }, children: [busy ? _jsx(ActivityIndicator, { size: 'small', color: labelStyle.color, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' }) : null, labelRuns(children).map((child, i) => typeof child === 'string' ? _jsx(Text, { script: script, maxFontSizeMultiplier: maxFontSizeMultiplier, style: labelStyle, children: child }, `label-${i}`) : child)] }) }); });
29
+ /** While busy, the spinner takes the icon's place. */
30
+ export function IconButton({ label, children, style, ...props }) { return _jsx(Button, { ...props, accessibilityLabel: label, style: state => [{ minWidth: 44, paddingHorizontal: 10 }, typeof style === 'function' ? style(state) : style], children: props.busy && props.contentMode !== 'custom' ? null : children }); }
29
31
  export const Link = /* @__PURE__ */ forwardRef(function Link({ href, children, onError, onPress, contentMode = 'default', disabled, style, ...props }, ref) { const colors = useColors(); const web = Platform.OS === 'web', webHref = web && !disabled ? { href } : {}; return _jsx(Pressable, { ...props, ...webHref, ref: ref, accessibilityRole: 'link', disabled: disabled, accessibilityState: { ...props.accessibilityState, disabled: !!disabled }, "aria-busy": props.accessibilityState?.busy, onPress: event => { if (disabled)
30
32
  return; if (onPress)
31
33
  onPress(event);
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { type StyleProp, type TextStyle } from 'react-native';
3
- export type NumberTone = 'text' | 'positive' | 'negative' | 'muted';
3
+ /** `up`/`down` are market direction (rising/long/gain, falling/short/loss) and follow `HIGProvider marketColors`; `positive`/`negative` stay success/error. */
4
+ export type NumberTone = 'text' | 'positive' | 'negative' | 'muted' | 'up' | 'down';
4
5
  /** Typography only: semantic tone owns colour and numeric glyphs remain tabular. */
5
6
  export type NumberReadoutStyle = Pick<TextStyle, 'fontFamily' | 'fontSize' | 'fontWeight' | 'lineHeight' | 'letterSpacing' | 'textAlign'>;
6
7
  export interface NumberProps {
@@ -38,3 +39,19 @@ export interface ListProps<T> {
38
39
  onLoadMore?: () => void;
39
40
  }
40
41
  export declare function List<T>({ items, keyFor, render, empty, label, loading, error, onRetry, onLoadMore }: ListProps<T>): React.JSX.Element;
42
+ export type AddressKind = 'ethereum' | 'solana';
43
+ /** `0x…` is Ethereum-style (EVM); anything else lays out as Solana (base58). */
44
+ export declare function addressKind(address: string): AddressKind;
45
+ /** The address in fixed-width rows: 6 characters for Ethereum (42 characters make 7 rows), 4 for Solana (44 make 11). `anchor` marks the leading row and the trailing 4 characters, the ones people compare. */
46
+ export declare function addressRows(address: string, kind?: AddressKind): {
47
+ character: string;
48
+ anchor: boolean;
49
+ }[][];
50
+ export interface VerticalAddressProps {
51
+ address: string;
52
+ kind?: AddressKind; /** Row height in dp; the font size follows it. */
53
+ rowHeight?: number;
54
+ testID?: string;
55
+ }
56
+ /** A wallet address as a monospace column: the anchor characters in `text` at weight 600, the middle in `muted`. One selectable text element named by the whole address, always left to right. */
57
+ export declare function VerticalAddress({ address, kind, rowHeight, testID }: VerticalAddressProps): React.JSX.Element;
@@ -1,5 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { FlatList, View, StyleSheet } from 'react-native';
2
+ import React from 'react';
3
+ import { FlatList, Platform, View, StyleSheet } from 'react-native';
3
4
  import { formatNumberReadout } from './animated-number-model.js';
4
5
  import * as en from '@bloxwap/hig/contracts/messages';
5
6
  import { useColors, useHIG } from './provider.js';
@@ -13,7 +14,7 @@ export function NumberReadout({ value, options, formattedValue, stale, label, to
13
14
  const staleSuffix = stale ? ` ${messages.stale ?? en.stale}` : '';
14
15
  // Keep the same boundary for untyped hosts and registered/array styles: no raw colour, glyph or layout overrides.
15
16
  const typography = Object.fromEntries(Object.entries(StyleSheet.flatten(style) ?? {}).filter(([key]) => numberTypographyKeys.has(key)));
16
- const color = colors[tone === 'positive' || tone === 'negative' || tone === 'muted' ? tone : 'text'];
17
+ const color = colors[tone === 'positive' || tone === 'negative' || tone === 'muted' || tone === 'up' || tone === 'down' ? tone : 'text'];
17
18
  return _jsxs(Text, { accessibilityLabel: label ? `${label}: ${reading}${staleSuffix}` : undefined, testID: testID, maxFontSizeMultiplier: maxFontSizeMultiplier, style: [typography, { color, fontVariant: ['tabular-nums'] }], children: [reading, staleSuffix] });
18
19
  }
19
20
  export function Usd(props) { return _jsx(NumberReadout, { ...props, options: { style: 'currency', currency: 'USD', ...props.options } }); }
@@ -25,3 +26,22 @@ export function List({ items, keyFor, render, empty, label, loading = false, err
25
26
  const { messages } = useHIG();
26
27
  return _jsx(FlatList, { data: items, accessibilityLabel: label, accessibilityState: { busy: loading }, keyExtractor: keyFor, renderItem: ({ item }) => _jsx(View, { children: render(item) }), ItemSeparatorComponent: Separator, ListEmptyComponent: !loading && !error ? _jsx(Text, { children: empty ?? messages.noItems ?? en.noItems }) : null, ListFooterComponent: _jsxs(View, { style: { gap: 12, paddingTop: loading || error || onLoadMore ? 12 : 0 }, children: [loading && _jsx(Text, { accessibilityLiveRegion: 'polite', children: messages.loadingItems ?? en.loadingItems }), error && _jsxs(View, { style: { gap: 12 }, children: [_jsx(Text, { accessibilityRole: 'alert', children: error }), onRetry && _jsx(Button, { disabled: loading, onPress: onRetry, children: messages.retry ?? en.retry })] }), onLoadMore && _jsx(Button, { disabled: loading, onPress: onLoadMore, children: messages.loadMore ?? en.loadMore })] }) });
27
28
  }
29
+ /** `0x…` is Ethereum-style (EVM); anything else lays out as Solana (base58). */
30
+ export function addressKind(address) { return address.startsWith('0x') ? 'ethereum' : 'solana'; }
31
+ /** The address in fixed-width rows: 6 characters for Ethereum (42 characters make 7 rows), 4 for Solana (44 make 11). `anchor` marks the leading row and the trailing 4 characters, the ones people compare. */
32
+ export function addressRows(address, kind = addressKind(address)) {
33
+ const size = kind === 'ethereum' ? 6 : 4, tail = address.length - 4, rows = [];
34
+ for (let index = 0; index < address.length; index += size)
35
+ rows.push(Array.from(address.slice(index, index + size)).map((character, offset) => ({ character, anchor: index + offset < size || index + offset >= tail })));
36
+ return rows;
37
+ }
38
+ /** A wallet address as a monospace column: the anchor characters in `text` at weight 600, the middle in `muted`. One selectable text element named by the whole address, always left to right. */
39
+ export function VerticalAddress({ address, kind, rowHeight = 22, testID }) {
40
+ const env = useHIG();
41
+ const colors = useColors();
42
+ const mono = env.monoFontFamily ?? Platform.select({ ios: 'Menlo', default: 'monospace' });
43
+ const rows = addressRows(address, kind);
44
+ // HIG Text sets its own body size, so each character carries the row's type size instead of inheriting it.
45
+ const type = { fontFamily: mono, fontSize: Math.round(rowHeight / 1.1 * 10) / 10, lineHeight: rowHeight, letterSpacing: 1 };
46
+ return _jsx(Text, { selectable: true, accessibilityLabel: address, testID: testID, maxFontSizeMultiplier: 1.2, style: { ...type, fontVariant: ['tabular-nums'], writingDirection: 'ltr', textAlign: 'left' }, children: rows.map((row, index) => _jsxs(React.Fragment, { children: [index > 0 ? '\n' : null, row.map((cell, offset) => _jsx(Text, { maxFontSizeMultiplier: 1.2, style: { ...type, color: cell.anchor ? colors.text : colors.muted, fontWeight: cell.anchor ? '600' : '500' }, children: cell.character }, offset))] }, index)) });
47
+ }
@@ -9,6 +9,7 @@ export declare function Field({ label, description, error, required, disabled, c
9
9
  disabled?: boolean;
10
10
  }>): React.JSX.Element;
11
11
  export declare const Label: typeof Text;
12
+ /** No resting stroke: the fill separates the field (one step lighter inside a Surface, Dialog or sheet). The ring appears only for focus and for an invalid value. */
12
13
  export declare const Input: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<React.ComponentRef<typeof TextInput>>>;
13
14
  export declare const TextArea: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<React.ComponentRef<typeof TextInput>>>;
14
15
  export declare const AmountInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<React.ComponentRef<typeof TextInput>>>;
@@ -1,13 +1,26 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { createContext, useContext, forwardRef, useId } from 'react';
3
- import { TextInput, View } from 'react-native';
2
+ import { createContext, useContext, forwardRef, useId, useState } from 'react';
3
+ import { Platform, TextInput, View } from 'react-native';
4
+ import { SearchIcon } from './icons.js';
4
5
  import { Text } from './surface.js';
5
6
  import * as en from '@bloxwap/hig/contracts/messages';
6
- import { useColors, useHIG } from './provider.js';
7
+ import { useColors, useFills, useHIG } from './provider.js';
7
8
  const Context = createContext({ label: '' });
8
9
  export function Field({ label, description, error, required, disabled, children }) { const id = useId(); const { messages } = useHIG(); const colors = useColors(); const marked = required ? `${label} ${messages.required ?? en.required}` : label; return _jsx(Context.Provider, { value: { label: marked, hint: [description, error].filter(Boolean).join('. '), disabled, invalid: !!error }, children: _jsxs(View, { style: { gap: 8 }, children: [_jsx(Text, { nativeID: id, children: marked }), children, description && _jsx(Text, { style: { color: colors.muted }, children: description }), error && _jsx(Text, { accessibilityLiveRegion: 'polite', style: { color: colors.negative }, children: error })] }) }); }
9
10
  export const Label = Text;
10
- export const Input = forwardRef(function Input({ style, ...props }, ref) { const field = useContext(Context); const colors = useColors(); const env = useHIG(); return _jsx(TextInput, { ...props, ref: ref, accessibilityLabel: props.accessibilityLabel ?? field.label, accessibilityHint: props.accessibilityHint ?? field.hint, accessibilityState: { ...props.accessibilityState, disabled: !!field.disabled || !!props.accessibilityState?.disabled }, editable: field.disabled ? false : props.editable, onChangeText: field.disabled ? undefined : props.onChangeText, onChange: field.disabled ? undefined : props.onChange, placeholderTextColor: props.placeholderTextColor ?? colors.muted, style: [{ color: colors.text, backgroundColor: colors.surface, minHeight: 48, borderWidth: 1, borderColor: field.invalid ? colors.negative : colors.border, borderRadius: props.multiline ? 14 : 9999, paddingVertical: 12, paddingHorizontal: 20, fontSize: 16, fontFamily: env.fontFamilies?.[400] ?? env.fontFamily, opacity: field.disabled ? 0.5 : 1 }, style] }); });
11
+ /** No resting stroke: the fill separates the field (one step lighter inside a Surface, Dialog or sheet). The ring appears only for focus and for an invalid value. */
12
+ export const Input = forwardRef(function Input({ style, onFocus, onBlur, ...props }, ref) { const field = useContext(Context); const colors = useColors(); const fills = useFills(); const env = useHIG(); const [focused, setFocused] = useState(false); return _jsx(TextInput, { ...props, ref: ref, accessibilityLabel: props.accessibilityLabel ?? field.label, accessibilityHint: props.accessibilityHint ?? field.hint, accessibilityState: { ...props.accessibilityState, disabled: !!field.disabled || !!props.accessibilityState?.disabled }, editable: field.disabled ? false : props.editable, onChangeText: field.disabled ? undefined : props.onChangeText, onChange: field.disabled ? undefined : props.onChange, onFocus: event => { setFocused(true); onFocus?.(event); }, onBlur: event => { setFocused(false); onBlur?.(event); }, placeholderTextColor: props.placeholderTextColor ?? colors.muted, style: [{ color: colors.text, backgroundColor: fills.well, minHeight: 48, borderWidth: 1.5, borderColor: field.invalid ? colors.negative : focused ? colors.faint : 'transparent', borderRadius: props.multiline ? 14 : 9999, paddingVertical: 12, paddingHorizontal: 20, fontSize: 16, fontFamily: env.fontFamilies?.[400] ?? env.fontFamily, opacity: field.disabled ? 0.5 : 1 }, style] }); });
11
13
  export const TextArea = forwardRef(function TextArea(props, ref) { return _jsx(Input, { ...props, ref: ref, multiline: true, textAlignVertical: 'top' }); });
12
14
  export const AmountInput = forwardRef(function AmountInput(props, ref) { return _jsx(Input, { ...props, ref: ref, keyboardType: props.keyboardType ?? 'decimal-pad' }); });
13
- export const SearchInput = forwardRef(function SearchInput(props, ref) { return _jsx(Input, { ...props, ref: ref, returnKeyType: props.returnKeyType ?? 'search' }); });
15
+ /** The magnifying glass sits inset on the leading edge and the text starts past it. */
16
+ /** A search box is as tall as a button, 44dp, not a 48dp form field. */
17
+ const searchSize = { minHeight: 44, paddingVertical: 10 };
18
+ export const SearchInput = forwardRef(function SearchInput({ style, ...props }, ref) {
19
+ const colors = useColors();
20
+ const { direction } = useHIG();
21
+ // RN Web resolves `start` through its own locale context rather than this View's direction.
22
+ const rtl = direction === 'rtl', web = Platform.OS === 'web';
23
+ const edge = web ? (rtl ? { right: 18 } : { left: 18 }) : { start: 18 };
24
+ const inset = web ? (rtl ? { paddingRight: 46 } : { paddingLeft: 46 }) : { paddingStart: 46 };
25
+ return _jsxs(View, { style: { direction, justifyContent: 'center' }, children: [_jsx(Input, { ...props, ref: ref, returnKeyType: props.returnKeyType ?? 'search', style: [searchSize, inset, style] }), _jsx(View, { pointerEvents: 'none', style: { position: 'absolute', ...edge }, children: _jsx(SearchIcon, { color: colors.muted }) })] });
26
+ });
@@ -6,7 +6,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
6
6
  import { ReduceMotion } from 'react-native-reanimated';
7
7
  import { nativeMetrics as tokens } from '@bloxwap/hig/tokens';
8
8
  import * as en from '@bloxwap/hig/contracts/messages';
9
- import { useColors, useHIG } from './provider.js';
9
+ import { Raised, useColors, useHIG } from './provider.js';
10
10
  import { Heading, Text, Stack } from './surface.js';
11
11
  import { Button } from './button.js';
12
12
  /** Optional backend: host supplies GestureHandlerRootView, SafeAreaProvider and BottomSheetModalProvider. */
@@ -146,6 +146,8 @@ export function GestureSheet({ open, onOpenChange, title, description, children,
146
146
  // Expose individual children instead of grouping the sheet as one adjustable element. Gorhom forwards only
147
147
  // basic accessibility props, so modal escape and VoiceOver scope belong on its measured or scrolling content.
148
148
  // Inline content keeps its native state while closed, with all descendants hidden from accessibility.
149
- const backendProps = { accessible: false, accessibilityLabel: title, index: presentation === 'inline' && !open ? -1 : presented.current ? Math.max(0, Math.min(activeIndex.current, detentCount - 1)) : startingIndex, snapPoints: enableDynamicSizing ? undefined : [...fixedSnapPoints], enableDynamicSizing, maxDynamicContentSize: enableDynamicSizing ? maxDynamicContentSize : undefined, enableContentPanningGesture, enablePanDownToClose: dismissible, topInset: topInset ?? insets.top, bottomInset: bottomInset ?? insets.bottom, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, overrideReduceMotion: env.reducedMotion ? ReduceMotion.Always : ReduceMotion.System, animateOnMount, animationConfigs, backdropComponent: backdropComponent === undefined ? backdrop : backdropComponent, handleComponent, handleStyle, backgroundComponent, containerStyle, backgroundStyle: backgroundStyle ? [{ backgroundColor: colors.surface, borderRadius: tokens.radius.xl }, backgroundStyle] : { backgroundColor: colors.surface, borderRadius: tokens.radius.xl }, handleIndicatorStyle: handleIndicatorStyle ? [{ backgroundColor: colors.muted }, handleIndicatorStyle] : { backgroundColor: colors.muted }, onChange: handleChange };
150
- return presentation === 'inline' ? _jsx(BottomSheet, { ...backendProps, ref: inline, accessibilityElementsHidden: !open, importantForAccessibility: open ? 'auto' : 'no-hide-descendants', onClose: handleSettledClose, children: content }) : _jsx(BottomSheetModal, { ...backendProps, ref: sheet, enableDismissOnClose: true, stackBehavior: 'push', onDismiss: handleSettledClose, children: content });
149
+ // No stroke: the sheet is the `overlay` fill, darker than a card, lifted by a soft shadow.
150
+ const sheetFill = { backgroundColor: colors.overlay, borderRadius: tokens.radius.xl, boxShadow: '0 -8px 32px #0008' };
151
+ const backendProps = { accessible: false, accessibilityLabel: title, index: presentation === 'inline' && !open ? -1 : presented.current ? Math.max(0, Math.min(activeIndex.current, detentCount - 1)) : startingIndex, snapPoints: enableDynamicSizing ? undefined : [...fixedSnapPoints], enableDynamicSizing, maxDynamicContentSize: enableDynamicSizing ? maxDynamicContentSize : undefined, enableContentPanningGesture, enablePanDownToClose: dismissible, topInset: topInset ?? insets.top, bottomInset: bottomInset ?? insets.bottom, keyboardBehavior, keyboardBlurBehavior, android_keyboardInputMode, overrideReduceMotion: env.reducedMotion ? ReduceMotion.Always : ReduceMotion.System, animateOnMount, animationConfigs, backdropComponent: backdropComponent === undefined ? backdrop : backdropComponent, handleComponent, handleStyle, backgroundComponent, containerStyle, backgroundStyle: backgroundStyle ? [sheetFill, backgroundStyle] : sheetFill, handleIndicatorStyle: handleIndicatorStyle ? [{ backgroundColor: colors.action }, handleIndicatorStyle] : { backgroundColor: colors.action }, onChange: handleChange };
152
+ return presentation === 'inline' ? _jsx(BottomSheet, { ...backendProps, ref: inline, accessibilityElementsHidden: !open, importantForAccessibility: open ? 'auto' : 'no-hide-descendants', onClose: handleSettledClose, children: _jsx(Raised, { children: content }) }) : _jsx(BottomSheetModal, { ...backendProps, ref: sheet, enableDismissOnClose: true, stackBehavior: 'push', onDismiss: handleSettledClose, children: _jsx(Raised, { children: content }) });
151
153
  }
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ export declare function SearchIcon({ color }: {
3
+ color: string;
4
+ }): React.JSX.Element;
5
+ /** Points down; the caller rotates it. */
6
+ export declare function ChevronIcon({ color }: {
7
+ color: string;
8
+ }): React.JSX.Element;
9
+ export declare function CloseIcon({ color }: {
10
+ color: string;
11
+ }): React.JSX.Element;
12
+ export type SeverityIconKind = 'info' | 'success' | 'warning' | 'error';
13
+ /** Shape as well as colour tells the severities apart: warning is a diamond, the others a circle with their own mark. */
14
+ export declare function SeverityIcon({ kind, color }: {
15
+ kind: SeverityIconKind;
16
+ color: string;
17
+ }): React.JSX.Element;
18
+ /** Neutral mark for an empty state: an empty tray. */
19
+ export declare function EmptyIcon({ color }: {
20
+ color: string;
21
+ }): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { View } from 'react-native';
3
+ /** Outline icons drawn from plain views, so status, field and navigation entries need no SVG peer. All are decorative: the control or text beside them carries the meaning. */
4
+ const hidden = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', pointerEvents: 'none' };
5
+ const stroke = 1.75;
6
+ const centre = { alignItems: 'center', justifyContent: 'center' };
7
+ function Bar({ length, color, angle }) { return _jsx(View, { style: { position: 'absolute', width: length, height: stroke, borderRadius: stroke, backgroundColor: color, transform: [{ rotate: angle }] } }); }
8
+ export function SearchIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 18, height: 18 }, children: [_jsx(View, { style: { width: 13, height: 13, borderRadius: 7, borderWidth: stroke, borderColor: color } }), _jsx(View, { style: { position: 'absolute', right: 1, bottom: 3, width: 6, height: stroke, borderRadius: stroke, backgroundColor: color, transform: [{ rotate: '45deg' }] } })] }); }
9
+ /** Points down; the caller rotates it. */
10
+ export function ChevronIcon({ color }) { return _jsx(View, { ...hidden, style: { width: 20, height: 20, ...centre }, children: _jsx(View, { style: { width: 9, height: 9, borderRightWidth: stroke, borderBottomWidth: stroke, borderColor: color, transform: [{ translateY: -2 }, { rotate: '45deg' }] } }) }); }
11
+ export function CloseIcon({ color }) { return _jsxs(View, { ...hidden, style: { width: 20, height: 20, ...centre }, children: [_jsx(Bar, { length: 14, color: color, angle: '45deg' }), _jsx(Bar, { length: 14, color: color, angle: '-45deg' })] }); }
12
+ /** Shape as well as colour tells the severities apart: warning is a diamond, the others a circle with their own mark. */
13
+ export function SeverityIcon({ kind, color }) {
14
+ const mark = kind === 'success' ? _jsx(View, { style: { width: 9, height: 5, borderLeftWidth: stroke, borderBottomWidth: stroke, borderColor: color, transform: [{ translateY: -1 }, { rotate: '-45deg' }] } })
15
+ : kind === 'error' ? _jsxs(_Fragment, { children: [_jsx(Bar, { length: 9, color: color, angle: '45deg' }), _jsx(Bar, { length: 9, color: color, angle: '-45deg' })] })
16
+ : _jsxs(View, { style: { alignItems: 'center', gap: 1.5, flexDirection: kind === 'warning' ? 'column-reverse' : 'column' }, children: [_jsx(View, { style: { width: 2, height: 2, borderRadius: 1, backgroundColor: color } }), _jsx(View, { style: { width: 2, height: 6, borderRadius: 1, backgroundColor: color } })] });
17
+ return _jsxs(View, { ...hidden, style: { width: 20, height: 20, ...centre }, children: [kind === 'warning' ? _jsx(View, { style: { position: 'absolute', width: 15, height: 15, borderRadius: 4, borderWidth: stroke, borderColor: color, transform: [{ rotate: '45deg' }] } }) : _jsx(View, { style: { position: 'absolute', width: 20, height: 20, borderRadius: 10, borderWidth: stroke, borderColor: color } }), mark] });
18
+ }
19
+ /** Neutral mark for an empty state: an empty tray. */
20
+ export function EmptyIcon({ color }) { return _jsx(View, { ...hidden, style: { width: 48, height: 48, ...centre }, children: _jsx(View, { style: { width: 40, height: 30, borderRadius: 10, borderWidth: 2, borderColor: color, justifyContent: 'flex-end', alignItems: 'center', paddingBottom: 7 }, children: _jsx(View, { style: { width: 16, height: 2, borderRadius: 1, backgroundColor: color } }) }) }); }
@@ -11,6 +11,7 @@ export declare function Tabs({ label, items, value, defaultValue, onValueChange
11
11
  defaultValue?: string;
12
12
  onValueChange?: (v: string) => void;
13
13
  }): React.JSX.Element;
14
+ /** A strokeless card. The outline chevron sits on the trailing edge and turns as the content expands or collapses; with reduced motion both change at once. */
14
15
  export declare function Accordion({ title, children, open, onOpenChange }: React.PropsWithChildren<{
15
16
  title: string;
16
17
  open?: boolean;
@@ -1,16 +1,58 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Pressable, View } from 'react-native';
2
+ import { useEffect, useRef, useState } from 'react';
3
+ import { Animated, Easing, Pressable, View } from 'react-native';
4
+ import { tokens } from '@bloxwap/hig/tokens';
5
+ import { ChevronIcon } from './icons.js';
3
6
  import { formatNumber } from '@bloxwap/hig/contracts';
4
7
  import * as en from '@bloxwap/hig/contracts/messages';
5
- import { useColors, useControllable, useHIG } from './provider.js';
8
+ import { useColors, useControllable, useFills, useHIG } from './provider.js';
6
9
  import { Button } from './button.js';
7
- import { Text, Inline, Stack } from './surface.js';
10
+ import { Text, Inline, Stack, Surface } from './surface.js';
8
11
  import { Field, SearchInput } from './field.js';
9
- export function Tabs({ label, items, value, defaultValue, onValueChange }) { const colors = useColors(); const { direction } = useHIG(); const [current, set] = useControllable(value, defaultValue ?? items.find(item => !item.disabled)?.value ?? '', onValueChange); return _jsxs(View, { style: { direction, gap: 12 }, children: [_jsx(Inline, { accessibilityRole: 'tablist', accessibilityLabel: label, children: items.map(i => _jsx(Pressable, { accessibilityRole: 'tab', "aria-selected": current === i.value, "aria-disabled": !!i.disabled, accessibilityState: { selected: current === i.value, disabled: !!i.disabled }, disabled: i.disabled, onPress: () => { if (!i.disabled)
10
- set(i.value); }, style: ({ pressed }) => ({ minHeight: 48, paddingHorizontal: 20, paddingVertical: 12, borderRadius: 9999, alignItems: 'center', justifyContent: 'center', backgroundColor: current === i.value ? colors.action : colors.nested, opacity: i.disabled ? .5 : pressed ? .85 : 1 }), children: _jsx(Text, { style: { fontWeight: '600', color: current === i.value ? colors.onAction : colors.text }, children: i.label }) }, i.value)) }), items.find(i => i.value === current)?.content] }); }
11
- export function Accordion({ title, children, open, onOpenChange }) { const [current, set] = useControllable(open, false, onOpenChange, 'disclosure'); return _jsxs(View, { children: [_jsx(Button, { intent: 'secondary', suppressFeedback: true, accessibilityState: { expanded: current }, onPress: () => set(!current), children: title }), current && children] }); }
12
+ /** Actions that sit side by side are 8dp apart; content keeps the 12dp gap. */
13
+ const actionRow = { gap: tokens.space.sm };
14
+ export function Tabs({ label, items, value, defaultValue, onValueChange }) { const colors = useColors(); const fills = useFills(); const { direction } = useHIG(); const [current, set] = useControllable(value, defaultValue ?? items.find(item => !item.disabled)?.value ?? '', onValueChange); return _jsxs(View, { style: { direction, gap: 12 }, children: [_jsx(Inline, { style: actionRow, accessibilityRole: 'tablist', accessibilityLabel: label, children: items.map(i => _jsx(Pressable, { accessibilityRole: 'tab', "aria-selected": current === i.value, "aria-disabled": !!i.disabled, accessibilityState: { selected: current === i.value, disabled: !!i.disabled }, disabled: i.disabled, onPress: () => { if (!i.disabled)
15
+ set(i.value); }, hitSlop: { top: 2, bottom: 2 }, style: ({ pressed }) => ({ minHeight: 44, paddingHorizontal: 20, paddingVertical: 10, borderRadius: 9999, alignItems: 'center', justifyContent: 'center', backgroundColor: current === i.value ? fills.raised : 'transparent', opacity: i.disabled ? .5 : pressed ? .85 : 1 }), children: _jsx(Text, { style: { fontWeight: '600', color: current === i.value ? colors.text : colors.muted }, children: i.label }) }, i.value)) }), items.find(i => i.value === current)?.content] }); }
16
+ /** A strokeless card. The outline chevron sits on the trailing edge and turns as the content expands or collapses; with reduced motion both change at once. */
17
+ export function Accordion({ title, children, open, onOpenChange }) {
18
+ const [current, set] = useControllable(open, false, onOpenChange, 'disclosure');
19
+ const { reducedMotion, direction } = useHIG();
20
+ const colors = useColors();
21
+ const progress = useRef(new Animated.Value(current ? 1 : 0)).current;
22
+ const [height, setHeight] = useState(0);
23
+ const [mounted, setMounted] = useState(current);
24
+ const [settled, setSettled] = useState(true);
25
+ const first = useRef(true);
26
+ useEffect(() => {
27
+ if (first.current) {
28
+ first.current = false;
29
+ return;
30
+ }
31
+ if (reducedMotion) {
32
+ progress.stopAnimation();
33
+ progress.setValue(current ? 1 : 0);
34
+ setMounted(current);
35
+ setSettled(true);
36
+ return;
37
+ }
38
+ if (current)
39
+ setMounted(true);
40
+ setSettled(false);
41
+ // Height cannot run on the native driver; the chevron shares the value so both stay in step.
42
+ const animation = Animated.timing(progress, { toValue: current ? 1 : 0, duration: tokens.motion.base, easing: Easing.bezier(...tokens.easing.standard), useNativeDriver: false, isInteraction: false });
43
+ animation.start(({ finished }) => { if (finished) {
44
+ setSettled(true);
45
+ if (!current)
46
+ setMounted(false);
47
+ } });
48
+ return () => animation.stop();
49
+ }, [current, reducedMotion, progress]);
50
+ // Once open and at rest the content sizes itself again, so it can grow or shrink freely.
51
+ const clip = settled && current ? undefined : { height: progress.interpolate({ inputRange: [0, 1], outputRange: [0, height] }), overflow: 'hidden' };
52
+ return _jsxs(Surface, { style: { padding: 0 }, children: [_jsxs(Pressable, { accessibilityRole: 'button', accessibilityState: { expanded: current }, "aria-expanded": current, onPress: () => set(!current), style: ({ pressed }) => ({ direction, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: tokens.space.md, minHeight: 48, padding: tokens.space.xl, opacity: pressed ? .85 : 1 }), children: [_jsx(Text, { style: { flex: 1, minWidth: 0, fontWeight: '600' }, children: title }), _jsx(Animated.View, { style: { transform: [{ rotate: progress.interpolate({ inputRange: [0, 1], outputRange: ['0deg', '180deg'] }) }] }, children: _jsx(ChevronIcon, { color: colors.muted }) })] }), mounted && _jsx(Animated.View, { style: clip, children: _jsx(View, { onLayout: event => setHeight(event.nativeEvent.layout.height), style: { paddingHorizontal: tokens.space.xl, paddingBottom: tokens.space.xl }, children: children }) })] });
53
+ }
12
54
  export function Navigation({ label, items }) { const colors = useColors(); return _jsx(Stack, { accessibilityLabel: label, style: { gap: 4 }, children: items.map(i => _jsx(Button, { fullWidth: true, intent: 'ghost', accessibilityState: { selected: !!i.active }, onPress: i.onNavigate, style: { alignItems: 'flex-start', backgroundColor: i.active ? colors.nested : 'transparent' }, children: i.label }, i.id)) }); }
13
55
  export const BottomNavigation = Navigation;
14
- export function Pagination({ page, total, onPageChange }) { const { locale, messages } = useHIG(); return _jsxs(Inline, { children: [_jsx(Button, { intent: 'secondary', disabled: page <= 1, onPress: () => onPageChange(page - 1), children: messages.previous ?? en.previous }), _jsx(Text, { children: (messages.pageOf ?? en.pageOf)(formatNumber(page, locale), formatNumber(total, locale)) }), _jsx(Button, { intent: 'secondary', disabled: page >= total, onPress: () => onPageChange(page + 1), children: messages.next ?? en.next })] }); }
56
+ export function Pagination({ page, total, onPageChange }) { const { locale, messages } = useHIG(); return _jsxs(Inline, { style: actionRow, children: [_jsx(Button, { intent: 'secondary', disabled: page <= 1, onPress: () => onPageChange(page - 1), children: messages.previous ?? en.previous }), _jsx(Text, { children: (messages.pageOf ?? en.pageOf)(formatNumber(page, locale), formatNumber(total, locale)) }), _jsx(Button, { intent: 'secondary', disabled: page >= total, onPress: () => onPageChange(page + 1), children: messages.next ?? en.next })] }); }
15
57
  export function Search({ query, onQueryChange, results, loading, error }) { const { locale, messages } = useHIG(); return _jsxs(Stack, { children: [_jsx(Field, { label: messages.search ?? en.search, children: _jsx(SearchInput, { value: query, onChangeText: onQueryChange }) }), _jsx(Text, { accessibilityLiveRegion: 'polite', children: loading ? messages.searching ?? en.searching : error ?? (results.length ? (messages.resultCount ?? en.resultCount)(results.length, locale) : messages.noResults ?? en.noResults) }), !loading && !error && results.map(r => _jsx(Button, { intent: 'ghost', onPress: r.onSelect, children: r.label }, r.id))] }); }
16
58
  export function BackButton({ onBack }) { const { messages } = useHIG(); return _jsx(Button, { intent: 'secondary', onPress: onBack, children: messages.back ?? en.back }); }
@@ -1,12 +1,12 @@
1
1
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as en from '@bloxwap/hig/contracts/messages';
3
- import { useColors, useHIG } from './provider.js';
3
+ import { Raised, useColors, useHIG } from './provider.js';
4
4
  import React, { useEffect, useRef, useId, useCallback } from 'react';
5
5
  import { Modal, KeyboardAvoidingView, Platform, ScrollView, AccessibilityInfo, findNodeHandle, View } from 'react-native';
6
6
  import { SafeAreaView } from 'react-native-safe-area-context';
7
7
  import { Heading, Text, Stack } from './surface.js';
8
8
  import { Button } from './button.js';
9
- /** Native focus requests remain best effort; host supplies a live trigger ref for restoration. */
9
+ /** The panel has no stroke: it is the `overlay` fill, darker than a card, lifted by a soft shadow. Native focus requests remain best effort; host supplies a live trigger ref for restoration. */
10
10
  /** Android TalkBack ignores the TYPE_VIEW_FOCUSED event behind setAccessibilityFocus in RN 0.81 Fabric (emulator: focus fell back to the first screen element); a hover-enter event moves its focus. */
11
11
  function focusNative(target) { if (Platform.OS === 'web' || !target)
12
12
  return; const handle = findNodeHandle(target); if (handle == null)
@@ -50,7 +50,7 @@ export function Dialog({ open, onOpenChange, title, description, children, initi
50
50
  useEffect(() => () => { if (frame.current !== undefined)
51
51
  cancelAnimationFrame(frame.current); returnPending.current = false; }, []);
52
52
  const modal = _jsx(Modal, { visible: open, transparent: true, animationType: resolvedAnimation, supportedOrientations: overlayOrientations, onShow: () => { if (latest.current.open)
53
- focusNative(initialFocusRef?.current ?? (contentMode === 'custom' ? titleRef?.current : null) ?? heading.current); }, onDismiss: restoreFocus, onRequestClose: () => onOpenChange(false), accessibilityViewIsModal: true, children: contentMode === 'custom' ? _jsxs(Stage, { style: [{ flex: 1, backgroundColor: '#000b', justifyContent: 'center', direction }, stageStyle], testID: stageTestID, children: [backdrop, _jsxs(View, { accessible: false, accessibilityLabel: title, accessibilityViewIsModal: true, onAccessibilityEscape: () => onOpenChange(false), collapsable: false, style: [{ direction }, contentStyle], testID: testID, children: [!titleRef && _jsx(Heading, { ref: heading, accessible: true, accessibilityLabel: title, style: { position: 'absolute', width: 1, height: 1, overflow: 'hidden' }, children: title }), children] })] }) : _jsx(SafeAreaView, { style: { flex: 1, backgroundColor: '#000b', justifyContent: 'center' }, children: _jsx(KeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : 'height', style: { maxHeight: '90%' }, children: _jsx(ScrollView, { testID: testID, keyboardShouldPersistTaps: 'handled', contentContainerStyle: { padding: 24, backgroundColor: colors.surface, borderRadius: 14 }, children: _jsxs(Stack, { children: [_jsx(Heading, { ref: heading, children: title }), description !== undefined && _jsx(Text, { children: description }), children, _jsx(Button, { intent: 'secondary', suppressFeedback: true, onPress: () => onOpenChange(false), children: closeLabel ?? messages.close ?? en.close })] }) }) }) }) });
53
+ focusNative(initialFocusRef?.current ?? (contentMode === 'custom' ? titleRef?.current : null) ?? heading.current); }, onDismiss: restoreFocus, onRequestClose: () => onOpenChange(false), accessibilityViewIsModal: true, children: contentMode === 'custom' ? _jsxs(Stage, { style: [{ flex: 1, backgroundColor: '#000b', justifyContent: 'center', direction }, stageStyle], testID: stageTestID, children: [backdrop, _jsxs(View, { accessible: false, accessibilityLabel: title, accessibilityViewIsModal: true, onAccessibilityEscape: () => onOpenChange(false), collapsable: false, style: [{ direction }, contentStyle], testID: testID, children: [!titleRef && _jsx(Heading, { ref: heading, accessible: true, accessibilityLabel: title, style: { position: 'absolute', width: 1, height: 1, overflow: 'hidden' }, children: title }), _jsx(Raised, { children: children })] })] }) : _jsx(SafeAreaView, { style: { flex: 1, backgroundColor: '#000b', justifyContent: 'center' }, children: _jsx(KeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : 'height', style: { maxHeight: '90%' }, children: _jsx(ScrollView, { testID: testID, keyboardShouldPersistTaps: 'handled', contentContainerStyle: { padding: 24, backgroundColor: colors.overlay, borderRadius: 14, boxShadow: '0 16px 48px #0008' }, children: _jsx(Raised, { children: _jsxs(Stack, { children: [_jsx(Heading, { ref: heading, children: title }), description !== undefined && _jsx(Text, { children: description }), children, _jsx(Button, { intent: 'secondary', suppressFeedback: true, style: { marginTop: 4 }, onPress: () => onOpenChange(false), children: closeLabel ?? messages.close ?? en.close })] }) }) }) }) }) });
54
54
  return modal;
55
55
  }
56
56
  export const Sheet = Dialog;
@@ -0,0 +1,54 @@
1
+ import React from 'react';
2
+ import { type StyleProp, type ViewStyle } from 'react-native';
3
+ import { type SwapChain, type SwapToken, type SwapWallet } from './swap-shared.js';
4
+ export type { SwapChain, SwapToken, SwapWallet } from './swap-shared.js';
5
+ /** The searchable token list both pickers share. */
6
+ export interface PickerListProps {
7
+ /** Tokens offered: a wallet's holdings, a whitelist, or a whole catalog. */
8
+ tokens: readonly SwapToken[];
9
+ /** Chain filter options. Derived from the tokens, in first-seen order, when omitted. */
10
+ chains?: readonly SwapChain[];
11
+ /** `false` leaves out the chain filter, for a list on one chain or one that should not be narrowed by chain. */
12
+ chainFilter?: boolean;
13
+ /** Token ids for a Hot section at the top of the unfiltered list, in rank order. */
14
+ hotTokenIds?: readonly string[];
15
+ selected?: SwapToken | null;
16
+ onSelect: (token: SwapToken) => void;
17
+ /** Shows the loading text in place of the empty text while the list is empty. */
18
+ loading?: boolean;
19
+ /** Web only: focuses the search with a hardware pointer. Native never raises the keyboard on mount. */
20
+ autoFocus?: boolean;
21
+ }
22
+ export interface FromPickerProps extends PickerListProps {
23
+ /** The connected wallet. Omit for a list with no wallet row at all. */
24
+ wallet?: SwapWallet;
25
+ /** Shows Connect wallet while no wallet is connected. */
26
+ onConnect?: () => void;
27
+ /** Shows the disconnect button beside a connected wallet. Omit it where signing out does not belong. */
28
+ onDisconnect?: () => void;
29
+ /** The Generate address switch, offered while no wallet is connected: the user picks a chain and an asset and the host shows an address to send it to. Omit `onGenerateAddressChange` to hide it. */
30
+ generateAddress?: boolean;
31
+ onGenerateAddressChange?: (generate: boolean) => void;
32
+ style?: StyleProp<ViewStyle>;
33
+ }
34
+ /**
35
+ * Where the assets come from. A connected wallet shows its address, with a disconnect button the host can leave out, above
36
+ * the tokens it holds (or a whitelist). With no wallet it offers Connect wallet and a Generate address switch above the list.
37
+ * The host owns the wallet, the token data and the generated address.
38
+ */
39
+ export declare function FromPicker({ wallet, onConnect, onDisconnect, generateAddress, onGenerateAddressChange, style, ...list }: FromPickerProps): React.JSX.Element;
40
+ export interface ToPickerProps extends Partial<PickerListProps> {
41
+ /** The destination address field. Omit `onAddressChange` to hide it. */
42
+ address?: string;
43
+ onAddressChange?: (address: string) => void;
44
+ /** Shown while the field is empty, for example the connected wallet shortened; defaults to the built-in label. */
45
+ addressPlaceholder?: string;
46
+ /** Shows the scan button. HIG ships no scanner: the host opens its own and writes the result to `address`. */
47
+ onScan?: () => void;
48
+ style?: StyleProp<ViewStyle>;
49
+ }
50
+ /**
51
+ * Where the assets go. On its own it is a destination address field with a scan button. With `tokens` it adds the
52
+ * searchable token list, with the chain filter or, with `chainFilter={false}`, without it.
53
+ */
54
+ export declare function ToPicker({ address, onAddressChange, addressPlaceholder, onScan, style, tokens, onSelect, ...list }: ToPickerProps): React.JSX.Element;
@@ -0,0 +1,60 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useContext, useMemo, useState } from 'react';
3
+ import { FlatList, Pressable, View, useWindowDimensions } from 'react-native';
4
+ import { formatNumber } from '@bloxwap/hig/contracts';
5
+ import { useColors, useFills, useHIG, useMessages } from './provider.js';
6
+ import { Text } from './surface.js';
7
+ import { Button, IconButton } from './button.js';
8
+ import { Input, SearchInput } from './field.js';
9
+ import { Filter } from './radio-group.js';
10
+ import { SwitchRow } from './switch-row.js';
11
+ import { LeaveIcon, LockIcon, ScanIcon, SwapHostContext, TokenIcon, WalletIcon } from './swap-parts.js';
12
+ import { addressColor, pickerRows, shortAddress } from './swap-shared.js';
13
+ /** Chains present in a token list, in first-seen order. */
14
+ function chainsOf(tokens) { const seen = new Map(); for (const token of tokens)
15
+ if (!seen.has(token.chainId))
16
+ seen.set(token.chainId, { chainId: token.chainId, name: token.chain, icon: token.chainIcon }); return [...seen.values()]; }
17
+ function TokenList({ tokens, chains, chainFilter = true, hotTokenIds, selected = null, onSelect, loading, side, title }) {
18
+ const { locale, direction } = useHIG();
19
+ const colors = useColors();
20
+ const fills = useFills();
21
+ const t = useMessages();
22
+ const window = useWindowDimensions();
23
+ // A sheet passes its backend's list through the host context so drags hand off to the sheet.
24
+ const List = useContext(SwapHostContext).listComponent ?? FlatList;
25
+ const [query, setQuery] = useState('');
26
+ const [chain, pickChain] = useState('');
27
+ const options = useMemo(() => chains ?? chainsOf(tokens), [chains, tokens]);
28
+ // The filter speaks in strings; an empty value is every chain.
29
+ const chainId = chain === '' ? null : options.find(item => String(item.chainId) === chain)?.chainId ?? null;
30
+ const { rows, hotCount } = useMemo(() => pickerRows(tokens, query, chainId, hotTokenIds), [tokens, hotTokenIds, query, chainId]);
31
+ const section = (heading) => _jsx(Text, { accessibilityRole: 'header', style: { paddingHorizontal: 8, paddingTop: 12, paddingBottom: 6, fontSize: 12, lineHeight: 18, fontWeight: '600', letterSpacing: 1, textTransform: 'uppercase', color: colors.muted }, children: heading });
32
+ const chainOptions = useMemo(() => [{ value: '', label: t.swapAllChains }, ...options.map(item => ({ value: String(item.chainId), label: item.name, icon: item.icon }))], [options, t.swapAllChains]);
33
+ const empty = _jsx(Text, { accessibilityLiveRegion: 'polite', testID: `swap-empty-${side}`, style: { paddingVertical: 32, textAlign: 'center', fontSize: 14, lineHeight: 21, color: colors.muted }, children: loading ? `${t.loading}…` : t.swapNoTokens });
34
+ return _jsxs(_Fragment, { children: [_jsx(SearchInput, { accessibilityLabel: t.swapSearchTokens, placeholder: t.swapSearchTokens, testID: `swap-search-${side}`, value: query, onChangeText: setQuery, autoCapitalize: 'none', autoCorrect: false, autoComplete: 'off', spellCheck: false }), chainFilter && options.length > 1 ? _jsx(Filter, { label: t.swapChains, options: chainOptions, value: chain, onValueChange: pickChain }) : null, _jsx(List, { style: { height: Math.max(240, Math.round(window.height * 0.5)) }, data: rows, keyExtractor: token => token.id, keyboardShouldPersistTaps: 'handled', accessibilityLabel: title, testID: `swap-list-${side}`, initialNumToRender: 12, ListEmptyComponent: empty, renderItem: ({ item: token, index }) => {
35
+ const isSelected = selected?.id === token.id, balance = token.balance ?? 0, price = token.price ?? 0;
36
+ return _jsxs(View, { children: [hotCount > 0 && index === 0 ? section(t.swapHot) : null, hotCount > 0 && index === hotCount ? section(t.swapAllTokens) : null, _jsxs(Pressable, { accessibilityRole: 'button', accessibilityState: { selected: isSelected }, testID: `swap-token-${token.id}`, onPress: () => onSelect(token), style: ({ pressed }) => ({ direction, flexDirection: 'row', alignItems: 'center', gap: 12, marginBottom: 4, paddingVertical: 8, paddingStart: 8, paddingEnd: 16, borderRadius: 9999, backgroundColor: pressed ? fills.well : 'transparent', opacity: isSelected ? 0.5 : 1 }), children: [_jsx(TokenIcon, { token: token }), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: token.name }), _jsxs(Text, { style: { fontSize: 14, lineHeight: 21, color: colors.muted }, children: [token.chain, isSelected ? ` · ${t.swapSelected}` : ''] })] }), balance > 0 ? _jsxs(View, { style: { alignItems: 'flex-end' }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: formatNumber(balance, locale, { maximumFractionDigits: 6 }) }), price > 0 ? _jsx(Text, { style: { fontSize: 14, lineHeight: 21, color: colors.muted }, children: formatNumber(balance * price, locale, { style: 'currency', currency: 'USD' }) }) : null] }) : null] })] });
37
+ } })] });
38
+ }
39
+ /**
40
+ * Where the assets come from. A connected wallet shows its address, with a disconnect button the host can leave out, above
41
+ * the tokens it holds (or a whitelist). With no wallet it offers Connect wallet and a Generate address switch above the list.
42
+ * The host owns the wallet, the token data and the generated address.
43
+ */
44
+ export function FromPicker({ wallet, onConnect, onDisconnect, generateAddress = false, onGenerateAddressChange, style, ...list }) {
45
+ const colors = useColors();
46
+ const fills = useFills();
47
+ const t = useMessages();
48
+ return _jsxs(View, { accessibilityLabel: t.swapFrom, testID: 'from-picker', style: [{ gap: 16 }, style], children: [wallet?.connected ?
49
+ _jsxs(View, { testID: 'picker-wallet', style: { flexDirection: 'row', alignItems: 'stretch', gap: 8 }, children: [_jsxs(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'center', gap: 12, minHeight: 48, paddingVertical: 8, paddingHorizontal: 16, borderRadius: 9999, backgroundColor: fills.well }, children: [_jsx(View, { style: { width: 28, height: 28, borderRadius: 14, backgroundColor: addressColor(wallet.address ?? '') } }), _jsx(Text, { numberOfLines: 1, style: { flex: 1, fontWeight: '600' }, children: wallet.address ? shortAddress(wallet.address) : '' }), _jsx(LockIcon, { color: colors.muted })] }), onDisconnect ? _jsx(IconButton, { intent: 'secondary', label: t.swapDisconnect, testID: 'picker-disconnect', onPress: onDisconnect, style: { minWidth: 48, minHeight: 48 }, children: _jsx(LeaveIcon, { color: colors.text }) }) : null] })
50
+ : wallet && (onConnect || onGenerateAddressChange) ? _jsxs(View, { testID: 'picker-connect-row', style: { flexDirection: 'row', alignItems: 'stretch', gap: 8 }, children: [onConnect ? _jsxs(Button, { testID: 'picker-connect', onPress: onConnect, style: { flex: 1, alignSelf: 'auto' }, children: [_jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', children: _jsx(WalletIcon, { color: colors.onAction }) }, 'icon'), t.swapConnectWallet] }) : null, onGenerateAddressChange ? _jsx(SwitchRow, { label: t.swapGenerateAddress, checked: generateAddress, onCheckedChange: onGenerateAddressChange, testID: 'picker-generate', style: { flex: onConnect ? undefined : 1, minHeight: 44, alignItems: 'center', paddingStart: 16, paddingEnd: 12, borderRadius: 9999, backgroundColor: fills.well }, children: _jsxs(View, { style: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', gap: 12 }, children: [_jsx(Text, { numberOfLines: 1, style: { fontWeight: '500' }, children: t.swapGenerateAddress }), _jsx(View, { style: { width: 40, height: 24, borderRadius: 12, padding: 3, backgroundColor: generateAddress ? colors.action : colors.border, alignItems: generateAddress ? 'flex-end' : 'flex-start' }, children: _jsx(View, { style: { width: 18, height: 18, borderRadius: 9, backgroundColor: generateAddress ? colors.onAction : colors.text } }) })] }) }) : null] }) : null, _jsx(TokenList, { ...list, side: 'from', title: t.swapFrom })] });
51
+ }
52
+ /**
53
+ * Where the assets go. On its own it is a destination address field with a scan button. With `tokens` it adds the
54
+ * searchable token list, with the chain filter or, with `chainFilter={false}`, without it.
55
+ */
56
+ export function ToPicker({ address, onAddressChange, addressPlaceholder, onScan, style, tokens, onSelect, ...list }) {
57
+ const colors = useColors();
58
+ const t = useMessages();
59
+ return _jsxs(View, { accessibilityLabel: t.swapTo, testID: 'to-picker', style: [{ gap: 16 }, style], children: [onAddressChange ? _jsxs(View, { testID: 'picker-address-row', style: { flexDirection: 'row', alignItems: 'center', gap: 8 }, children: [_jsx(View, { style: { flex: 1 }, children: _jsx(Input, { accessibilityLabel: t.swapRecipient, placeholder: addressPlaceholder ?? t.swapRecipient, testID: 'picker-address', value: address ?? '', onChangeText: onAddressChange, autoCapitalize: 'none', autoCorrect: false, autoComplete: 'off', spellCheck: false }) }), onScan ? _jsx(IconButton, { intent: 'secondary', label: t.swapScan, testID: 'picker-scan', onPress: onScan, style: { minWidth: 48, minHeight: 48 }, children: _jsx(ScanIcon, { color: colors.text }) }) : null] }) : null, tokens && onSelect ? _jsx(TokenList, { ...list, tokens: tokens, onSelect: onSelect, side: 'to', title: t.swapTo }) : null] });
60
+ }
@@ -8,14 +8,24 @@ export type { HIGMessages } from '@bloxwap/hig/contracts/messages';
8
8
  export { localeDirection, type HostLocale } from '@bloxwap/hig/contracts';
9
9
  /** Colour space the host paints React Native colours in. `display-p3` is for iOS hosts whose React Native default colour space is Display P3 (an app delegate `defaultColorSpace()` override); there HIG paints its generated `nativeDisplayP3` table (`nativeColors.iosDisplayP3`). Android and web stay sRGB, because HIG publishes no other table for them. */
10
10
  export type HIGColorSpace = 'srgb' | 'display-p3';
11
+ /** Roles of HIG's generated colour tables (`colorTable`). */
12
+ export type HIGTableColorRole = keyof typeof nativeSrgb;
13
+ /** Market-direction roles: `up` (rising, long, gain) and `down` (falling, short, loss). They default to `buy` and `sell`; `HIGProvider marketColors` overrides them. */
14
+ export type HIGMarketColorRole = 'up' | 'down';
11
15
  /** Semantic token roles every native component paints from. */
12
- export type HIGColorRole = keyof typeof nativeSrgb;
13
- /** Native colour roles, including any provider primary colour override. */
16
+ export type HIGColorRole = HIGTableColorRole | HIGMarketColorRole;
17
+ /** Native colour roles, including any provider primary colour and market colour override. */
14
18
  export type HIGColors = Readonly<Record<HIGColorRole, string>>;
19
+ /** Host colours for the market-direction roles, in the provider's colour space (for example `#rrggbb` Display P3 channels on an iOS P3 host). An omitted role keeps `buy`/`sell`. */
20
+ export interface HIGMarketColors {
21
+ up?: string;
22
+ down?: string;
23
+ }
15
24
  /** HIG's table for a colour space and platform: `nativeDisplayP3` for `display-p3` on iOS, sRGB everywhere else (including unknown values from untyped JS). */
16
- export declare function colorTable(colorSpace?: HIGColorSpace, os?: string): HIGColors;
25
+ export declare function colorTable(colorSpace?: HIGColorSpace, os?: string): Readonly<Record<HIGTableColorRole, string>>;
17
26
  export interface HIGContext extends Environment {
18
- primaryColor?: string;
27
+ primaryColor?: string; /** Market-direction colours for `up`/`down`; inherited by nested providers, like `primaryColor`. */
28
+ marketColors?: HIGMarketColors;
19
29
  onAccepted?: (id: string) => void;
20
30
  feedback?: FeedbackSink;
21
31
  fontFamily?: string;
@@ -32,12 +42,21 @@ export interface HIGProviderProps extends Partial<Omit<HIGContext, 'messages'>>
32
42
  messages?: Partial<HIGMessages>;
33
43
  }
34
44
  /** Direction defaults to the OS layout direction (I18nManager) so HIG roots never force LTR inside an RTL app. React Native 0.83 Android does not report a per-app RTL locale through I18nManager (#86): RTL hosts pass `direction={localeDirection(getLocales()[0])}`. Hosts that disallow RTL leave `direction` unset. */
35
- export declare function HIGProvider({ children, density, locale, direction, reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, messages }: React.PropsWithChildren<HIGProviderProps>): React.JSX.Element;
45
+ export declare function HIGProvider({ children, density, locale, direction, reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, marketColors, messages }: React.PropsWithChildren<HIGProviderProps>): React.JSX.Element;
36
46
  export declare const useHIG: () => HIGContext;
47
+ /** Marks content that sits on a Surface, Dialog or sheet. HIG has no resting strokes, so wells inside step up one fill to stay visible. */
48
+ export declare function Raised({ children }: React.PropsWithChildren): React.JSX.Element;
49
+ /** Fills for the current elevation: `well` for inputs, tracks and neutral chips; `raised` for what sits on a well (a selected segment). On the page they are `surface` and `nested`; inside a Surface, Dialog or sheet, `nested` and `border`. */
50
+ export declare function useFills(): {
51
+ well: string;
52
+ raised: string;
53
+ };
37
54
  /** The nearest HIGProvider's colour table (sRGB by default). Every HIG native component paints through this; hosts may read it for their own views. */
38
55
  export declare function useColors(): HIGColors;
39
56
  /** Approved Bloxwap brand colours in the host's colour space, independent of a product accent. */
40
- export declare function useBrandColors(): HIGColors;
57
+ /** The colour space this subtree actually paints in: `display-p3` only when a provider asked for it on iOS, as in `colorTable`; otherwise `srgb`. */
58
+ export declare function useColorSpace(): HIGColorSpace;
59
+ export declare function useBrandColors(): Readonly<Record<HIGTableColorRole, string>>;
41
60
  /** Complete built-in copy for the nearest HIGProvider: host translations over the English defaults. */
42
61
  export declare function useMessages(): HIGMessages;
43
62
  export declare function useControllable<T>(value: T | undefined, initial: T, onChange?: (value: T) => void, intent?: FeedbackIntent): [T, (next: T) => void];