@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
@@ -9,9 +9,14 @@ export { localeDirection } from '@bloxwap/hig/contracts';
9
9
  /** HIG's table for a colour space and platform: `nativeDisplayP3` for `display-p3` on iOS, sRGB everywhere else (including unknown values from untyped JS). */
10
10
  export function colorTable(colorSpace, os = Platform.OS) { return colorSpace === 'display-p3' && os === 'ios' ? nativeDisplayP3 : nativeSrgb; }
11
11
  const Context = createContext({ ...defaultEnvironment, direction: I18nManager.isRTL ? 'rtl' : 'ltr', colorSpace: 'srgb', messages: {} });
12
- const ColorsContext = createContext(nativeSrgb);
12
+ /** Market-direction roles default to `buy`/`sell`; a host whose convention differs (KRX, A-share) overrides them through `HIGProvider marketColors`. */
13
+ function withMarketRoles(table, up, down) { return { ...table, up: up ?? table.buy, down: down ?? table.sell }; }
14
+ const marketColor = (value) => typeof value === 'string' && value !== '' ? value : undefined;
15
+ // Providers without an accent or market override share one table per colour space, so their colours keep a stable identity.
16
+ const srgbColors = withMarketRoles(nativeSrgb), displayP3Colors = withMarketRoles(nativeDisplayP3);
17
+ const ColorsContext = createContext(srgbColors);
13
18
  /** 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. */
14
- export function HIGProvider({ children, density = 'comfortable', locale = 'en-US', direction = I18nManager.isRTL ? 'rtl' : 'ltr', reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, messages }) {
19
+ export function HIGProvider({ children, density = 'comfortable', locale = 'en-US', direction = I18nManager.isRTL ? 'rtl' : 'ltr', reducedMotion, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace, primaryColor, marketColors, messages }) {
15
20
  const parent = useContext(Context);
16
21
  const inherited = parent.messages;
17
22
  const resolved = useMemo(() => resolveMessages(inherited, messages), [inherited, messages]);
@@ -19,16 +24,26 @@ export function HIGProvider({ children, density = 'comfortable', locale = 'en-US
19
24
  const normalized = useMemo(() => accent === undefined ? undefined : resolvePrimaryColor(accent).action, [accent]);
20
25
  const space = colorSpace ?? parent.colorSpace;
21
26
  const baseColors = colorTable(space);
22
- const colors = useMemo(() => normalized === undefined ? baseColors : { ...baseColors, ...resolvePrimaryColor(normalized, space === 'display-p3' && Platform.OS === 'ios' ? 'display-p3' : 'srgb') }, [baseColors, space, normalized]);
27
+ const market = marketColors ?? parent.marketColors;
28
+ const marketUp = marketColor(market?.up), marketDown = marketColor(market?.down);
29
+ const inheritedMarket = useMemo(() => marketUp === undefined && marketDown === undefined ? undefined : { up: marketUp, down: marketDown }, [marketUp, marketDown]);
30
+ const colors = useMemo(() => normalized === undefined && marketUp === undefined && marketDown === undefined ? baseColors === nativeDisplayP3 ? displayP3Colors : srgbColors : withMarketRoles(normalized === undefined ? baseColors : { ...baseColors, ...resolvePrimaryColor(normalized, space === 'display-p3' && Platform.OS === 'ios' ? 'display-p3' : 'srgb') }, marketUp, marketDown), [baseColors, space, normalized, marketUp, marketDown]);
23
31
  const [osReduced, setOSReduced] = useState(false);
24
32
  useEffect(() => { let alive = true; void AccessibilityInfo.isReduceMotionEnabled().then(v => { if (alive)
25
33
  setOSReduced(v); }).catch(() => { }); const sub = AccessibilityInfo.addEventListener('reduceMotionChanged', setOSReduced); return () => { alive = false; sub.remove(); }; }, []);
26
- return _jsx(Context.Provider, { value: { density, locale, direction, reducedMotion: reducedMotion ?? osReduced, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript: fontFamiliesByScript ?? parent.fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace: space, primaryColor: normalized, messages: resolved }, children: _jsx(ColorsContext.Provider, { value: colors, children: children }) });
34
+ return _jsx(Context.Provider, { value: { density, locale, direction, reducedMotion: reducedMotion ?? osReduced, onAccepted, feedback, fontFamily, fontFamilies, fontFamiliesByScript: fontFamiliesByScript ?? parent.fontFamiliesByScript, monoFontFamily, maxFontSizeMultiplier, letterSpacingByScript, colorSpace: space, primaryColor: normalized, marketColors: inheritedMarket, messages: resolved }, children: _jsx(ColorsContext.Provider, { value: colors, children: children }) });
27
35
  }
28
36
  export const useHIG = () => useContext(Context);
37
+ const RaisedContext = createContext(false);
38
+ /** 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. */
39
+ export function Raised({ children }) { return _jsx(RaisedContext.Provider, { value: true, children: children }); }
40
+ /** 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`. */
41
+ export function useFills() { const colors = useContext(ColorsContext); return useContext(RaisedContext) ? { well: colors.nested, raised: colors.border } : { well: colors.surface, raised: colors.nested }; }
29
42
  /** The nearest HIGProvider's colour table (sRGB by default). Every HIG native component paints through this; hosts may read it for their own views. */
30
43
  export function useColors() { return useContext(ColorsContext); }
31
44
  /** Approved Bloxwap brand colours in the host's colour space, independent of a product accent. */
45
+ /** The colour space this subtree actually paints in: `display-p3` only when a provider asked for it on iOS, as in `colorTable`; otherwise `srgb`. */
46
+ export function useColorSpace() { return useContext(Context).colorSpace === 'display-p3' && Platform.OS === 'ios' ? 'display-p3' : 'srgb'; }
32
47
  export function useBrandColors() { return colorTable(useContext(Context).colorSpace); }
33
48
  /** Complete built-in copy for the nearest HIGProvider: host translations over the English defaults. */
34
49
  export function useMessages() { const overrides = useContext(Context).messages; return useMemo(() => resolveMessages({ ...defaultMessages }, overrides), [overrides]); }
@@ -1,5 +1,21 @@
1
1
  import React from 'react';
2
2
  import type { ChoicesProps } from './selection-types.js';
3
3
  export declare function RadioGroup({ label, options, value, defaultValue, disabled, onValueChange }: ChoicesProps): React.JSX.Element;
4
- /** Equal-width choices with one interruptible selection indicator. */
4
+ /** Equal-width choices with one interruptible selection indicator. The track is the dark well and the selected segment the lighter fill; the control is 44dp tall (36 compact). */
5
5
  export declare function SegmentedControl({ label, options, value, defaultValue, disabled, onValueChange }: ChoicesProps): React.JSX.Element;
6
+ export interface FilterOption {
7
+ value: string;
8
+ label: string;
9
+ disabled?: boolean; /** Image URL shown in the option's circle until it is selected. */
10
+ icon?: string;
11
+ }
12
+ export interface FilterProps {
13
+ label: string;
14
+ options: readonly FilterOption[];
15
+ value?: string;
16
+ defaultValue?: string;
17
+ disabled?: boolean;
18
+ onValueChange?: (value: string) => void;
19
+ }
20
+ /** A horizontal, scrolling row of single-choice filter chips. The selected chip inverts and its circle shows a check that animates in. */
21
+ export declare function Filter({ label, options, value, defaultValue, disabled, onValueChange }: FilterProps): React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useLayoutEffect, useRef, useState } from 'react';
3
- import { Animated, Easing, Platform, Pressable, View } from 'react-native';
2
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
3
+ import { Animated, Easing, Image, Platform, Pressable, ScrollView, View } from 'react-native';
4
4
  import { tokens } from '@bloxwap/hig/tokens';
5
- import { useControllable, useColors, useHIG } from './provider.js';
5
+ import { useControllable, useColors, useFills, useHIG } from './provider.js';
6
6
  import { Text } from './surface.js';
7
7
  export function RadioGroup({ label, options, value, defaultValue = '', disabled, onValueChange }) {
8
8
  const [current, set] = useControllable(value, defaultValue, onValueChange);
@@ -16,11 +16,15 @@ export function RadioGroup({ label, options, value, defaultValue = '', disabled,
16
16
  activate(); }, style: { minHeight: 48, paddingVertical: 12, flexDirection: 'row', alignItems: 'center', gap: 12, opacity: blocked ? 0.5 : 1 }, children: [_jsx(Text, { accessible: false, children: current === o.value ? '●' : '○' }), _jsxs(View, { style: { flex: 1 }, children: [_jsx(Text, { accessible: false, accessibilityLanguage: o.lang, children: o.label }), o.description !== undefined && _jsx(Text, { accessible: false, accessibilityLanguage: locale, style: { color: colors.muted, fontSize: 14, lineHeight: 20 }, children: o.description })] })] }, o.value);
17
17
  })] });
18
18
  }
19
- /** Equal-width choices with one interruptible selection indicator. */
19
+ /** Segments are 36dp inside a 44dp track; the slop restores a 48dp touch target. */
20
+ const segmentSlop = { top: 6, bottom: 6 };
21
+ /** Equal-width choices with one interruptible selection indicator. The track is the dark well and the selected segment the lighter fill; the control is 44dp tall (36 compact). */
20
22
  export function SegmentedControl({ label, options, value, defaultValue = '', disabled, onValueChange }) {
21
23
  const [current, set] = useControllable(value, defaultValue, onValueChange);
22
- const { direction, locale, reducedMotion } = useHIG();
24
+ const { direction, locale, reducedMotion, density } = useHIG();
23
25
  const colors = useColors();
26
+ const fills = useFills();
27
+ const compact = density === 'compact';
24
28
  const [width, setWidth] = useState(0);
25
29
  const translateX = useRef(new Animated.Value(0)).current;
26
30
  const selected = options.findIndex(option => option.value === current), count = options.length;
@@ -43,11 +47,45 @@ export function SegmentedControl({ label, options, value, defaultValue = '', dis
43
47
  animation.start();
44
48
  return () => animation.stop();
45
49
  }, [selected, width, count, direction, reducedMotion, target, translateX]);
46
- return _jsxs(View, { accessibilityRole: 'radiogroup', accessibilityLabel: label, style: { direction, gap: 8 }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: label }), _jsx(View, { style: { padding: 4, borderRadius: 9999, backgroundColor: colors.nested }, children: _jsxs(View, { onLayout: event => setWidth(event.nativeEvent.layout.width), style: { flexDirection: 'row', gap: 4 }, children: [selected >= 0 && width > 0 && _jsx(Animated.View, { pointerEvents: 'none', accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { position: 'absolute', ...anchor, top: 0, bottom: 0, width: segmentWidth, borderRadius: 9999, backgroundColor: colors.surface, opacity: disabled || options[selected].disabled ? 0.5 : 1, transform: [{ translateX }] } }), options.map(option => {
50
+ return _jsxs(View, { accessibilityRole: 'radiogroup', accessibilityLabel: label, style: { direction, gap: 8 }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: label }), _jsx(View, { style: { padding: 4, borderRadius: 9999, backgroundColor: fills.well }, children: _jsxs(View, { onLayout: event => setWidth(event.nativeEvent.layout.width), style: { flexDirection: 'row', gap: 4 }, children: [selected >= 0 && width > 0 && _jsx(Animated.View, { pointerEvents: 'none', accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { position: 'absolute', ...anchor, top: 0, bottom: 0, width: segmentWidth, borderRadius: 9999, backgroundColor: fills.raised, opacity: disabled || options[selected].disabled ? 0.5 : 1, transform: [{ translateX }] } }), options.map(option => {
47
51
  const checked = current === option.value, blocked = !!disabled || !!option.disabled;
48
52
  const activate = () => { if (!blocked)
49
53
  set(option.value); };
50
54
  return _jsxs(Pressable, { accessible: true, accessibilityRole: 'radio', accessibilityLabel: option.label, accessibilityHint: option.description, accessibilityLanguage: option.lang, "aria-checked": checked, "aria-disabled": blocked, accessibilityState: { checked, disabled: blocked }, accessibilityActions: [{ name: 'activate' }], disabled: blocked, onPress: activate, onAccessibilityAction: event => { if (event.nativeEvent.actionName === 'activate')
51
- activate(); }, style: { flex: 1, minWidth: 0, minHeight: 48, paddingHorizontal: 12, paddingVertical: 8, alignItems: 'stretch', justifyContent: 'center', borderRadius: 9999, opacity: blocked ? 0.5 : 1 }, children: [_jsx(Text, { accessible: false, accessibilityLanguage: option.lang, style: { color: checked ? colors.text : colors.muted, fontWeight: '500', textAlign: 'center' }, children: option.label }), option.description !== undefined && _jsx(Text, { accessible: false, accessibilityLanguage: locale, style: { color: colors.muted, fontSize: 14, lineHeight: 20, textAlign: 'center' }, children: option.description })] }, option.value);
55
+ activate(); }, hitSlop: segmentSlop, style: { flex: 1, minWidth: 0, minHeight: compact ? 28 : 36, paddingHorizontal: 12, paddingVertical: compact ? 2 : 4, alignItems: 'stretch', justifyContent: 'center', borderRadius: 9999, opacity: blocked ? 0.5 : 1 }, children: [_jsx(Text, { accessible: false, accessibilityLanguage: option.lang, style: { color: checked ? colors.text : colors.muted, fontWeight: '500', textAlign: 'center' }, children: option.label }), option.description !== undefined && _jsx(Text, { accessible: false, accessibilityLanguage: locale, style: { color: colors.muted, fontSize: 14, lineHeight: 20, textAlign: 'center' }, children: option.description })] }, option.value);
52
56
  })] }) })] });
53
57
  }
58
+ /** Chips are 40dp; the slop restores a 44dp touch target. */
59
+ const filterSlop = { top: 2, bottom: 2 };
60
+ const hiddenMark = { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', pointerEvents: 'none' };
61
+ /** One chip. Its circle holds the option's icon or an empty ring; when the chip is selected the circle fills and a check settles in, and deselecting reverses it. */
62
+ function FilterChip({ option, checked, blocked, reducedMotion, onSelect }) {
63
+ const colors = useColors();
64
+ const fills = useFills();
65
+ const progress = useRef(new Animated.Value(checked ? 1 : 0)).current;
66
+ const first = useRef(true);
67
+ useEffect(() => {
68
+ const target = checked ? 1 : 0;
69
+ // The first render and reduced motion show the final state at once.
70
+ if (first.current || reducedMotion) {
71
+ first.current = false;
72
+ progress.stopAnimation();
73
+ progress.setValue(target);
74
+ return;
75
+ }
76
+ const animation = Animated.timing(progress, { toValue: target, duration: 220, easing: Easing.bezier(...tokens.easing.standard), useNativeDriver: Platform.OS !== 'web', isInteraction: false });
77
+ animation.start();
78
+ return () => animation.stop();
79
+ }, [checked, reducedMotion, progress]);
80
+ const ink = checked ? colors.background : colors.text;
81
+ const activate = () => { if (!blocked)
82
+ onSelect(); };
83
+ return _jsxs(Pressable, { accessible: true, accessibilityRole: 'radio', accessibilityLabel: option.label, "aria-checked": checked, "aria-disabled": blocked, accessibilityState: { checked, disabled: blocked }, accessibilityActions: [{ name: 'activate' }], disabled: blocked, onPress: activate, onAccessibilityAction: event => { if (event.nativeEvent.actionName === 'activate')
84
+ activate(); }, hitSlop: filterSlop, style: state => ({ flexDirection: 'row', alignItems: 'center', gap: 8, minHeight: 40, paddingVertical: 6, paddingStart: 8, paddingEnd: 16, borderRadius: 9999, backgroundColor: checked ? colors.text : state.pressed ? fills.raised : fills.well, opacity: blocked ? 0.5 : 1 }), children: [_jsxs(View, { ...hiddenMark, style: { width: 24, height: 24, borderRadius: 12, overflow: 'hidden', alignItems: 'center', justifyContent: 'center' }, children: [option.icon ? _jsx(Image, { source: { uri: option.icon }, accessible: false, style: { position: 'absolute', width: 24, height: 24, borderRadius: 12 } }) : _jsx(View, { style: { position: 'absolute', width: 24, height: 24, borderRadius: 12, borderWidth: 2, borderColor: ink } }), _jsx(Animated.View, { style: { position: 'absolute', width: 24, height: 24, borderRadius: 12, backgroundColor: colors.background, opacity: progress } }), _jsx(Animated.View, { style: { opacity: progress, transform: [{ scale: progress.interpolate({ inputRange: [0, 1], outputRange: [0.4, 1] }) }] }, children: _jsx(View, { style: { width: 11, height: 6, borderLeftWidth: 2, borderBottomWidth: 2, borderColor: colors.text, transform: [{ translateY: -1.5 }, { rotate: '-45deg' }] } }) })] }), _jsx(Text, { accessible: false, style: { fontSize: 14, lineHeight: 21, fontWeight: '600', color: ink }, children: option.label })] });
85
+ }
86
+ /** A horizontal, scrolling row of single-choice filter chips. The selected chip inverts and its circle shows a check that animates in. */
87
+ export function Filter({ label, options, value, defaultValue = '', disabled, onValueChange }) {
88
+ const [current, set] = useControllable(value, defaultValue, onValueChange);
89
+ const { direction, reducedMotion } = useHIG();
90
+ return _jsx(ScrollView, { horizontal: true, showsHorizontalScrollIndicator: false, keyboardShouldPersistTaps: 'handled', accessibilityRole: 'radiogroup', accessibilityLabel: label, style: { flexGrow: 0, direction }, contentContainerStyle: { direction, gap: 8 }, children: options.map(option => _jsx(FilterChip, { option: option, checked: current === option.value, blocked: !!disabled || !!option.disabled, reducedMotion: !!reducedMotion, onSelect: () => set(option.value) }, option.value)) });
91
+ }
@@ -20,6 +20,7 @@ export declare function TradeEntry({ asset, amount, onAmountChange, onConfirm, b
20
20
  error?: string;
21
21
  available: string;
22
22
  }): React.JSX.Element;
23
+ /** A copy outcome shows as a transient toast capsule (about 4s, dismissible) and is announced the way Toast announces any notice. */
23
24
  export declare function InstallCommand({ command, onCopy }: {
24
25
  command: string;
25
26
  onCopy: () => Promise<void> | void;
@@ -40,3 +41,5 @@ export declare function ActivityList({ items }: {
40
41
  status: string;
41
42
  }[];
42
43
  }): React.JSX.Element;
44
+ export { FromPicker, ToPicker, type FromPickerProps, type ToPickerProps, type PickerListProps } from './pickers.js';
45
+ export { SwapPanel, swapAction, type SwapPanelProps, type SwapToken, type SwapChain, type SwapAction, type SwapDenomination, type SwapWallet, type SwapFee, type SwapReceive, type SwapDestination, type SwapDetail, type SwapView } from './swap-panel.js';
@@ -8,12 +8,25 @@ import { Surface, Stack, Heading, Text } from './surface.js';
8
8
  import { Field, AmountInput } from './field.js';
9
9
  import { Dialog } from './overlay.js';
10
10
  import { Row, Usd, Percent, List } from './data.js';
11
+ import { Toast, useTransientNotice } from './status.js';
11
12
  export function MarketRow({ symbol, name, price, change, onSelect }) { return _jsxs(Row, { children: [_jsxs(Button, { intent: 'ghost', onPress: onSelect, children: [name, " (", symbol, ")"] }), _jsx(Usd, { value: price }), _jsx(Percent, { value: change })] }); }
12
13
  export function BalanceCard({ label, balance, stale }) { const colors = useColors(); return _jsxs(Surface, { style: { gap: 8 }, children: [_jsx(Text, { style: { color: colors.muted, fontSize: 14, lineHeight: 21 }, children: label }), _jsx(Usd, { value: balance, stale: stale, style: { fontSize: 24, lineHeight: 30, fontWeight: '600' } })] }); }
13
- export function TradeEntry({ asset, amount, onAmountChange, onConfirm, busy, error, available }) { const { messages } = useHIG(); const [review, setReview] = useState(false); return _jsx(Surface, { children: _jsxs(Stack, { children: [_jsx(Heading, { children: (messages.reviewAssetOrder ?? en.reviewAssetOrder)(asset) }), _jsx(Field, { label: (messages.amountInAsset ?? en.amountInAsset)(asset), description: (messages.availableAmount ?? en.availableAmount)(available), error: error, children: _jsx(AmountInput, { value: amount, onChangeText: onAmountChange, editable: !busy }) }), _jsx(Button, { fullWidth: true, disabled: !amount || !!error, busy: busy, onPress: () => setReview(true), children: messages.reviewOrder ?? en.reviewOrder }), _jsxs(Dialog, { open: review, onOpenChange: setReview, title: messages.confirmOrder ?? en.confirmOrder, description: (messages.confirmOrderDescription ?? en.confirmOrderDescription)(amount, asset), children: [_jsx(Button, { busy: busy, disabled: !!error, onPress: onConfirm, children: messages.confirmOrder ?? en.confirmOrder }), error && _jsx(Text, { accessibilityLiveRegion: 'polite', children: error })] })] }) }); }
14
+ /** The call to action that closes a form sits a double step, 16dp, below it (the Stack gap is 12). */
15
+ const formAction = { marginTop: 4 };
16
+ /** In a dialog the confirm action is 16dp below the content and 8dp above the dialog's own closing button, which adds 4dp itself. */
17
+ const dialogAction = { marginTop: 4, marginBottom: -8 };
18
+ export function TradeEntry({ asset, amount, onAmountChange, onConfirm, busy, error, available }) { const { messages } = useHIG(); const [review, setReview] = useState(false); return _jsx(Surface, { children: _jsxs(Stack, { children: [_jsx(Heading, { children: (messages.reviewAssetOrder ?? en.reviewAssetOrder)(asset) }), _jsx(Field, { label: (messages.amountInAsset ?? en.amountInAsset)(asset), description: (messages.availableAmount ?? en.availableAmount)(available), error: error, children: _jsx(AmountInput, { value: amount, onChangeText: onAmountChange, editable: !busy }) }), _jsx(Button, { fullWidth: true, style: formAction, disabled: !amount || !!error, busy: busy, onPress: () => setReview(true), children: messages.reviewOrder ?? en.reviewOrder }), _jsxs(Dialog, { open: review, onOpenChange: setReview, title: messages.confirmOrder ?? en.confirmOrder, description: (messages.confirmOrderDescription ?? en.confirmOrderDescription)(amount, asset), children: [_jsx(Button, { busy: busy, disabled: !!error, style: dialogAction, onPress: onConfirm, children: messages.confirmOrder ?? en.confirmOrder }), error && _jsx(Text, { accessibilityLiveRegion: 'polite', children: error })] })] }) }); }
14
19
  /** Code and commands stay monospace and left-to-right inside RTL roots. */
15
20
  function useCodeStyle() { const env = useHIG(); return { fontFamily: env.monoFontFamily ?? Platform.select({ ios: 'Menlo', default: 'monospace' }), writingDirection: 'ltr', textAlign: 'left' }; }
16
- export function InstallCommand({ command, onCopy }) { const { messages } = useHIG(); const [status, setStatus] = useState(''); const code = useCodeStyle(); return _jsxs(Surface, { children: [_jsx(Text, { selectable: true, style: code, children: command }), _jsx(Button, { intent: 'secondary', onPress: () => { Promise.resolve().then(onCopy).then(() => setStatus(messages.copied ?? en.copied)).catch(() => setStatus(messages.copyFailed ?? en.copyFailed)); }, children: messages.copyInstallCommand ?? en.copyInstallCommand }), _jsx(Text, { accessibilityLiveRegion: 'polite', accessibilityElementsHidden: !status, children: status })] }); }
21
+ /** A copy outcome shows as a transient toast capsule (about 4s, dismissible) and is announced the way Toast announces any notice. */
22
+ export function InstallCommand({ command, onCopy }) {
23
+ const { messages } = useHIG();
24
+ const { notice, show, dismiss } = useTransientNotice();
25
+ const code = useCodeStyle();
26
+ return _jsxs(Surface, { style: { gap: 12 }, children: [_jsx(Text, { selectable: true, style: code, children: command }), _jsx(Button, { intent: 'secondary', onPress: () => { Promise.resolve().then(onCopy).then(() => show(messages.copied ?? en.copied, 'success')).catch(() => show(messages.copyFailed ?? en.copyFailed, 'error')); }, children: messages.copyInstallCommand ?? en.copyInstallCommand }), notice && _jsx(Toast, { notices: [notice], onDismiss: dismiss })] });
27
+ }
17
28
  export function CodeWindow({ language, children }) { const code = useCodeStyle(); return _jsxs(Surface, { children: [_jsx(Text, { children: language }), _jsx(Text, { selectable: true, style: code, children: children })] }); }
18
29
  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 })] }); }
19
30
  export function ActivityList({ items }) { const { messages } = useHIG(); return _jsx(List, { items: items, keyFor: i => i.id, render: i => _jsxs(Row, { children: [_jsx(Text, { children: i.label }), _jsx(Text, { children: i.status })] }), empty: messages.noActivity ?? en.noActivity }); }
31
+ export { FromPicker, ToPicker } from './pickers.js';
32
+ export { SwapPanel, swapAction } from './swap-panel.js';
@@ -5,3 +5,4 @@ export { RadioGroup } from './radio-group.js';
5
5
  export { Select } from './select.js';
6
6
  export { Slider } from './slider.js';
7
7
  export { SegmentedControl } from './radio-group.js';
8
+ export { Filter, type FilterOption, type FilterProps } from './radio-group.js';
@@ -4,3 +4,4 @@ export { RadioGroup } from './radio-group.js';
4
4
  export { Select } from './select.js';
5
5
  export { Slider } from './slider.js';
6
6
  export { SegmentedControl } from './radio-group.js';
7
+ export { Filter } from './radio-group.js';
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { View, Platform, UIManager, requireNativeComponent } from 'react-native';
3
3
  import SliderBackend from '@react-native-community/slider';
4
4
  import * as en from '@bloxwap/hig/contracts/messages';
5
- import { useColors, useControllable, useHIG } from './provider.js';
5
+ import { useColors, useControllable, useFills, useHIG } from './provider.js';
6
6
  import { Text } from './surface.js';
7
7
  // RN maps accessibilityActions names to fixed or synthetic Android ids and drops action arguments, so a plain View
8
8
  // cannot offer ACTION_SET_PROGRESS. The package's autolinked HIGAdjustableView (android/) adds it and reports
@@ -12,6 +12,7 @@ export function Slider({ label, value, defaultValue = 0, min = 0, max = 100, ste
12
12
  const [current, set] = useControllable(value, defaultValue, onValueChange);
13
13
  const { messages } = useHIG();
14
14
  const colors = useColors();
15
+ const fills = useFills();
15
16
  // Explicit action labels (#87): RN 0.83 Android lists an unlabeled increment/decrement action with an empty label "".
16
17
  const actions = [{ name: 'increment', label: messages.increase ?? en.increase }, { name: 'decrement', label: messages.decrease ?? en.decrease }];
17
18
  // A plain 48dp adjustable View owns label/value/increment/decrement on iOS and Android and hides the backend:
@@ -36,6 +37,6 @@ export function Slider({ label, value, defaultValue = 0, min = 0, max = 100, ste
36
37
  const wrap = Platform.OS !== 'web';
37
38
  const Adjustable = AndroidAdjustable ?? View;
38
39
  const backend = _jsx(SliderBackend, { ...webProps, ...(wrap ? { accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants' } : semantics), minimumValue: min, maximumValue: max, step: step, value: current, disabled: disabled, onValueChange: next => { if (!disabled)
39
- set(next); }, minimumTrackTintColor: colors.action, maximumTrackTintColor: colors.border, thumbTintColor: colors.text, style: { minHeight: 48 } });
40
+ set(next); }, minimumTrackTintColor: colors.action, maximumTrackTintColor: fills.raised, thumbTintColor: colors.text, style: { minHeight: 48 } });
40
41
  return _jsxs(View, { children: [_jsxs(Text, { children: [label, ": ", current] }), wrap ? _jsx(Adjustable, { accessible: true, ...semantics, accessibilityActions: actions, onAccessibilityAction: adjust, style: { minHeight: 48, justifyContent: 'center' }, children: backend }) : backend] });
41
42
  }
@@ -10,10 +10,11 @@ declare const severityRole: {
10
10
  readonly warning: 'warning';
11
11
  readonly error: 'negative';
12
12
  };
13
- /** `note` and `tip` are documentation callout severities that reuse the info and positive token roles; `default` is the neutral variant (border stroke, soft white glow). */
13
+ /** `note` and `tip` are documentation callout severities that reuse the info and positive token roles; `default` is the neutral variant (a faint `text` tint, title in `text`). */
14
14
  export type AlertSeverity = keyof typeof severityRole | 'default';
15
+ /** Neutral chip in the dark well fill (one step lighter inside a Surface, Dialog or sheet). */
15
16
  export declare function Badge({ children }: React.PropsWithChildren): React.JSX.Element;
16
- /** Severity sets the glowing stroke from a token role (info/note → info, success/tip → positive, warning, error → negative, default → neutral border); `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. */
17
+ /** Severity tints the fill 10% and colours the title from a token role (info/note → info, success/tip → positive, warning, error → negative; default → 6% of `text`), with no stroke or glow; `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. */
17
18
  export declare function Alert({ title, children, severity, tone, action, announce }: React.PropsWithChildren<{
18
19
  title: React.ReactNode;
19
20
  severity?: AlertSeverity;
@@ -34,14 +35,20 @@ export interface Notice {
34
35
  export interface ToastProps {
35
36
  notices: readonly Notice[];
36
37
  onDismiss?: (id: string) => void;
37
- /** Dismiss button text; defaults to HIGProvider messages.dismiss. */
38
+ /** Dismiss wording inside the close control's accessible name; defaults to HIGProvider messages.dismiss. The control shows an x, not text. */
38
39
  dismissLabel?: string;
39
40
  /** Scroll viewport limit, in dp or a percentage of the parent. Defaults to 60% of the window height. */
40
41
  maxHeight?: DimensionValue;
41
42
  testID?: string;
42
43
  }
43
- /** Compact, scrollable notices remain visible until their host removes them. */
44
+ /** Each notice is one capsule row: severity symbol, message, optional action, then a close control. Compact, scrollable notices remain visible until their host removes them. */
44
45
  export declare function Toast({ notices, onDismiss, dismissLabel, maxHeight, testID }: ToastProps): React.JSX.Element;
46
+ /** One transient notice: shown for about four seconds, replaced by the next one, dismissible, and cleared on unmount. Render it with `Toast`, which announces it. */
47
+ export declare function useTransientNotice(duration?: number): {
48
+ notice: Notice | null;
49
+ show: (message: string, severity?: Notice['severity']) => void;
50
+ dismiss: () => void;
51
+ };
45
52
  export declare function Spinner({ label }: {
46
53
  label?: string;
47
54
  }): React.JSX.Element;
@@ -50,6 +57,7 @@ export declare function Progress({ label, value, max }: {
50
57
  value?: number;
51
58
  max?: number;
52
59
  }): React.JSX.Element;
60
+ /** Pulses while content is on its way; still with reduced motion. */
53
61
  export declare function Skeleton({ label }: {
54
62
  label?: string;
55
63
  }): React.JSX.Element;
@@ -57,18 +65,21 @@ export interface EmptyStateProps extends Omit<ViewProps, 'children'> {
57
65
  title: string;
58
66
  description?: string;
59
67
  action?: React.ReactNode;
60
- /** Decorative content, hidden from accessibility; the title and description supply its meaning. */
68
+ /** Decorative mark above the title, hidden from accessibility; the title and description supply its meaning. Omitted, a neutral outline icon shows; `null` shows none. */
61
69
  illustration?: React.ReactNode;
62
70
  titleStyle?: TextProps['style'];
63
71
  descriptionStyle?: TextProps['style'];
64
72
  /** Applies to both actual text nodes; omitted values retain the provider's scaling policy. */
65
73
  maxFontSizeMultiplier?: number;
66
74
  }
75
+ /** A strokeless card, centred: icon, title, optional description, then the action. */
67
76
  export declare function EmptyState({ title, description, action, illustration, titleStyle, descriptionStyle, maxFontSizeMultiplier, ...props }: EmptyStateProps): React.JSX.Element;
77
+ /** Initials sit on the dark well fill (one step lighter inside a Surface, Dialog or sheet). */
68
78
  export declare function Avatar({ name, source }: {
69
79
  name: string;
70
80
  source?: ImageSourcePropType;
71
81
  }): React.JSX.Element;
82
+ /** The dot carries the state colour. Online and stale emit a ring that grows and fades in that colour; offline and reduced motion stay still. */
72
83
  export declare function StatusIndicator({ label, state }: {
73
84
  label: string;
74
85
  state: 'online' | 'offline' | 'stale';
@@ -1,13 +1,14 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useRef, useState } from 'react';
3
+ import { tokens } from '@bloxwap/hig/tokens';
4
+ import { CloseIcon, EmptyIcon, SeverityIcon } from './icons.js';
3
5
  import { notificationDelta } from '@bloxwap/hig/contracts/announcements';
4
- import { ActivityIndicator, View, Image, ScrollView, useWindowDimensions, AccessibilityInfo, Platform } from 'react-native';
6
+ import { ActivityIndicator, Animated, Easing, View, Image, ScrollView, useWindowDimensions, AccessibilityInfo, Platform } from 'react-native';
5
7
  import { Text, Heading, Surface, Stack } from './surface.js';
6
8
  import { formatNumber } from '@bloxwap/hig/contracts';
7
9
  import { Button } from './button.js';
8
10
  import * as en from '@bloxwap/hig/contracts/messages';
9
- import { useColors, useHIG } from './provider.js';
10
- import { withAlpha } from '@bloxwap/hig/tokens';
11
+ import { useColors, useFills, useHIG } from './provider.js';
11
12
  import { blockText, plainText } from './text-content.js';
12
13
  import { roleColor } from './roles.js';
13
14
  const severityRole = { info: 'info', note: 'info', success: 'positive', tip: 'positive', warning: 'warning', error: 'negative' };
@@ -19,17 +20,26 @@ function speak(message, severity) { if (Platform.OS === 'web' || !message)
19
20
  AccessibilityInfo.announceForAccessibility(message);
20
21
  }
21
22
  catch { /* The visible message and navigable text remain available. */ } }
22
- export function Badge({ children }) { const colors = useColors(); return _jsx(Text, { style: { alignSelf: 'flex-start', maxWidth: '100%', backgroundColor: colors.nested, borderRadius: 9999, paddingVertical: 4, paddingHorizontal: 10 }, children: children }); }
23
- /** Severity sets the glowing stroke from a token role (info/note → info, success/tip → positive, warning, error → negative, default → neutral border); `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. */
24
- export function Alert({ title, children, severity = 'info', tone, action, announce = true }) { const colors = useColors(); const neutral = severity === 'default' && tone === undefined; const accent = neutral ? colors.border : roleColor(tone, severityRole[severity] ?? 'info', colors); const message = [plainText(title), blockText(children)].filter(Boolean).join('. '); const previous = useRef(''); useEffect(() => { const key = severity + message; if (announce && key !== previous.current) {
23
+ /** Neutral chip in the dark well fill (one step lighter inside a Surface, Dialog or sheet). */
24
+ export function Badge({ children }) { const fills = useFills(); return _jsx(Text, { style: { alignSelf: 'flex-start', maxWidth: '100%', backgroundColor: fills.well, overflow: 'hidden', borderRadius: 9999, paddingVertical: 4, paddingHorizontal: 10 }, children: children }); }
25
+ /** Opaque sRGB blend of `tone` into `base` (both `#rrggbb`): the native counterpart of CSS `color-mix`. */
26
+ const tint = (tone, base, amount) => '#' + [1, 3, 5].map(i => Math.round(parseInt(base.slice(i, i + 2), 16) * (1 - amount) + parseInt(tone.slice(i, i + 2), 16) * amount).toString(16).padStart(2, '0')).join('');
27
+ /** Severity tints the fill 10% and colours the title from a token role (info/note → info, success/tip → positive, warning, error → negative; default → 6% of `text`), with no stroke or glow; `tone` swaps in another approved token role, never a raw colour. A non-string title renders inside the Heading, so pass strings or inline Text; its visible text is announced. */
28
+ export function Alert({ title, children, severity = 'info', tone, action, announce = true }) { const colors = useColors(); const neutral = severity === 'default' && tone === undefined; const accent = neutral ? colors.text : roleColor(tone, severityRole[severity] ?? 'info', colors); const message = [plainText(title), blockText(children)].filter(Boolean).join('. '); const previous = useRef(''); useEffect(() => { const key = severity + message; if (announce && key !== previous.current) {
25
29
  previous.current = key;
26
30
  if (Platform.OS === 'ios')
27
31
  speak(message, severity);
28
- } }); return _jsxs(Surface, { style: { gap: 12, borderWidth: 2, borderColor: accent, borderRadius: 16, backgroundColor: withAlpha(colors.surface, 0.95), boxShadow: neutral ? `0 0 20px ${withAlpha(colors.text, 0.12)}` : `0 0 24px ${withAlpha(accent, 0.55)}` }, accessibilityLiveRegion: announce && Platform.OS !== 'ios' ? (severity === 'error' ? 'assertive' : 'polite') : 'none', children: [_jsx(Heading, { children: title }), children, action] }); }
32
+ } }); return _jsxs(Surface, { style: { gap: 12, backgroundColor: tint(accent, colors.surface, neutral ? 0.06 : 0.1) }, accessibilityLiveRegion: announce && Platform.OS !== 'ios' ? (severity === 'error' ? 'assertive' : 'polite') : 'none', children: [_jsx(Heading, { style: { color: accent }, children: title }), children, action] }); }
29
33
  export const Callout = Alert;
30
- /** Compact, scrollable notices remain visible until their host removes them. */
34
+ /** Loops a 0→1 value while `active`; rests at 0 otherwise (reduced motion, or nothing to show). */
35
+ function useLoop(active, duration, easing = Easing.linear) { const value = useRef(new Animated.Value(0)).current; useEffect(() => { if (!active) {
36
+ value.stopAnimation();
37
+ value.setValue(0);
38
+ return;
39
+ } const loop = Animated.loop(Animated.timing(value, { toValue: 1, duration, easing, useNativeDriver: Platform.OS !== 'web', isInteraction: false })); loop.start(); return () => loop.stop(); }, [active, duration, easing, value]); return value; }
40
+ /** Each notice is one capsule row: severity symbol, message, optional action, then a close control. Compact, scrollable notices remain visible until their host removes them. */
31
41
  export function Toast({ notices, onDismiss, dismissLabel, maxHeight, testID }) {
32
- const { messages } = useHIG();
42
+ const { messages, direction } = useHIG();
33
43
  const colors = useColors();
34
44
  const { height } = useWindowDimensions();
35
45
  const dismiss = dismissLabel ?? messages.dismiss ?? en.dismiss;
@@ -55,18 +65,48 @@ export function Toast({ notices, onDismiss, dismissLabel, maxHeight, testID }) {
55
65
  }, [key]);
56
66
  useEffect(() => () => { if (timer.current !== null)
57
67
  clearTimeout(timer.current); }, []);
58
- return _jsxs(View, { testID: testID, style: { maxHeight: maxHeight ?? height * .6, flexShrink: 1 }, children: [_jsx(ScrollView, { style: { flexGrow: 0, flexShrink: 1 }, nestedScrollEnabled: true, keyboardShouldPersistTaps: 'handled', accessibilityLabel: messages.notifications ?? en.notifications, children: _jsx(Stack, { style: { gap: 8 }, children: unique.map(n => _jsxs(Surface, { accessibilityLiveRegion: 'none', style: { padding: 12, gap: 8, borderWidth: 2, borderColor: colors[severityRole[n.severity]], borderRadius: 999, backgroundColor: withAlpha(colors.surface, 0.95), boxShadow: `0 0 24px ${withAlpha(colors[severityRole[n.severity]], 0.55)}` }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: n.message }), n.description ? _jsx(Text, { children: n.description }) : null, n.action, n.closable !== false && onDismiss ? _jsx(Button, { intent: 'ghost', accessibilityLabel: (messages.dismissNotice ?? en.dismissNotice)(n.message, dismiss), onPress: () => onDismiss(n.id), children: dismiss }) : null] }, n.id)) }) }), Platform.OS === 'web' && _jsx(Text, { accessibilityLiveRegion: 'polite', style: { position: 'absolute', width: 1, height: 1, overflow: 'hidden' }, children: announcement })] });
68
+ return _jsxs(View, { testID: testID, style: { maxHeight: maxHeight ?? height * .6, flexShrink: 1 }, children: [_jsx(ScrollView, { style: { flexGrow: 0, flexShrink: 1 }, nestedScrollEnabled: true, keyboardShouldPersistTaps: 'handled', accessibilityLabel: messages.notifications ?? en.notifications, children: _jsx(Stack, { style: { gap: 8 }, children: unique.map(n => _jsxs(View, { accessibilityLiveRegion: 'none', style: { direction, flexDirection: 'row', alignItems: 'center', gap: 10, minHeight: 44, paddingVertical: 6, paddingHorizontal: 12, borderRadius: 22, backgroundColor: colors.nested, boxShadow: '0 4px 16px #0006' }, children: [_jsx(SeverityIcon, { kind: n.severity, color: colors[severityRole[n.severity]] }), _jsxs(View, { style: { flex: 1, minWidth: 0 }, children: [_jsx(Text, { style: { fontWeight: '600' }, children: n.message }), n.description ? _jsx(Text, { children: n.description }) : null] }), n.action, n.closable !== false && onDismiss ? _jsx(Button, { intent: 'ghost', contentMode: 'custom', suppressFeedback: true, accessibilityLabel: (messages.dismissNotice ?? en.dismissNotice)(n.message, dismiss), hitSlop: 8, onPress: () => onDismiss(n.id), style: { minHeight: 32, minWidth: 32, paddingHorizontal: 0, paddingVertical: 0, alignSelf: 'center' }, children: _jsx(CloseIcon, { color: colors.muted }) }) : null] }, n.id)) }) }), Platform.OS === 'web' && _jsx(Text, { accessibilityLiveRegion: 'polite', style: { position: 'absolute', width: 1, height: 1, overflow: 'hidden' }, children: announcement })] });
69
+ }
70
+ /** One transient notice: shown for about four seconds, replaced by the next one, dismissible, and cleared on unmount. Render it with `Toast`, which announces it. */
71
+ export function useTransientNotice(duration = 4000) {
72
+ const [notice, setNotice] = useState(null);
73
+ const sequence = useRef(0), timer = useRef(null), alive = useRef(true);
74
+ useEffect(() => { alive.current = true; return () => { alive.current = false; if (timer.current !== null)
75
+ clearTimeout(timer.current); }; }, []);
76
+ const stop = () => { if (timer.current !== null) {
77
+ clearTimeout(timer.current);
78
+ timer.current = null;
79
+ } };
80
+ return { notice, dismiss: () => { stop(); setNotice(null); }, show: (message, severity = 'success') => { if (!alive.current)
81
+ return; stop(); setNotice({ id: `notice-${++sequence.current}`, message, severity }); timer.current = setTimeout(() => { timer.current = null; setNotice(null); }, duration); } };
59
82
  }
60
83
  export function Spinner({ label }) { const { messages } = useHIG(); const colors = useColors(); const text = label ?? messages.loading ?? en.loading; return _jsxs(View, { accessible: true, accessibilityLabel: text, children: [_jsx(ActivityIndicator, { color: colors.action }), _jsx(Text, { children: text })] }); }
61
84
  export function Progress({ label, value, max = 100 }) {
62
85
  const { locale, messages, direction } = useHIG();
63
86
  const colors = useColors();
87
+ const fills = useFills();
64
88
  const fill = value === undefined ? 35 : Math.min(100, Math.max(0, Number.isFinite(value) && max > 0 ? value / max * 100 : 0));
65
- return _jsxs(View, { style: { gap: 12, direction }, accessibilityRole: 'progressbar', accessibilityLabel: label, accessibilityValue: { min: 0, max, now: value, text: value === undefined ? messages.inProgress ?? en.inProgress : (messages.progressValue ?? en.progressValue)(formatNumber(value, locale), formatNumber(max, locale)) }, children: [_jsxs(Text, { children: [label, value === undefined ? '…' : ` ${value}/${max}`] }), _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { height: 6, borderRadius: 9999, overflow: 'hidden', backgroundColor: colors.nested }, children: _jsx(View, { style: { width: `${fill}%`, height: '100%', alignSelf: value === undefined ? 'center' : 'flex-start', borderRadius: 9999, backgroundColor: colors.action } }) })] });
89
+ return _jsxs(View, { style: { gap: 12, direction }, accessibilityRole: 'progressbar', accessibilityLabel: label, accessibilityValue: { min: 0, max, now: value, text: value === undefined ? messages.inProgress ?? en.inProgress : (messages.progressValue ?? en.progressValue)(formatNumber(value, locale), formatNumber(max, locale)) }, children: [_jsxs(Text, { children: [label, value === undefined ? '…' : ` ${value}/${max}`] }), _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { height: 6, borderRadius: 9999, overflow: 'hidden', backgroundColor: fills.raised }, children: _jsx(View, { style: { width: `${fill}%`, height: '100%', alignSelf: value === undefined ? 'center' : 'flex-start', borderRadius: 9999, backgroundColor: colors.action } }) })] });
66
90
  }
67
- export function Skeleton({ label }) { const { messages } = useHIG(); const colors = useColors(); return _jsx(View, { accessible: true, accessibilityLabel: label ?? messages.loadingContent ?? en.loadingContent, style: { minHeight: 48, backgroundColor: colors.nested, borderRadius: 10 } }); }
91
+ /** Pulses while content is on its way; still with reduced motion. */
92
+ export function Skeleton({ label }) { const { messages, reducedMotion } = useHIG(); const fills = useFills(); const pulse = useLoop(!reducedMotion, 1500); return _jsx(Animated.View, { accessible: true, accessibilityLabel: label ?? messages.loadingContent ?? en.loadingContent, style: { minHeight: 48, backgroundColor: fills.raised, borderRadius: 10, opacity: pulse.interpolate({ inputRange: [0, .5, 1], outputRange: [1, .5, 1] }) } }); }
93
+ /** A strokeless card, centred: icon, title, optional description, then the action. */
68
94
  export function EmptyState({ title, description, action, illustration, titleStyle, descriptionStyle, maxFontSizeMultiplier, ...props }) {
69
- return _jsxs(Surface, { ...props, style: [{ gap: 12 }, props.style], children: [illustration != null && _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', children: illustration }), _jsx(Heading, { style: titleStyle, maxFontSizeMultiplier: maxFontSizeMultiplier, children: title }), description ? _jsx(Text, { style: descriptionStyle, maxFontSizeMultiplier: maxFontSizeMultiplier, children: description }) : null, action] });
95
+ const colors = useColors();
96
+ const mark = illustration !== undefined ? illustration : _jsx(EmptyIcon, { color: colors.muted });
97
+ return _jsxs(Surface, { ...props, style: [{ gap: 12, alignItems: 'center' }, props.style], children: [mark != null && _jsx(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', children: mark }), _jsx(Heading, { style: [{ textAlign: 'center' }, titleStyle], maxFontSizeMultiplier: maxFontSizeMultiplier, children: title }), description ? _jsx(Text, { style: [{ textAlign: 'center', color: colors.muted }, descriptionStyle], maxFontSizeMultiplier: maxFontSizeMultiplier, children: description }) : null, action] });
98
+ }
99
+ /** Initials sit on the dark well fill (one step lighter inside a Surface, Dialog or sheet). */
100
+ export function Avatar({ name, source }) { const fills = useFills(); return source ? _jsx(Image, { source: source, accessibilityLabel: name, style: { width: 40, height: 40, borderRadius: 20 } }) : _jsx(View, { accessible: true, accessibilityRole: 'image', accessibilityLabel: name, style: { width: 40, height: 40, borderRadius: 20, backgroundColor: fills.well, alignItems: 'center', justifyContent: 'center' }, children: _jsx(Text, { accessible: false, children: name.slice(0, 2) }) }); }
101
+ const statusRole = { online: 'positive', stale: 'warning', offline: 'muted' };
102
+ const ringEasing = Easing.out(Easing.quad);
103
+ /** The dot carries the state colour. Online and stale emit a ring that grows and fades in that colour; offline and reduced motion stay still. */
104
+ export function StatusIndicator({ label, state }) {
105
+ const { messages, reducedMotion, direction } = useHIG();
106
+ const colors = useColors();
107
+ const text = { online: messages.statusOnline ?? en.statusOnline, offline: messages.statusOffline ?? en.statusOffline, stale: messages.statusStale ?? en.statusStale }[state] ?? state;
108
+ const color = colors[statusRole[state] ?? 'muted'];
109
+ const live = !reducedMotion && (state === 'online' || state === 'stale');
110
+ const ring = useLoop(live, 1600, ringEasing);
111
+ return _jsxs(View, { style: { direction, flexDirection: 'row', alignItems: 'center', gap: tokens.space.sm }, children: [_jsxs(View, { accessible: false, accessibilityElementsHidden: true, importantForAccessibility: 'no-hide-descendants', style: { width: 7, height: 7 }, children: [live && _jsx(Animated.View, { style: { position: 'absolute', width: 7, height: 7, borderRadius: 4, backgroundColor: color, opacity: ring.interpolate({ inputRange: [0, 1], outputRange: [.6, 0] }), transform: [{ scale: ring.interpolate({ inputRange: [0, 1], outputRange: [1, 3] }) }] } }), _jsx(View, { style: { width: 7, height: 7, borderRadius: 4, backgroundColor: color } })] }), _jsxs(Text, { style: { flexShrink: 1, minWidth: 0 }, children: [label, ": ", text] })] });
70
112
  }
71
- export function Avatar({ name, source }) { return source ? _jsx(Image, { source: source, accessibilityLabel: name, style: { width: 40, height: 40, borderRadius: 20 } }) : _jsx(Text, { accessibilityLabel: name, children: name.slice(0, 2) }); }
72
- export function StatusIndicator({ label, state }) { const { messages } = useHIG(); const text = { online: messages.statusOnline ?? en.statusOnline, offline: messages.statusOffline ?? en.statusOffline, stale: messages.statusStale ?? en.statusStale }[state] ?? state; return _jsxs(Text, { children: [label, ": ", text] }); }
@@ -13,6 +13,7 @@ export declare const Text: React.ForwardRefExoticComponent<HIGTextProps & React.
13
13
  export declare const Heading: React.ForwardRefExoticComponent<HIGTextProps & React.RefAttributes<React.ComponentRef<typeof RNText>>>;
14
14
  export declare function Stack({ style, ...props }: ViewProps): React.JSX.Element;
15
15
  export declare function Inline({ style, ...props }: ViewProps): React.JSX.Element;
16
- export declare function Surface({ style, ...props }: ViewProps): React.JSX.Element;
16
+ /** A filled card with no stroke; its fill and the space around it separate it from the page. */
17
+ export declare function Surface({ style, children, ...props }: ViewProps): React.JSX.Element;
17
18
  export declare const Card: typeof Surface;
18
19
  export declare function Separator(): React.JSX.Element;
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from 'react';
3
3
  import { Text as RNText, View, StyleSheet } from 'react-native';
4
4
  import { nativeMetrics as tokens } from '@bloxwap/hig/tokens';
5
- import { useColors, useHIG } from './provider.js';
5
+ import { Raised, useColors, useFills, useHIG } from './provider.js';
6
6
  import { plainText } from './text-content.js';
7
7
  /** Korean and Chinese companion faces are set at their own spacing (0em): Latin tracking spreads CJK glyphs apart. Hosts override per script through HIGProvider `letterSpacingByScript`. */
8
8
  export const scriptLetterSpacing = { ko: 0, zh: 0 };
@@ -36,6 +36,7 @@ export const Text = forwardRef(function Text({ style, script, maxFontSizeMultipl
36
36
  export const Heading = forwardRef(function Heading({ style, ...props }, ref) { return _jsx(Text, { ...props, ref: ref, accessibilityRole: 'header', style: [{ fontSize: 24, lineHeight: 30, fontWeight: '600' }, style] }); });
37
37
  export function Stack({ style, ...props }) { const env = useHIG(); return _jsx(View, { ...props, style: [{ direction: env.direction, gap: tokens.space.md }, style] }); }
38
38
  export function Inline({ style, ...props }) { const env = useHIG(); return _jsx(View, { ...props, style: [{ direction: env.direction, flexDirection: 'row', flexWrap: 'wrap', alignItems: 'center', gap: tokens.space.md }, style] }); }
39
- export function Surface({ style, ...props }) { const env = useHIG(); const colors = useColors(); return _jsx(View, { ...props, style: [{ direction: env.direction, backgroundColor: colors.surface, borderWidth: 1, borderColor: colors.border, borderRadius: tokens.radius.xl, padding: tokens.space.xl, minWidth: 0 }, style] }); }
39
+ /** A filled card with no stroke; its fill and the space around it separate it from the page. */
40
+ export function Surface({ style, children, ...props }) { const env = useHIG(); const colors = useColors(); return _jsx(View, { ...props, style: [{ direction: env.direction, backgroundColor: colors.surface, borderRadius: tokens.radius.xl, padding: tokens.space.xl, minWidth: 0 }, style], children: _jsx(Raised, { children: children }) }); }
40
41
  export const Card = Surface;
41
- export function Separator() { const colors = useColors(); return _jsx(View, { accessibilityRole: 'none', style: { height: 1, backgroundColor: colors.border } }); }
42
+ export function Separator() { const fills = useFills(); return _jsx(View, { accessibilityRole: 'none', style: { height: 2, borderRadius: 9999, backgroundColor: fills.raised } }); }