@bloxwap/hig 0.0.0-stage → 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 (220) hide show
  1. package/LICENSE +5 -0
  2. package/README.md +44 -2
  3. package/chart/README.md +23 -0
  4. package/chart/dist/index.d.ts +8 -0
  5. package/chart/dist/index.js +12 -0
  6. package/contracts/README.md +3 -0
  7. package/contracts/dist/announcements.d.ts +12 -0
  8. package/contracts/dist/announcements.js +8 -0
  9. package/contracts/dist/feedback.d.ts +40 -0
  10. package/contracts/dist/feedback.js +1 -0
  11. package/contracts/dist/index.d.ts +41 -0
  12. package/contracts/dist/index.js +52 -0
  13. package/contracts/dist/messages.d.ts +300 -0
  14. package/contracts/dist/messages.js +114 -0
  15. package/css.d.ts +2 -0
  16. package/feedback/README.md +7 -0
  17. package/feedback/assets/error.wav +0 -0
  18. package/feedback/assets/manifest.json +78 -0
  19. package/feedback/assets/success.wav +0 -0
  20. package/feedback/assets/tick.wav +0 -0
  21. package/feedback/assets/toggle.wav +0 -0
  22. package/feedback/dist/browser-haptic.d.ts +23 -0
  23. package/feedback/dist/browser-haptic.js +41 -0
  24. package/feedback/dist/contract.d.ts +40 -0
  25. package/feedback/dist/contract.js +59 -0
  26. package/feedback/dist/native.d.ts +28 -0
  27. package/feedback/dist/native.js +63 -0
  28. package/feedback/dist/preferences.d.ts +8 -0
  29. package/feedback/dist/preferences.js +24 -0
  30. package/feedback/dist/presets.d.ts +57 -0
  31. package/feedback/dist/presets.js +1 -0
  32. package/feedback/dist/react.d.ts +19 -0
  33. package/feedback/dist/react.js +23 -0
  34. package/feedback/dist/web-haptic.d.ts +6 -0
  35. package/feedback/dist/web-haptic.js +6 -0
  36. package/feedback/dist/web-sound.d.ts +5 -0
  37. package/feedback/dist/web-sound.js +32 -0
  38. package/feedback/dist/web.d.ts +3 -0
  39. package/feedback/dist/web.js +4 -0
  40. package/native/README.md +16 -0
  41. package/native/android/build.gradle +28 -0
  42. package/native/android/src/main/java/com/bloxwap/hig/HIGAdjustableView.java +173 -0
  43. package/native/android/src/main/java/com/bloxwap/hig/HIGAdjustableViewManager.java +23 -0
  44. package/native/android/src/main/java/com/bloxwap/hig/HIGPackage.java +24 -0
  45. package/native/dist/animated-number-model.d.ts +24 -0
  46. package/native/dist/animated-number-model.js +110 -0
  47. package/native/dist/animated-number.d.ts +9 -0
  48. package/native/dist/animated-number.js +97 -0
  49. package/native/dist/brand.d.ts +7 -0
  50. package/native/dist/brand.js +7 -0
  51. package/native/dist/button.d.ts +30 -0
  52. package/native/dist/button.js +36 -0
  53. package/native/dist/checkbox.d.ts +3 -0
  54. package/native/dist/checkbox.js +11 -0
  55. package/native/dist/data.d.ts +57 -0
  56. package/native/dist/data.js +47 -0
  57. package/native/dist/field.d.ts +16 -0
  58. package/native/dist/field.js +26 -0
  59. package/native/dist/gesture-sheet.d.ts +73 -0
  60. package/native/dist/gesture-sheet.js +153 -0
  61. package/native/dist/icons.d.ts +21 -0
  62. package/native/dist/icons.js +20 -0
  63. package/native/dist/navigation.d.ts +48 -0
  64. package/native/dist/navigation.js +58 -0
  65. package/native/dist/overlay.d.ts +36 -0
  66. package/native/dist/overlay.js +65 -0
  67. package/native/dist/pickers.d.ts +54 -0
  68. package/native/dist/pickers.js +60 -0
  69. package/native/dist/provider.d.ts +62 -0
  70. package/native/dist/provider.js +67 -0
  71. package/native/dist/radio-group.d.ts +21 -0
  72. package/native/dist/radio-group.js +91 -0
  73. package/native/dist/recipes.d.ts +45 -0
  74. package/native/dist/recipes.js +32 -0
  75. package/native/dist/roles.d.ts +6 -0
  76. package/native/dist/roles.js +4 -0
  77. package/native/dist/select.d.ts +3 -0
  78. package/native/dist/select.js +9 -0
  79. package/native/dist/selection-types.d.ts +22 -0
  80. package/native/dist/selection-types.js +1 -0
  81. package/native/dist/selection.d.ts +8 -0
  82. package/native/dist/selection.js +7 -0
  83. package/native/dist/slider.d.ts +11 -0
  84. package/native/dist/slider.js +42 -0
  85. package/native/dist/status.d.ts +86 -0
  86. package/native/dist/status.js +112 -0
  87. package/native/dist/surface.d.ts +19 -0
  88. package/native/dist/surface.js +42 -0
  89. package/native/dist/swap-panel.d.ts +125 -0
  90. package/native/dist/swap-panel.js +177 -0
  91. package/native/dist/swap-parts.d.ts +86 -0
  92. package/native/dist/swap-parts.js +66 -0
  93. package/native/dist/swap-shared.d.ts +65 -0
  94. package/native/dist/swap-shared.js +76 -0
  95. package/native/dist/swap-sheet.d.ts +14 -0
  96. package/native/dist/swap-sheet.js +26 -0
  97. package/native/dist/swap-views.d.ts +41 -0
  98. package/native/dist/swap-views.js +37 -0
  99. package/native/dist/switch-row.d.ts +8 -0
  100. package/native/dist/switch-row.js +18 -0
  101. package/native/dist/switch.d.ts +10 -0
  102. package/native/dist/switch.js +30 -0
  103. package/native/dist/text-content.d.ts +5 -0
  104. package/native/dist/text-content.js +6 -0
  105. package/native/dist/wallet-address.d.ts +37 -0
  106. package/native/dist/wallet-address.js +50 -0
  107. package/native-fonts/README.md +17 -0
  108. package/native-fonts/dist/index.d.ts +164 -0
  109. package/native-fonts/dist/index.js +164 -0
  110. package/native-fonts/fonts/BloxwapMono-Bold.ttf +0 -0
  111. package/native-fonts/fonts/BloxwapMono-ExtraBold.ttf +0 -0
  112. package/native-fonts/fonts/BloxwapMono-Medium.ttf +0 -0
  113. package/native-fonts/fonts/BloxwapMono-SemiBold.ttf +0 -0
  114. package/native-fonts/fonts/BloxwapMono.ttf +0 -0
  115. package/native-fonts/fonts/BloxwapSans-Black.ttf +0 -0
  116. package/native-fonts/fonts/BloxwapSans-Bold.ttf +0 -0
  117. package/native-fonts/fonts/BloxwapSans-ExtraBold.ttf +0 -0
  118. package/native-fonts/fonts/BloxwapSans-Medium.ttf +0 -0
  119. package/native-fonts/fonts/BloxwapSans-SemiBold.ttf +0 -0
  120. package/native-fonts/fonts/BloxwapSans.ttf +0 -0
  121. package/native-fonts/fonts/BloxwapSansKR-SemiBold.ttf +0 -0
  122. package/native-fonts/fonts/BloxwapSansKR.ttf +0 -0
  123. package/native-fonts/fonts/BloxwapSansSC-SemiBold.ttf +0 -0
  124. package/native-fonts/fonts/BloxwapSansSC.ttf +0 -0
  125. package/native-fonts/fonts/OFL.txt +93 -0
  126. package/native-fonts/fonts/manifest.json +164 -0
  127. package/og-fonts/README.md +34 -0
  128. package/og-fonts/dist/index.d.ts +116 -0
  129. package/og-fonts/dist/index.js +102 -0
  130. package/og-fonts/dist/node.d.ts +11 -0
  131. package/og-fonts/dist/node.js +39 -0
  132. package/og-fonts/fonts/BloxwapMono-Medium.ttf +0 -0
  133. package/og-fonts/fonts/BloxwapSans-Black.ttf +0 -0
  134. package/og-fonts/fonts/BloxwapSans-Bold.ttf +0 -0
  135. package/og-fonts/fonts/BloxwapSans-Medium.ttf +0 -0
  136. package/og-fonts/fonts/BloxwapSans.ttf +0 -0
  137. package/og-fonts/fonts/OFL.txt +93 -0
  138. package/og-fonts/fonts/manifest.json +65 -0
  139. package/package.json +476 -4
  140. package/react/README.md +30 -0
  141. package/react/dist/animated-number-model.d.ts +20 -0
  142. package/react/dist/animated-number-model.js +92 -0
  143. package/react/dist/animated-number.d.ts +8 -0
  144. package/react/dist/animated-number.js +72 -0
  145. package/react/dist/base.css +9 -0
  146. package/react/dist/brand.d.ts +7 -0
  147. package/react/dist/brand.js +5 -0
  148. package/react/dist/button.d.ts +14 -0
  149. package/react/dist/button.js +20 -0
  150. package/react/dist/data.d.ts +78 -0
  151. package/react/dist/data.js +36 -0
  152. package/react/dist/dialog.d.ts +29 -0
  153. package/react/dist/dialog.js +21 -0
  154. package/react/dist/field.d.ts +16 -0
  155. package/react/dist/field.js +20 -0
  156. package/react/dist/gesture-sheet.d.ts +41 -0
  157. package/react/dist/gesture-sheet.js +128 -0
  158. package/react/dist/navigation.d.ts +48 -0
  159. package/react/dist/navigation.js +69 -0
  160. package/react/dist/notify.d.ts +14 -0
  161. package/react/dist/notify.js +6 -0
  162. package/react/dist/overlay.d.ts +17 -0
  163. package/react/dist/overlay.js +18 -0
  164. package/react/dist/provider.d.ts +25 -0
  165. package/react/dist/provider.js +50 -0
  166. package/react/dist/recipes/activity-list.d.ts +8 -0
  167. package/react/dist/recipes/activity-list.js +6 -0
  168. package/react/dist/recipes/balance-card.d.ts +6 -0
  169. package/react/dist/recipes/balance-card.js +5 -0
  170. package/react/dist/recipes/code-window.d.ts +4 -0
  171. package/react/dist/recipes/code-window.js +4 -0
  172. package/react/dist/recipes/install-command.d.ts +6 -0
  173. package/react/dist/recipes/install-command.js +15 -0
  174. package/react/dist/recipes/market-row.d.ts +25 -0
  175. package/react/dist/recipes/market-row.js +8 -0
  176. package/react/dist/recipes/marketing-hero.d.ts +7 -0
  177. package/react/dist/recipes/marketing-hero.js +5 -0
  178. package/react/dist/recipes/pickers.d.ts +57 -0
  179. package/react/dist/recipes/pickers.js +78 -0
  180. package/react/dist/recipes/swap/amount-card.d.ts +40 -0
  181. package/react/dist/recipes/swap/amount-card.js +7 -0
  182. package/react/dist/recipes/swap/picker.d.ts +26 -0
  183. package/react/dist/recipes/swap/picker.js +20 -0
  184. package/react/dist/recipes/swap/settings.d.ts +24 -0
  185. package/react/dist/recipes/swap/settings.js +25 -0
  186. package/react/dist/recipes/swap/shared.d.ts +98 -0
  187. package/react/dist/recipes/swap/shared.js +106 -0
  188. package/react/dist/recipes/swap-panel.d.ts +127 -0
  189. package/react/dist/recipes/swap-panel.js +170 -0
  190. package/react/dist/recipes/swap-sheet.d.ts +16 -0
  191. package/react/dist/recipes/swap-sheet.js +22 -0
  192. package/react/dist/recipes/trade-entry.d.ts +11 -0
  193. package/react/dist/recipes/trade-entry.js +12 -0
  194. package/react/dist/recipes.d.ts +10 -0
  195. package/react/dist/recipes.js +11 -0
  196. package/react/dist/select.d.ts +4 -0
  197. package/react/dist/select.js +174 -0
  198. package/react/dist/selection.d.ts +40 -0
  199. package/react/dist/selection.js +23 -0
  200. package/react/dist/slider.d.ts +11 -0
  201. package/react/dist/slider.js +10 -0
  202. package/react/dist/status.d.ts +63 -0
  203. package/react/dist/status.js +47 -0
  204. package/react/dist/styles.css +542 -0
  205. package/react/dist/surface.d.ts +291 -0
  206. package/react/dist/surface.js +9 -0
  207. package/react/dist/toast.d.ts +17 -0
  208. package/react/dist/toast.js +21 -0
  209. package/react/dist/wallet-address.d.ts +23 -0
  210. package/react/dist/wallet-address.js +24 -0
  211. package/tokens/README.md +17 -0
  212. package/tokens/assets/bloxwap-icon.svg +1 -0
  213. package/tokens/dist/brand.d.ts +19 -0
  214. package/tokens/dist/brand.js +24 -0
  215. package/tokens/dist/index.d.ts +437 -0
  216. package/tokens/dist/index.js +514 -0
  217. package/tokens/dist/manifest.json +200 -0
  218. package/tokens/dist/theme.d.ts +11 -0
  219. package/tokens/dist/theme.js +22 -0
  220. package/tokens/dist/tokens.css +120 -0
@@ -0,0 +1,128 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useCallback, useEffect, useRef, useState } from 'react';
4
+ import { Drawer } from 'vaul';
5
+ import * as en from '@bloxwap/hig/contracts/messages';
6
+ import { useHIG, useThemeStyle } from './provider.js';
7
+ import { Button } from './button.js';
8
+ const OWNED_CONTENT = new Set(['children', 'asChild', 'forceMount', 'role', 'dir', 'lang', 'id', 'ref', 'aria-labelledby', 'aria-describedby', 'dangerouslySetInnerHTML']);
9
+ const OWNED_ROOT = new Set(['children', 'open', 'defaultOpen', 'onOpenChange', 'modal', 'nested', 'onClose']);
10
+ const OWNED_OVERLAY = new Set(['children', 'asChild', 'forceMount', 'ref', 'dangerouslySetInnerHTML']);
11
+ const OWNED_HANDLE = new Set(['children', 'aria-hidden', 'ref', 'dangerouslySetInnerHTML', 'onClick', 'onPointerDown', 'onPointerMove', 'onPointerCancel']);
12
+ const OWNED_BACKEND_DATA = new Set(['data-vaul-drawer', 'data-vaul-drawer-direction', 'data-vaul-delayed-snap-points', 'data-vaul-snap-points', 'data-vaul-custom-container', 'data-vaul-animate', 'data-vaul-overlay', 'data-vaul-snap-points-overlay', 'data-vaul-handle', 'data-vaul-drawer-visible', 'data-vaul-handle-hitarea']);
13
+ const DYNAMIC_BACKEND = new Set(['snapPoints', 'snapPoint', 'activeSnapPoint', 'setActiveSnapPoint', 'fadeFromIndex', 'snapToSequentialPoint']);
14
+ const safeProps = (props, owned) => Object.fromEntries(Object.entries(props ?? {}).filter(([key]) => !owned.has(key) && !OWNED_BACKEND_DATA.has(key)));
15
+ function useDynamicHeight(open, enabled, reducedMotion, panel, content) {
16
+ const animation = useRef(null);
17
+ useEffect(() => {
18
+ if (!open || !enabled || !content)
19
+ return;
20
+ const card = panel.current;
21
+ if (!card)
22
+ return;
23
+ let previous = null;
24
+ const cancel = () => { const current = animation.current; animation.current = null; current?.cancel(); };
25
+ const measure = () => {
26
+ const next = content.getBoundingClientRect().height, from = animation.current ? card.getBoundingClientRect().height : previous;
27
+ previous = next;
28
+ if (from === null || Math.abs(from - next) < .5)
29
+ return;
30
+ if (reducedMotion || card.style.height || typeof card.animate !== 'function') {
31
+ cancel();
32
+ return;
33
+ }
34
+ cancel();
35
+ const current = card.animate([{ height: `${from}px` }, { height: `${next}px` }], { duration: 200, easing: 'cubic-bezier(.32,.72,0,1)' });
36
+ animation.current = current;
37
+ current.onfinish = current.oncancel = () => { if (animation.current === current)
38
+ animation.current = null; };
39
+ };
40
+ const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measure);
41
+ resize?.observe(content);
42
+ measure();
43
+ const inline = typeof MutationObserver === 'undefined' ? null : new MutationObserver(() => { if (card.style.height)
44
+ cancel(); });
45
+ inline?.observe(card, { attributes: true, attributeFilter: ['style'] });
46
+ return () => { resize?.disconnect(); inline?.disconnect(); cancel(); };
47
+ }, [open, enabled, reducedMotion, panel, content]);
48
+ }
49
+ // Vaul 1.1.2 writes motion styles before requesting a controlled close. If the host
50
+ // rejects that request, restore the last resting styles without remounting its card.
51
+ function snapshotStyles(element, properties) {
52
+ const values = properties.map(property => [property, element?.style.getPropertyValue(property) ?? '', element?.style.getPropertyPriority(property) ?? '']);
53
+ return () => { if (element?.isConnected)
54
+ for (const [property, value, priority] of values) {
55
+ if (value)
56
+ element.style.setProperty(property, value, priority);
57
+ else
58
+ element.style.removeProperty(property);
59
+ } };
60
+ }
61
+ const MOTION_PROPERTIES = ['transform', 'transition', 'transition-property', 'transition-duration', 'transition-timing-function'];
62
+ const BACKGROUND_PROPERTIES = [...MOTION_PROPERTIES, 'border-radius', 'overflow', 'transform-origin'];
63
+ const BODY_POSITION = ['position', 'top', 'left', 'right', 'height'];
64
+ /** Optional web gesture backend. Install vaul separately; the core overlay entry never imports it. */
65
+ export function GestureSheet({ open, onOpenChange, title, description, trigger, children, titleHidden, descriptionHidden, contentProps, contentRef, closeButton, closeLabel, backendProps, contentMode = 'default', handle = true, handleProps, handleRef, overlayProps, enableDynamicSizing = false, maxDynamicContentSize }) {
66
+ if (enableDynamicSizing && Object.entries(backendProps ?? {}).some(([key, value]) => value !== undefined && DYNAMIC_BACKEND.has(key)))
67
+ throw new Error('Dynamic GestureSheet does not accept Vaul snap-point props.');
68
+ if (maxDynamicContentSize !== undefined && (!Number.isFinite(maxDynamicContentSize) || maxDynamicContentSize <= 0))
69
+ throw new Error('GestureSheet maxDynamicContentSize must be finite and greater than zero.');
70
+ const { messages, direction, locale, reducedMotion } = useHIG();
71
+ const themeStyle = useThemeStyle();
72
+ const currentOpen = useRef(open);
73
+ currentOpen.current = open;
74
+ const panel = useRef(null), backdrop = useRef(null), motion = useRef(null), frame = useRef(null);
75
+ const [anatomy, setAnatomy] = useState(null);
76
+ const refCleanup = useRef(null), releasePosition = useRef(null);
77
+ // Vaul's internal ref composition predates React callback-ref cleanup returns.
78
+ const setPanel = useCallback((element) => { panel.current = element; if (typeof contentRef === 'function') {
79
+ if (!element && refCleanup.current) {
80
+ const cleanup = refCleanup.current;
81
+ refCleanup.current = null;
82
+ cleanup();
83
+ }
84
+ else {
85
+ const cleanup = contentRef(element);
86
+ refCleanup.current = typeof cleanup === 'function' ? cleanup : null;
87
+ }
88
+ }
89
+ else if (contentRef)
90
+ contentRef.current = element; }, [contentRef]);
91
+ useEffect(() => () => { if (frame.current !== null)
92
+ cancelAnimationFrame(frame.current); releasePosition.current?.(); }, []);
93
+ useEffect(() => { if (!open) {
94
+ motion.current = null;
95
+ releasePosition.current?.();
96
+ releasePosition.current = null;
97
+ } }, [open]);
98
+ const { onAnimationEnd, ...backend } = safeProps(backendProps, OWNED_ROOT);
99
+ const dynamic = !!enableDynamicSizing && ((backend.direction ?? 'bottom') === 'top' || (backend.direction ?? 'bottom') === 'bottom');
100
+ useDynamicHeight(open, dynamic, reducedMotion, panel, anatomy);
101
+ const { className, onPointerDownCapture, onFocusOutside, onInteractOutside, style, ...content } = safeProps(contentProps, OWNED_CONTENT);
102
+ const { className: overlayClass, ...overlay } = safeProps(overlayProps, OWNED_OVERLAY);
103
+ const { className: handleClass, ...grip } = safeProps(handleProps, OWNED_HANDLE);
104
+ const requestOpen = (next) => {
105
+ if (!next && frame.current === null) {
106
+ const wasFixed = document.body.style.position === 'fixed';
107
+ const restoreBody = snapshotStyles(document.body, [...BODY_POSITION, 'pointer-events']);
108
+ const restoreMotion = motion.current;
109
+ motion.current = null;
110
+ frame.current = requestAnimationFrame(() => {
111
+ frame.current = null;
112
+ if (currentOpen.current) {
113
+ // Safari's backend clears its saved body position even for a rejected close.
114
+ // Retain the released position so the eventual accepted close still unlocks.
115
+ if (wasFixed && document.body.style.position !== 'fixed')
116
+ releasePosition.current ??= snapshotStyles(document.body, BODY_POSITION);
117
+ restoreBody();
118
+ restoreMotion?.();
119
+ }
120
+ });
121
+ }
122
+ onOpenChange(next);
123
+ };
124
+ const body = _jsxs(_Fragment, { children: [handle && _jsx(Drawer.Handle, { ...grip, ref: handleRef, className: ['hig-gesture-handle', handleClass].filter(Boolean).join(' ') }), _jsx(Drawer.Title, { className: titleHidden ? 'hig-sr-only' : undefined, children: title }), description && _jsx(Drawer.Description, { className: descriptionHidden ? 'hig-sr-only' : undefined, children: description }), children, closeButton !== null && _jsx(Drawer.Close, { asChild: true, children: closeButton ?? _jsx(Button, { intent: 'secondary', suppressFeedback: true, children: closeLabel ?? messages.close ?? en.close }) })] });
125
+ return _jsxs(Drawer.Root, { ...backend, open: open, onOpenChange: requestOpen, modal: true, onAnimationEnd: next => { if (next === currentOpen.current)
126
+ onAnimationEnd?.(next); }, children: [trigger && _jsx(Drawer.Trigger, { asChild: true, children: trigger }), _jsxs(Drawer.Portal, { children: [_jsx(Drawer.Overlay, { ...overlay, ref: backdrop, className: ['hig-backdrop', 'hig-gesture-backdrop', overlayClass].filter(Boolean).join(' '), "data-hig-motion": reducedMotion ? 'reduced' : 'full' }), _jsx(Drawer.Content, { ...content, ...(!description ? { 'aria-describedby': undefined } : {}), ref: setPanel, className: ['hig-gesture-sheet', className].filter(Boolean).join(' '), role: 'dialog', dir: direction, lang: locale, style: { ...themeStyle, ...style, ...(dynamic && maxDynamicContentSize !== undefined && { maxHeight: maxDynamicContentSize }) }, onPointerDownCapture: event => { const restorePanel = snapshotStyles(panel.current, MOTION_PROPERTIES), restoreOverlay = snapshotStyles(backdrop.current, ['opacity', 'transition']), restoreBackground = backend.shouldScaleBackground ? snapshotStyles(document.querySelector('[data-vaul-drawer-wrapper]'), BACKGROUND_PROPERTIES) : () => { }; motion.current = () => { restorePanel(); restoreOverlay(); restoreBackground(); }; onPointerDownCapture?.(event); }, onInteractOutside: event => { if (event.detail.originalEvent.type === 'focusin')
127
+ onFocusOutside?.(event); onInteractOutside?.(event); }, "data-hig-content-mode": contentMode, "data-hig-motion": reducedMotion ? 'reduced' : 'full', "data-hig-dynamic": dynamic ? 'true' : undefined, children: dynamic ? _jsx("div", { ref: setAnatomy, className: 'hig-gesture-dynamic', "data-hig-content-mode": contentMode, children: body }) : body })] })] });
128
+ }
@@ -0,0 +1,48 @@
1
+ import React from 'react';
2
+ export declare function Tabs({ label, items, value, defaultValue, onValueChange }: {
3
+ label: string;
4
+ items: readonly {
5
+ value: string;
6
+ label: string;
7
+ content: React.ReactNode;
8
+ disabled?: boolean;
9
+ }[];
10
+ value?: string;
11
+ defaultValue?: string;
12
+ onValueChange?: (v: string) => void;
13
+ }): React.JSX.Element;
14
+ export declare function Accordion({ title, children, open, onOpenChange }: React.PropsWithChildren<{
15
+ title: string;
16
+ open?: boolean;
17
+ onOpenChange?: (open: boolean) => void;
18
+ }>): React.JSX.Element;
19
+ export declare function Breadcrumb({ items }: {
20
+ items: readonly {
21
+ label: string;
22
+ href?: string;
23
+ }[];
24
+ }): React.JSX.Element;
25
+ export declare function Navigation({ label, items }: {
26
+ label: string;
27
+ items: readonly {
28
+ label: string;
29
+ href: string;
30
+ active?: boolean;
31
+ }[];
32
+ }): React.JSX.Element;
33
+ export declare function Pagination({ page, total, onPageChange }: {
34
+ page: number;
35
+ total: number;
36
+ onPageChange: (p: number) => void;
37
+ }): React.JSX.Element;
38
+ export declare function Search({ query, onQueryChange, results, loading, error }: {
39
+ query: string;
40
+ onQueryChange: (s: string) => void;
41
+ results: readonly {
42
+ id: string;
43
+ label: string;
44
+ onSelect: () => void;
45
+ }[];
46
+ loading?: boolean;
47
+ error?: string;
48
+ }): React.JSX.Element;
@@ -0,0 +1,69 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useEffect, useId, useLayoutEffect, useRef } from 'react';
4
+ import { formatNumber } from '@bloxwap/hig/contracts';
5
+ import * as en from '@bloxwap/hig/contracts/messages';
6
+ import { useControllable, useHIG } from './provider.js';
7
+ import { Button, Link } from './button.js';
8
+ import { SearchInput, Field } from './field.js';
9
+ const focusable = 'a[href],area[href],button:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),textarea:not([disabled]),iframe,audio[controls],video[controls],summary,[contenteditable]:not([contenteditable="false"]),[tabindex]:not([tabindex="-1"])';
10
+ const contentSelector = 'img,svg,canvas,video,picture,progress,meter,input,select,textarea';
11
+ /** True when the panel's first visible content is itself focusable (for example an InstallCommand `pre`), so the panel needs no tab stop of its own. */
12
+ function startsWithFocusable(panel) {
13
+ const walker = panel.ownerDocument.createTreeWalker(panel, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_TEXT, { acceptNode: node => { const el = node; return node.nodeType === 1 && (el.hasAttribute('hidden') || el.hasAttribute('inert') || el.getAttribute('aria-hidden') === 'true') ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT; } });
14
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) {
15
+ if (node.nodeType === 1) {
16
+ const el = node;
17
+ if (el.matches(focusable))
18
+ return true;
19
+ if (el.matches(contentSelector))
20
+ return false;
21
+ }
22
+ else if (node.textContent?.trim())
23
+ return false;
24
+ }
25
+ return false;
26
+ }
27
+ /** Runs before paint on the client; on the server, where effects never run, it falls back to useEffect so React does not warn. */
28
+ const useIsomorphicLayoutEffect = typeof document === 'undefined' ? useEffect : useLayoutEffect;
29
+ /** Applies the APG panel tab stop to the DOM: `tabindex=0` unless the panel's first visible content is already focusable. */
30
+ function syncPanelStop(panel) { const stop = !startsWithFocusable(panel); if (stop && panel.getAttribute('tabindex') !== '0')
31
+ panel.tabIndex = 0;
32
+ else if (!stop && panel.hasAttribute('tabindex'))
33
+ panel.removeAttribute('tabindex'); }
34
+ export function Tabs({ label, items, value, defaultValue, onValueChange }) {
35
+ const { direction } = useHIG();
36
+ const id = useId();
37
+ const [current, set] = useControllable(value, defaultValue ?? items.find(item => !item.disabled)?.value ?? '', onValueChange);
38
+ const enabled = items.filter(item => !item.disabled);
39
+ const tabStop = (enabled.find(item => item.value === current) ?? enabled[0])?.value;
40
+ // APG: a panel is a tab stop only when its first content is not focusable; otherwise that control is the single stop after the tab list.
41
+ // Every panel renders tabIndex=0 (so server and hydration markup are unchanged); a layout effect then corrects the shown panel in the same commit, before paint and before any passive effect, so it is never a tab stop for one commit (#97).
42
+ const panel = useRef(null);
43
+ useIsomorphicLayoutEffect(() => { if (panel.current)
44
+ syncPanelStop(panel.current); });
45
+ useIsomorphicLayoutEffect(() => { const node = panel.current; if (!node)
46
+ return; let observer; if (typeof MutationObserver !== 'undefined') {
47
+ observer = new MutationObserver(() => syncPanelStop(node));
48
+ observer.observe(node, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ['tabindex', 'hidden', 'inert', 'aria-hidden', 'disabled', 'href', 'contenteditable', 'controls'] });
49
+ } return () => { observer?.disconnect(); node.tabIndex = 0; }; }, [current]);
50
+ return _jsxs("div", { className: 'hig-tabs', children: [_jsx("div", { role: 'tablist', "aria-label": label, className: 'hig-inline hig-tab-list', onKeyDown: e => { if (!enabled.length)
51
+ return; const index = enabled.findIndex(item => `${id}-tab-${item.value}` === e.target.id); let next = index; if (e.key === (direction === 'rtl' ? 'ArrowLeft' : 'ArrowRight'))
52
+ next = (index + 1) % enabled.length;
53
+ else if (e.key === (direction === 'rtl' ? 'ArrowRight' : 'ArrowLeft'))
54
+ next = index < 0 ? enabled.length - 1 : (index - 1 + enabled.length) % enabled.length;
55
+ else if (e.key === 'Home')
56
+ next = 0;
57
+ else if (e.key === 'End')
58
+ next = enabled.length - 1;
59
+ else
60
+ return; e.preventDefault(); if (enabled[next]) {
61
+ set(enabled[next].value);
62
+ document.getElementById(`${id}-tab-${enabled[next].value}`)?.focus();
63
+ } }, children: items.map(item => _jsx("button", { type: 'button', className: 'hig-button hig-tab', role: 'tab', id: `${id}-tab-${item.value}`, "aria-controls": `${id}-panel-${item.value}`, "aria-selected": current === item.value, tabIndex: tabStop === item.value ? 0 : -1, disabled: item.disabled, onClick: () => set(item.value), children: item.label }, item.value)) }), items.map(item => _jsx("div", { ref: current === item.value ? panel : undefined, hidden: current !== item.value, className: 'hig-tab-panel', role: 'tabpanel', id: `${id}-panel-${item.value}`, "aria-labelledby": `${id}-tab-${item.value}`, tabIndex: 0, children: item.content }, item.value))] });
64
+ }
65
+ export function Accordion({ title, children, open, onOpenChange }) { return _jsxs("details", { open: open, className: 'hig-surface hig-accordion', onToggle: e => onOpenChange?.(e.currentTarget.open), children: [_jsxs("summary", { className: 'hig-accordion-summary', children: [_jsx("span", { children: title }), _jsx("svg", { className: 'hig-accordion-chevron', "aria-hidden": 'true', focusable: 'false', viewBox: '0 0 20 20', children: _jsx("path", { d: 'm5 7.5 5 5 5-5' }) })] }), children] }); }
66
+ export function Breadcrumb({ items }) { const { messages } = useHIG(); return _jsx("nav", { "aria-label": messages.breadcrumb ?? en.breadcrumb, children: _jsx("ol", { role: 'list', className: 'hig-inline hig-breadcrumb', children: items.map((item, i) => _jsxs("li", { children: [i > 0 && _jsx("span", { "aria-hidden": 'true', className: 'hig-breadcrumb-separator', children: "/" }), item.href ? _jsx(Link, { href: item.href, "aria-current": i === items.length - 1 ? 'page' : undefined, children: item.label }) : _jsx("span", { "aria-current": i === items.length - 1 ? 'page' : undefined, children: item.label })] }, i)) }) }); }
67
+ export function Navigation({ label, items }) { return _jsx("nav", { "aria-label": label, className: 'hig-stack hig-navigation', children: items.map(item => _jsx(Link, { href: item.href, "aria-current": item.active ? 'page' : undefined, children: item.label }, item.href)) }); }
68
+ export function Pagination({ page, total, onPageChange }) { const { locale, messages } = useHIG(); return _jsxs("nav", { "aria-label": messages.pagination ?? en.pagination, className: 'hig-inline hig-pagination', children: [_jsx(Button, { intent: 'secondary', disabled: page <= 1, onClick: () => onPageChange(page - 1), children: messages.previous ?? en.previous }), _jsx("span", { children: (messages.pageOf ?? en.pageOf)(formatNumber(page, locale), formatNumber(total, locale)) }), _jsx(Button, { intent: 'secondary', disabled: page >= total, onClick: () => onPageChange(page + 1), children: messages.next ?? en.next })] }); }
69
+ export function Search({ query, onQueryChange, results, loading, error }) { const { messages } = useHIG(); return _jsxs("section", { children: [_jsx(Field, { label: messages.search ?? en.search, children: _jsx(SearchInput, { value: query, onChange: e => onQueryChange(e.target.value) }) }), loading ? _jsx("p", { role: 'status', children: messages.searching ?? en.searching }) : error ? _jsx("p", { role: 'alert', children: error }) : results.length ? _jsx("ul", { children: results.map(r => _jsx("li", { children: _jsx(Button, { intent: 'ghost', onClick: r.onSelect, children: r.label }) }, r.id)) }) : _jsx("p", { role: 'status', children: messages.noResults ?? en.noResults })] }); }
@@ -0,0 +1,14 @@
1
+ /** Where transient notices go. `Toaster` from `@bloxwap/hig/react/toast` registers itself here on mount, so components
2
+ * can raise a toast without importing the optional Sonner backend. */
3
+ export interface NotifyOptions {
4
+ severity?: 'info' | 'success' | 'warning' | 'error'; /** Accessible name of the notice's close button. */
5
+ dismissName?: string;
6
+ duration?: number;
7
+ id?: string | number;
8
+ }
9
+ type Notifier = (message: string, options?: NotifyOptions) => unknown;
10
+ /** Registers a notifier; returns its unregister function. */
11
+ export declare function registerNotifier(notifier: Notifier): () => void;
12
+ /** Raises a notice on the most recently mounted notifier. Returns false when none is mounted, so the caller can show the result inline. */
13
+ export declare function notify(message: string, options?: NotifyOptions): boolean;
14
+ export {};
@@ -0,0 +1,6 @@
1
+ const notifiers = new Set();
2
+ /** Registers a notifier; returns its unregister function. */
3
+ export function registerNotifier(notifier) { notifiers.add(notifier); return () => { notifiers.delete(notifier); }; }
4
+ /** Raises a notice on the most recently mounted notifier. Returns false when none is mounted, so the caller can show the result inline. */
5
+ export function notify(message, options) { const notifier = [...notifiers].pop(); if (!notifier)
6
+ return false; notifier(message, options); return true; }
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export { Dialog, Sheet, AlertDialog, type DialogProps, type DialogContentProps, type AlertDialogProps } from './dialog.js';
3
+ export declare function Menu({ label, items }: {
4
+ label: string;
5
+ items: readonly {
6
+ label: string;
7
+ disabled?: boolean;
8
+ onSelect: (event: Event) => void;
9
+ }[];
10
+ }): React.JSX.Element;
11
+ export declare function Popover({ label, children, closeLabel }: React.PropsWithChildren<{
12
+ label: string; /** Close button text and accessible name; defaults to HIGProvider `messages.close`. */
13
+ closeLabel?: string;
14
+ }>): React.JSX.Element;
15
+ export declare function Tooltip({ content, children }: React.PropsWithChildren<{
16
+ content: string;
17
+ }>): React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useId, useRef } from 'react';
4
+ import * as en from '@bloxwap/hig/contracts/messages';
5
+ import { useHIG, useThemeStyle } from './provider.js';
6
+ import * as Drop from '@radix-ui/react-dropdown-menu';
7
+ import * as Pop from '@radix-ui/react-popover';
8
+ import * as Tip from '@radix-ui/react-tooltip';
9
+ import { Button } from './button.js';
10
+ export { Dialog, Sheet, AlertDialog } from './dialog.js';
11
+ export function Menu({ label, items }) { const { feedback, direction, locale, density } = useHIG(); const themeStyle = useThemeStyle(); const id = useId(); const sequence = useRef(0); const origin = useRef('keyboard'); return _jsxs(Drop.Root, { dir: direction, children: [_jsx(Drop.Trigger, { asChild: true, children: _jsx(Button, { intent: 'secondary', suppressFeedback: true, children: label }) }), _jsx(Drop.Portal, { children: _jsx(Drop.Content, { className: 'hig-popover hig-menu', align: 'start', sideOffset: 6, collisionPadding: 16, style: themeStyle, lang: locale, "data-hig-density": density, children: items.map((item, i) => _jsx(Drop.Item, { disabled: item.disabled, className: 'hig-menu-item', onPointerDown: () => { origin.current = 'pointer'; }, onKeyDown: () => { origin.current = 'keyboard'; }, onSelect: event => { if (item.disabled)
12
+ return; item.onSelect(event); if (!event.defaultPrevented)
13
+ try {
14
+ feedback?.emit({ id: `${id}/${++sequence.current}`, source: id, intent: 'selection', origin: origin.current });
15
+ }
16
+ catch { /* Optional feedback cannot alter the action. */ } }, children: item.label }, i)) }) })] }); }
17
+ export function Popover({ label, children, closeLabel }) { const { messages, direction, locale, density } = useHIG(); const themeStyle = useThemeStyle(); return _jsxs(Pop.Root, { children: [_jsx(Pop.Trigger, { asChild: true, children: _jsx(Button, { intent: 'secondary', suppressFeedback: true, children: label }) }), _jsx(Pop.Portal, { children: _jsxs(Pop.Content, { className: 'hig-popover', sideOffset: 6, collisionPadding: 16, style: themeStyle, dir: direction, lang: locale, "data-hig-density": density, children: [children, _jsx(Pop.Close, { asChild: true, children: _jsx(Button, { intent: 'ghost', suppressFeedback: true, children: closeLabel ?? messages.close ?? en.close }) })] }) })] }); }
18
+ export function Tooltip({ content, children }) { const { direction, locale, density } = useHIG(); const themeStyle = useThemeStyle(); return _jsx(Tip.Provider, { children: _jsxs(Tip.Root, { children: [_jsx(Tip.Trigger, { asChild: true, children: children }), _jsx(Tip.Portal, { children: _jsx(Tip.Content, { className: 'hig-popover hig-tooltip', sideOffset: 6, collisionPadding: 16, style: themeStyle, dir: direction, lang: locale, "data-hig-density": density, children: content }) })] }) }); }
@@ -0,0 +1,25 @@
1
+ import type { FeedbackSink, FeedbackIntent } from '@bloxwap/hig/contracts/feedback';
2
+ import React from 'react';
3
+ import { type Environment } from '@bloxwap/hig/contracts';
4
+ import { type HIGMessages } from '@bloxwap/hig/contracts/messages';
5
+ import { nativeSrgb } from '@bloxwap/hig/tokens';
6
+ export type { HIGMessages } from '@bloxwap/hig/contracts/messages';
7
+ export interface HIGContext extends Environment {
8
+ onAccepted?: (id: string) => void;
9
+ feedback?: FeedbackSink; /** Brand accent as opaque sRGB hex (#RGB or #RRGGBB). Nested providers inherit it; omitted at the root, Bloxwap green applies. */
10
+ primaryColor?: string; /** Host translations of built-in copy, merged through nested providers. Components fall back to the English export per key; read the full resolved catalog with `useMessages()`. */
11
+ messages: Readonly<Partial<HIGMessages>>;
12
+ }
13
+ export interface HIGProviderProps extends Partial<Omit<HIGContext, 'messages'>> {
14
+ messages?: Partial<HIGMessages>;
15
+ }
16
+ export declare function HIGProvider({ children, density, locale, direction, reducedMotion, onAccepted, feedback, primaryColor, messages }: React.PropsWithChildren<HIGProviderProps>): React.JSX.Element;
17
+ export declare const useHIG: () => HIGContext;
18
+ /** Scoped primary colour variables for host-owned portals outside the provider's DOM. */
19
+ export declare function useThemeStyle(): React.CSSProperties | undefined;
20
+ /** Resolved sRGB roles for canvas and host-drawn content. CSS retains the default wide-gamut palette. */
21
+ export declare function useColors(): Readonly<Record<keyof typeof nativeSrgb, string>>;
22
+ /** Complete built-in copy for the nearest HIGProvider: host translations over the English defaults. */
23
+ export declare function useMessages(): HIGMessages;
24
+ /** Controlled values never silently switch to internal state. */
25
+ export declare function useControllable<T>(value: T | undefined, initial: T, onChange?: (value: T) => void, intent?: FeedbackIntent): [T, (next: T) => void];
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useEffect, useMemo, useState, useRef, useId } from 'react';
4
+ import { defaultEnvironment } from '@bloxwap/hig/contracts';
5
+ import { defaultMessages, resolveMessages } from '@bloxwap/hig/contracts/messages';
6
+ import { nativeSrgb, resolvePrimaryColor } from '@bloxwap/hig/tokens';
7
+ const Context = createContext({ ...defaultEnvironment, messages: {} });
8
+ export function HIGProvider({ children, density = 'comfortable', locale = 'en-US', direction = 'ltr', reducedMotion, onAccepted, feedback, primaryColor, messages }) {
9
+ const parent = useContext(Context);
10
+ const inherited = parent.messages;
11
+ const resolved = useMemo(() => resolveMessages(inherited, messages), [inherited, messages]);
12
+ const accent = primaryColor ?? parent.primaryColor;
13
+ const theme = useMemo(() => primaryStyle(accent), [accent]);
14
+ const [osReduced, setOSReduced] = useState(false);
15
+ useEffect(() => { const query = window.matchMedia?.('(prefers-reduced-motion: reduce)'); if (!query)
16
+ return; const update = () => setOSReduced(query.matches); update(); query.addEventListener('change', update); return () => query.removeEventListener('change', update); }, []);
17
+ return _jsx(Context.Provider, { value: { density, locale, direction, reducedMotion: reducedMotion ?? osReduced, onAccepted, feedback, primaryColor: accent, messages: resolved }, children: _jsx("div", { style: theme, "data-hig-density": density, "data-hig-motion": reducedMotion ?? osReduced ? 'reduced' : 'full', dir: direction, lang: locale, children: children }) });
18
+ }
19
+ export const useHIG = () => useContext(Context);
20
+ function primaryStyle(primaryColor) {
21
+ if (primaryColor === undefined)
22
+ return undefined;
23
+ const colors = resolvePrimaryColor(primaryColor);
24
+ return { '--hig-action': colors.action, '--hig-focus': colors.focus, '--hig-onAction': colors.onAction };
25
+ }
26
+ /** Scoped primary colour variables for host-owned portals outside the provider's DOM. */
27
+ export function useThemeStyle() { const { primaryColor } = useHIG(); return useMemo(() => primaryStyle(primaryColor), [primaryColor]); }
28
+ /** Resolved sRGB roles for canvas and host-drawn content. CSS retains the default wide-gamut palette. */
29
+ export function useColors() { const { primaryColor } = useHIG(); return useMemo(() => primaryColor === undefined ? nativeSrgb : { ...nativeSrgb, ...resolvePrimaryColor(primaryColor) }, [primaryColor]); }
30
+ /** Complete built-in copy for the nearest HIGProvider: host translations over the English defaults. */
31
+ export function useMessages() { const overrides = useContext(Context).messages; return useMemo(() => resolveMessages({ ...defaultMessages }, overrides), [overrides]); }
32
+ /** Controlled values never silently switch to internal state. */
33
+ export function useControllable(value, initial, onChange, intent = 'selection') {
34
+ const [internal, setInternal] = useState(initial);
35
+ const current = value === undefined ? internal : value;
36
+ const { feedback } = useHIG();
37
+ const id = useId();
38
+ const sequence = useRef(0);
39
+ const pending = useRef(null);
40
+ useEffect(() => { const request = pending.current; if (!request)
41
+ return; pending.current = null; if (Object.is(current, request.value)) {
42
+ try {
43
+ feedback?.emit({ id: `${id}/${++sequence.current}`, source: id, intent, origin: 'programmatic' });
44
+ }
45
+ catch { /* Effects remain optional. */ }
46
+ } });
47
+ return [current, (next) => { if (Object.is(current, next))
48
+ return; pending.current = { value: next }; if (value === undefined)
49
+ setInternal(next); onChange?.(next); }];
50
+ }
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export declare function ActivityList({ items }: {
3
+ items: readonly {
4
+ id: string;
5
+ label: string;
6
+ status: string;
7
+ }[];
8
+ }): React.JSX.Element;
@@ -0,0 +1,6 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as en from '@bloxwap/hig/contracts/messages';
4
+ import { useHIG } from '../provider.js';
5
+ import { Text } from '../surface.js';
6
+ export function ActivityList({ items }) { const { messages } = useHIG(); return items.length ? _jsx("ul", { children: items.map(i => _jsxs("li", { children: [_jsx("strong", { children: i.label }), " \u2014 ", i.status] }, i.id)) }) : _jsx(Text, { children: messages.noActivity ?? en.noActivity }); }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export declare function BalanceCard({ label, balance, stale }: {
3
+ label: string;
4
+ balance: number | null;
5
+ stale?: boolean;
6
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Surface, Text } from '../surface.js';
4
+ import { Usd } from '../data.js';
5
+ export function BalanceCard({ label, balance, stale }) { return _jsxs(Surface, { className: 'hig-balance-card', children: [_jsx(Text, { children: label }), _jsx(Usd, { value: balance, stale: stale })] }); }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare function CodeWindow({ language, children }: React.PropsWithChildren<{
3
+ language: string;
4
+ }>): React.JSX.Element;
@@ -0,0 +1,4 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Surface, Text } from '../surface.js';
4
+ export function CodeWindow({ language, children }) { return _jsxs(Surface, { children: [_jsx(Text, { children: language }), _jsx("pre", { className: 'hig-code', tabIndex: 0, children: _jsx("code", { children: children }) })] }); }
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ /** With a mounted `Toaster` (`@bloxwap/hig/react/toast`) the copy result is raised as a toast; without one it shows inline. Either way it is announced. This entry does not load Sonner. */
3
+ export declare function InstallCommand({ command, onCopy }: {
4
+ command: string;
5
+ onCopy: () => Promise<void> | void;
6
+ }): React.JSX.Element;
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { useState } from 'react';
4
+ import * as en from '@bloxwap/hig/contracts/messages';
5
+ import { useHIG } from '../provider.js';
6
+ import { Button } from '../button.js';
7
+ import { Surface } from '../surface.js';
8
+ import { notify } from '../notify.js';
9
+ /** With a mounted `Toaster` (`@bloxwap/hig/react/toast`) the copy result is raised as a toast; without one it shows inline. Either way it is announced. This entry does not load Sonner. */
10
+ export function InstallCommand({ command, onCopy }) {
11
+ const { messages } = useHIG();
12
+ const [status, setStatus] = useState({ text: '', toasted: false });
13
+ const report = (text, severity) => setStatus({ text, toasted: notify(text, { severity, id: 'hig-install-command', dismissName: (messages.dismissNotice ?? en.dismissNotice)(text, messages.dismiss ?? en.dismiss) }) });
14
+ return _jsxs(Surface, { children: [_jsx("pre", { className: 'hig-code', tabIndex: 0, children: _jsx("code", { children: command }) }), _jsx(Button, { intent: 'secondary', onClick: () => { Promise.resolve().then(onCopy).then(() => report(messages.copied ?? en.copied, 'success')).catch(() => report(messages.copyFailed ?? en.copyFailed, 'error')); }, children: messages.copyInstallCommand ?? en.copyInstallCommand }), _jsx("p", { role: 'status', className: status.toasted ? 'hig-sr-only' : undefined, children: status.text })] });
15
+ }
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ interface MarketRowContent {
3
+ symbol: string;
4
+ name: string;
5
+ price: number | null;
6
+ change: number | null; /** Intl display options, including a decimal style when the host omits a currency symbol. */
7
+ priceOptions?: Intl.NumberFormatOptions; /** Percent-point display precision/sign; forwarded to Percent. */
8
+ changeOptions?: Intl.NumberFormatOptions; /** Optional host-rendered market icon, favourite indicator/control and formatted volume. */
9
+ icon?: React.ReactNode;
10
+ favorite?: React.ReactNode;
11
+ volume?: React.ReactNode;
12
+ className?: string;
13
+ style?: React.CSSProperties;
14
+ }
15
+ export type MarketRowProps = MarketRowContent & ({
16
+ mode?: 'action';
17
+ onSelect: () => void;
18
+ identity?: never;
19
+ } | {
20
+ mode: 'presentation';
21
+ onSelect?: never; /** Host market identity, such as symbol/name with its existing compact layout. */
22
+ identity?: React.ReactNode;
23
+ });
24
+ export declare function MarketRow({ symbol, name, price, change, onSelect, priceOptions, changeOptions, mode, identity, icon, favorite, volume, className, style }: MarketRowProps): React.JSX.Element;
25
+ export {};
@@ -0,0 +1,8 @@
1
+ "use client";
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Button } from '../button.js';
4
+ import { Usd, Percent } from '../data.js';
5
+ export function MarketRow({ symbol, name, price, change, onSelect, priceOptions, changeOptions, mode = 'action', identity, icon, favorite, volume, className, style }) {
6
+ const content = _jsxs(_Fragment, { children: [favorite !== undefined && _jsx("span", { className: 'hig-market-favorite', children: favorite }), icon !== undefined && _jsx("span", { className: 'hig-market-icon', children: icon }), mode === 'presentation' ? _jsx("span", { className: 'hig-market-name', children: identity === undefined ? _jsxs(_Fragment, { children: [name, " (", symbol, ")"] }) : identity }) : _jsxs(Button, { intent: 'ghost', onClick: onSelect, children: [name, " (", symbol, ")"] })] });
7
+ return _jsxs("div", { className: `hig-row hig-market-row${className ? ` ${className}` : ''}`, style: style, "data-mode": mode, "data-has-volume": volume !== undefined || undefined, children: [_jsx("div", { className: 'hig-market-identity', children: content }), _jsx("span", { className: 'hig-market-price', children: _jsx(Usd, { value: price, options: priceOptions }) }), _jsx("span", { className: 'hig-market-change', children: _jsx(Percent, { value: change, options: changeOptions }) }), volume !== undefined && _jsx("span", { className: 'hig-market-volume', children: volume })] });
8
+ }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ export declare function MarketingHero({ title, description, href, cta }: {
3
+ title: string;
4
+ description: string;
5
+ href: string;
6
+ cta: string;
7
+ }): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ "use client";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Link } from '../button.js';
4
+ import { Heading, Text } from '../surface.js';
5
+ export function MarketingHero({ title, description, href, cta }) { return _jsxs("section", { children: [_jsx(Heading, { level: 1, children: title }), _jsx(Text, { children: description }), _jsx(Link, { href: href, children: cta })] }); }
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { type SwapChain, type SwapToken } from './swap/shared.js';
3
+ export type { SwapChain, SwapToken } from './swap/shared.js';
4
+ export interface SwapWallet {
5
+ connected: boolean;
6
+ address?: string | null;
7
+ }
8
+ /** The searchable token list both pickers share. */
9
+ export interface PickerListProps {
10
+ /** Tokens offered: a wallet's holdings, a whitelist, or a whole catalog. */
11
+ tokens: readonly SwapToken[];
12
+ /** Chain filter options. Derived from the tokens, in first-seen order, when omitted. */
13
+ chains?: readonly SwapChain[];
14
+ /** `false` leaves out the chain filter, for a list on one chain or one that should not be narrowed by chain. */
15
+ chainFilter?: boolean;
16
+ /** Token ids for a Hot section at the top of the unfiltered list, in rank order. */
17
+ hotTokenIds?: readonly string[];
18
+ selected?: SwapToken | null;
19
+ onSelect: (token: SwapToken) => void;
20
+ /** Shows the loading text in place of the empty text while the list is empty. */
21
+ loading?: boolean;
22
+ /** With a hardware pointer, focus the search field on mount so typing filters at once. */
23
+ autoFocus?: boolean;
24
+ }
25
+ export interface FromPickerProps extends PickerListProps {
26
+ /** The connected wallet. Omit for a list with no wallet row at all. */
27
+ wallet?: SwapWallet;
28
+ /** Shows Connect wallet while no wallet is connected. */
29
+ onConnect?: () => void;
30
+ /** Shows the disconnect button beside a connected wallet. Omit it where signing out does not belong. */
31
+ onDisconnect?: () => void;
32
+ /** 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. */
33
+ generateAddress?: boolean;
34
+ onGenerateAddressChange?: (generate: boolean) => void;
35
+ className?: string;
36
+ }
37
+ /**
38
+ * Where the assets come from. A connected wallet shows its address, with a disconnect button the host can leave out, above
39
+ * the tokens it holds (or a whitelist). With no wallet it offers Connect wallet and a Generate address switch above the list.
40
+ * The host owns the wallet, the token data and the generated address.
41
+ */
42
+ export declare function FromPicker({ wallet, onConnect, onDisconnect, generateAddress, onGenerateAddressChange, className, ...list }: FromPickerProps): React.JSX.Element;
43
+ export interface ToPickerProps extends Partial<PickerListProps> {
44
+ /** The destination address field. Omit `onAddressChange` to hide it. */
45
+ address?: string;
46
+ onAddressChange?: (address: string) => void;
47
+ /** Shown while the field is empty, for example the connected wallet shortened; defaults to the built-in label. */
48
+ addressPlaceholder?: string;
49
+ /** Shows the scan button. HIG ships no scanner: the host opens its own and writes the result to `address`. */
50
+ onScan?: () => void;
51
+ className?: string;
52
+ }
53
+ /**
54
+ * Where the assets go. On its own it is a destination address field with a scan button. With `tokens` it adds the
55
+ * searchable token list, with the chain filter or, with `chainFilter={false}`, without it.
56
+ */
57
+ export declare function ToPicker({ address, onAddressChange, addressPlaceholder, onScan, className, tokens, onSelect, ...list }: ToPickerProps): React.JSX.Element;