@hivemindhq/core 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +224 -0
  2. package/dist/chunk-2RGM3KJL.js +351 -0
  3. package/dist/chunk-2RGM3KJL.js.map +1 -0
  4. package/dist/chunk-E5TTKYNS.js +55 -0
  5. package/dist/chunk-E5TTKYNS.js.map +1 -0
  6. package/dist/chunk-ERZSVDIB.js +270 -0
  7. package/dist/chunk-ERZSVDIB.js.map +1 -0
  8. package/dist/chunk-H4RMZQ2Z.js +213 -0
  9. package/dist/chunk-H4RMZQ2Z.js.map +1 -0
  10. package/dist/chunk-K7EIJSYQ.js +3 -0
  11. package/dist/chunk-K7EIJSYQ.js.map +1 -0
  12. package/dist/chunk-OJF67RNM.js +3 -0
  13. package/dist/chunk-OJF67RNM.js.map +1 -0
  14. package/dist/chunk-P5E2XNDI.js +2758 -0
  15. package/dist/chunk-P5E2XNDI.js.map +1 -0
  16. package/dist/chunk-T2XWV636.js +137 -0
  17. package/dist/chunk-T2XWV636.js.map +1 -0
  18. package/dist/chunk-VIRNUAYY.js +11 -0
  19. package/dist/chunk-VIRNUAYY.js.map +1 -0
  20. package/dist/components/index.d.ts +277 -0
  21. package/dist/components/index.js +6 -0
  22. package/dist/components/index.js.map +1 -0
  23. package/dist/components/ui/index.d.ts +396 -0
  24. package/dist/components/ui/index.js +6 -0
  25. package/dist/components/ui/index.js.map +1 -0
  26. package/dist/hooks/index.d.ts +27 -0
  27. package/dist/hooks/index.js +4 -0
  28. package/dist/hooks/index.js.map +1 -0
  29. package/dist/index.d.ts +34 -0
  30. package/dist/index.js +11 -0
  31. package/dist/index.js.map +1 -0
  32. package/dist/toast-D090UYOq.d.ts +19 -0
  33. package/dist/types/index.d.ts +2 -0
  34. package/dist/types/index.js +3 -0
  35. package/dist/types/index.js.map +1 -0
  36. package/dist/utils/index.d.ts +573 -0
  37. package/dist/utils/index.js +5 -0
  38. package/dist/utils/index.js.map +1 -0
  39. package/package.json +107 -0
  40. package/tailwind.config.js +96 -0
@@ -0,0 +1,11 @@
1
+ import { clsx } from 'clsx';
2
+ import { twMerge } from 'tailwind-merge';
3
+
4
+ // src/utils/cn.ts
5
+ function cn(...inputs) {
6
+ return twMerge(clsx(inputs));
7
+ }
8
+
9
+ export { cn };
10
+ //# sourceMappingURL=chunk-VIRNUAYY.js.map
11
+ //# sourceMappingURL=chunk-VIRNUAYY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/cn.ts"],"names":[],"mappings":";;;;AAcO,SAAS,MAAM,MAAA,EAAsB;AAC1C,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,MAAM,CAAC,CAAA;AAC7B","file":"chunk-VIRNUAYY.js","sourcesContent":["import { clsx, type ClassValue } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\n\n/**\n * Combines class names using clsx and merges Tailwind classes intelligently.\n * This is the standard utility for conditional and merged class names.\n *\n * @param inputs - Class values to combine (strings, objects, arrays)\n * @returns Merged class string with Tailwind conflicts resolved\n *\n * @example\n * cn('px-4 py-2', isActive && 'bg-blue-500', { 'opacity-50': isDisabled })\n * // Returns: \"px-4 py-2 bg-blue-500\" (if isActive is true, isDisabled is false)\n */\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\n"]}
@@ -0,0 +1,277 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import React__default from 'react';
3
+
4
+ declare const AtomIcon: ({ ...props }: React.SVGProps<SVGSVGElement>) => react_jsx_runtime.JSX.Element;
5
+
6
+ interface UnknownImageProps extends React__default.ImgHTMLAttributes<HTMLImageElement> {
7
+ /** The image source URL - can be IPFS, HTTP, or raw hash */
8
+ src: string;
9
+ /** Whether to wrap the image in an anchor link to the source */
10
+ asLink?: boolean;
11
+ }
12
+ /**
13
+ * An image component that handles various URL formats including IPFS.
14
+ * Automatically converts IPFS URIs and hashes to gateway URLs.
15
+ *
16
+ * @example
17
+ * <UnknownImage src="ipfs://QmHash123" alt="My image" className="w-10 h-10" />
18
+ */
19
+ declare const UnknownImage: ({ asLink, src, ...props }: UnknownImageProps) => react_jsx_runtime.JSX.Element | null;
20
+
21
+ interface LoadingDotsProps {
22
+ /** Duration of opacity transition in ms */
23
+ transitionDuration?: number;
24
+ /** Whether the dots are visible */
25
+ isVisible?: boolean;
26
+ /** Additional CSS classes */
27
+ className?: string;
28
+ }
29
+ /**
30
+ * Animated loading dots indicator.
31
+ * Shows three dots with a wave animation.
32
+ *
33
+ * @example
34
+ * <LoadingDots isVisible={isLoading} />
35
+ */
36
+ declare function LoadingDots({ transitionDuration, isVisible, className, }: LoadingDotsProps): react_jsx_runtime.JSX.Element;
37
+
38
+ interface IpfsImageProps extends React__default.ImgHTMLAttributes<HTMLImageElement> {
39
+ /** The image source - can be an ipfs:// URI or regular URL */
40
+ src: string;
41
+ }
42
+ /**
43
+ * An image component that automatically converts IPFS URIs to gateway URLs.
44
+ *
45
+ * @example
46
+ * <IpfsImage src="ipfs://QmHash123" alt="IPFS image" />
47
+ */
48
+ declare const IpfsImage: ({ src, ...props }: IpfsImageProps) => react_jsx_runtime.JSX.Element;
49
+
50
+ interface TornadoGraphDataPoint {
51
+ /** The range identifier/name */
52
+ name: number;
53
+ /** Vault balance for this range */
54
+ vaultBalance?: number;
55
+ /** Counter vault balance for this range */
56
+ counterVaultBalance?: number;
57
+ /** Aggregate vault balance (positive side) */
58
+ aggregateVaultBalance: number;
59
+ /** Aggregate counter vault balance (negative side) */
60
+ aggregateCounterVaultBalance: number;
61
+ }
62
+ interface TriplePositionsTornadoMinGraphProps {
63
+ /** Pre-formatted data for the tornado chart */
64
+ data: TornadoGraphDataPoint[];
65
+ /** Color for the "FOR" (vault) bars */
66
+ forColor?: string;
67
+ /** Color for the "AGAINST" (counter vault) bars */
68
+ againstColor?: string;
69
+ /** Additional className for the container */
70
+ className?: string;
71
+ }
72
+ /**
73
+ * A minimal tornado/butterfly chart for displaying triple position distributions.
74
+ * Shows FOR positions (green) on the right and AGAINST positions (red) on the left.
75
+ *
76
+ * @example
77
+ * <TriplePositionsTornadoMinGraph
78
+ * data={formattedRanges}
79
+ * forColor="#31ad31"
80
+ * againstColor="#bc4535"
81
+ * />
82
+ */
83
+ declare const TriplePositionsTornadoMinGraph: ({ data, forColor, againstColor, className, }: TriplePositionsTornadoMinGraphProps) => react_jsx_runtime.JSX.Element | null;
84
+
85
+ interface TripleAreaChartDataPoint {
86
+ /** The x-axis value (typically position value) */
87
+ xValue: number;
88
+ /** Vault (FOR) position value */
89
+ vault?: number;
90
+ /** Counter vault (AGAINST) position value */
91
+ counterVault?: number;
92
+ }
93
+ interface TripleAreaChartProps {
94
+ /** Pre-formatted chart data points */
95
+ chartData: TripleAreaChartDataPoint[];
96
+ /** Display variant - 'min' hides axes/grid, 'max' shows full chart */
97
+ variant?: 'min' | 'max';
98
+ /** Color for vault (FOR) area */
99
+ vaultColor?: string;
100
+ /** Color for counter vault (AGAINST) area */
101
+ counterVaultColor?: string;
102
+ }
103
+ /**
104
+ * An area chart for visualizing triple position distributions.
105
+ * Shows vault (FOR) positions on positive side and counter vault (AGAINST) on negative.
106
+ *
107
+ * @example
108
+ * <TripleAreaChart
109
+ * chartData={formattedPositions}
110
+ * variant="min"
111
+ * />
112
+ */
113
+ declare const TripleAreaChart: ({ chartData, variant, vaultColor, counterVaultColor, }: TripleAreaChartProps) => react_jsx_runtime.JSX.Element;
114
+
115
+ interface ErrorBannerProps {
116
+ /** The error message to display */
117
+ error: string;
118
+ /** Optional HTTP status code */
119
+ code?: number;
120
+ /** Additional CSS classes */
121
+ className?: string;
122
+ }
123
+ /**
124
+ * A simple error banner component for displaying error messages.
125
+ * Centered layout with large heading and subtitle.
126
+ *
127
+ * @example
128
+ * <ErrorBanner error="Page not found" code={404} />
129
+ */
130
+ declare const ErrorBanner: ({ error, code, className }: ErrorBannerProps) => react_jsx_runtime.JSX.Element;
131
+
132
+ /**
133
+ * Display variant for the CryptoAmount component.
134
+ *
135
+ * - `default`: Crypto on top, fiat below (stacked)
136
+ * - `inline`: Single line with fiat in parentheses
137
+ * - `crypto-only`: Just the native token amount
138
+ * - `fiat-only`: Just the fiat equivalent (useful for previews)
139
+ * - `compact`: Abbreviated format for large amounts (1.5M TRUST)
140
+ */
141
+ type CryptoAmountVariant = 'default' | 'inline' | 'crypto-only' | 'fiat-only' | 'compact';
142
+ /**
143
+ * Size variant for the CryptoAmount component.
144
+ */
145
+ type CryptoAmountSize = 'sm' | 'md' | 'lg';
146
+ interface CryptoAmountProps {
147
+ /**
148
+ * The crypto amount. By default, expects wei/smallest unit (string or bigint).
149
+ * If `isTokenUnits` is true, expects the value already in token units (e.g., 1.5 for 1.5 TRUST).
150
+ */
151
+ value: string | bigint | number;
152
+ /** Number of decimals for the token (default: 18). Ignored when isTokenUnits is true. */
153
+ decimals?: number;
154
+ /**
155
+ * When true, the value is already in token units (e.g., 1.5 for 1.5 TRUST).
156
+ * When false (default), the value is in wei/smallest units and will be converted.
157
+ */
158
+ isTokenUnits?: boolean;
159
+ /** Token symbol to display (e.g., 'TRUST', 'ETH') */
160
+ symbol: string;
161
+ /**
162
+ * Exchange rate for fiat conversion (1 token = X fiat).
163
+ * If undefined/null, fiat display is hidden.
164
+ */
165
+ exchangeRate?: number | null;
166
+ /**
167
+ * Fiat currency code for formatting (default: 'USD').
168
+ * Used with Intl.NumberFormat for proper currency display.
169
+ */
170
+ currencyCode?: string;
171
+ /**
172
+ * Locale for number/currency formatting (default: browser locale or 'en-US')
173
+ */
174
+ locale?: string;
175
+ /** Display variant (default: 'default') */
176
+ variant?: CryptoAmountVariant;
177
+ /** Size variant (default: 'md') */
178
+ size?: CryptoAmountSize;
179
+ /**
180
+ * Maximum significant digits before truncation (default: 10).
181
+ * Amounts exceeding this will show "..." with full value in tooltip.
182
+ */
183
+ maxSignificantDigits?: number;
184
+ /**
185
+ * Maximum decimal places to display (default: 6).
186
+ * Applied after conversion but before significant digit truncation.
187
+ */
188
+ maxDecimals?: number;
189
+ /** Whether to show the token symbol (default: true) */
190
+ showSymbol?: boolean;
191
+ /** Whether to show fiat value when exchange rate is available (default: true) */
192
+ showFiat?: boolean;
193
+ /** Additional CSS classes for the container */
194
+ className?: string;
195
+ /** Additional CSS classes for the crypto amount text */
196
+ cryptoClassName?: string;
197
+ /** Additional CSS classes for the fiat amount text */
198
+ fiatClassName?: string;
199
+ }
200
+ /**
201
+ * A unified component for displaying cryptocurrency amounts with optional fiat conversion.
202
+ *
203
+ * Features:
204
+ * - Crypto-first display (native token amount is primary)
205
+ * - Optional fiat conversion shown as secondary
206
+ * - Truncation with tooltip for large amounts
207
+ * - Multiple display variants (stacked, inline, compact)
208
+ * - Proper number formatting based on locale
209
+ *
210
+ * @example
211
+ * ```tsx
212
+ * // Basic usage - stacked display
213
+ * <CryptoAmount
214
+ * value="1500000000000000000"
215
+ * symbol="TRUST"
216
+ * exchangeRate={0.42}
217
+ * />
218
+ * // Renders:
219
+ * // 1.5 TRUST
220
+ * // $0.63
221
+ *
222
+ * // Inline variant
223
+ * <CryptoAmount
224
+ * value="1500000000000000000"
225
+ * symbol="TRUST"
226
+ * exchangeRate={0.42}
227
+ * variant="inline"
228
+ * />
229
+ * // Renders: 1.5 TRUST (~$0.63)
230
+ *
231
+ * // Compact variant for large amounts
232
+ * <CryptoAmount
233
+ * value="1500000000000000000000000"
234
+ * symbol="TRUST"
235
+ * variant="compact"
236
+ * />
237
+ * // Renders: 1.5M TRUST
238
+ * ```
239
+ */
240
+ declare function CryptoAmount({ value, decimals, isTokenUnits, symbol, exchangeRate, currencyCode, locale, variant, size, maxSignificantDigits, maxDecimals, showSymbol, showFiat, className, cryptoClassName, fiatClassName, }: CryptoAmountProps): react_jsx_runtime.JSX.Element | null;
241
+
242
+ /**
243
+ * Props subset for creating a CryptoAmount from an exchange rate context.
244
+ * Use this type when building a hook wrapper in your app.
245
+ */
246
+ type CryptoAmountRateProps = Pick<CryptoAmountProps, 'exchangeRate' | 'currencyCode' | 'locale'>;
247
+ /**
248
+ * Creates CryptoAmountRateProps from an exchange rate and currency settings.
249
+ * This is a helper for building hook wrappers in consuming applications.
250
+ *
251
+ * @param exchangeRate - The current exchange rate (1 token = X fiat), or null/undefined
252
+ * @param currencyCode - The fiat currency code (e.g., 'USD', 'EUR')
253
+ * @param locale - Optional locale for formatting
254
+ * @returns Props object to spread onto CryptoAmount
255
+ *
256
+ * @example
257
+ * ```tsx
258
+ * // In your app's hook wrapper:
259
+ * export function useCryptoAmountProps() {
260
+ * const { data } = useExchangeRates()
261
+ * const { selectedCurrency } = useCurrency()
262
+ *
263
+ * return createCryptoAmountRateProps(
264
+ * data?.rate,
265
+ * selectedCurrency,
266
+ * navigator.language
267
+ * )
268
+ * }
269
+ *
270
+ * // Then in components:
271
+ * const rateProps = useCryptoAmountProps()
272
+ * <CryptoAmount value="1000000000000000000" symbol="TRUST" {...rateProps} />
273
+ * ```
274
+ */
275
+ declare function createCryptoAmountRateProps(exchangeRate: number | null | undefined, currencyCode?: string, locale?: string): CryptoAmountRateProps;
276
+
277
+ export { AtomIcon, CryptoAmount, type CryptoAmountProps, type CryptoAmountRateProps, type CryptoAmountSize, type CryptoAmountVariant, ErrorBanner, type ErrorBannerProps, IpfsImage, type IpfsImageProps, LoadingDots, type LoadingDotsProps, type TornadoGraphDataPoint, TripleAreaChart, type TripleAreaChartDataPoint, type TripleAreaChartProps, TriplePositionsTornadoMinGraph, type TriplePositionsTornadoMinGraphProps, UnknownImage, type UnknownImageProps, createCryptoAmountRateProps };
@@ -0,0 +1,6 @@
1
+ export { AtomIcon, CryptoAmount, ErrorBanner, IpfsImage, LoadingDots, TripleAreaChart, TriplePositionsTornadoMinGraph, UnknownImage, createCryptoAmountRateProps } from '../chunk-2RGM3KJL.js';
2
+ import '../chunk-ERZSVDIB.js';
3
+ import '../chunk-E5TTKYNS.js';
4
+ import '../chunk-VIRNUAYY.js';
5
+ //# sourceMappingURL=index.js.map
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}