@agg-market/ui 7.0.0 → 9.0.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 (75) hide show
  1. package/dist/{chunk-MUB7NYWZ.mjs → chunk-3G7C6WEC.mjs} +3453 -990
  2. package/dist/{chunk-KQKLLL4D.mjs → chunk-3U4VHAP6.mjs} +8 -11
  3. package/dist/{chunk-6I474QXG.mjs → chunk-6CRY27SQ.mjs} +92 -65
  4. package/dist/{chunk-L5U7RGJV.mjs → chunk-HJ4UPYM7.mjs} +22 -23
  5. package/dist/{chunk-AVHMI47G.mjs → chunk-N7U7QCSB.mjs} +5 -6
  6. package/dist/events.js +2904 -2756
  7. package/dist/events.mjs +2 -4
  8. package/dist/index.js +1594 -1438
  9. package/dist/index.mjs +26 -32
  10. package/dist/modals.js +821 -687
  11. package/dist/modals.mjs +2 -3
  12. package/dist/pages.js +2145 -1993
  13. package/dist/pages.mjs +4 -7
  14. package/dist/primitives.js +417 -293
  15. package/dist/primitives.mjs +22 -28
  16. package/dist/styles.css +1 -1
  17. package/dist/tailwind.css +1 -1
  18. package/dist/trading.js +564 -451
  19. package/dist/trading.mjs +2 -4
  20. package/dist/types/events/item/event-list-item.types.d.mts +5 -2
  21. package/dist/types/events/item/event-list-item.types.d.ts +5 -2
  22. package/dist/types/events/item/event-list-item.utils.d.mts +5 -5
  23. package/dist/types/events/item/event-list-item.utils.d.ts +5 -5
  24. package/dist/types/events/item/index.d.mts +1 -1
  25. package/dist/types/events/item/index.d.ts +1 -1
  26. package/dist/types/events/item-details/event-list-item-details.types.d.mts +4 -3
  27. package/dist/types/events/item-details/event-list-item-details.types.d.ts +4 -3
  28. package/dist/types/events/list/event-list.types.d.mts +4 -4
  29. package/dist/types/events/list/event-list.types.d.ts +4 -4
  30. package/dist/types/events/list/event-list.utils.d.mts +5 -5
  31. package/dist/types/events/list/event-list.utils.d.ts +5 -5
  32. package/dist/types/events/market-details/market-details.types.d.mts +5 -3
  33. package/dist/types/events/market-details/market-details.types.d.ts +5 -3
  34. package/dist/types/events/market-details/market-details.utils.d.mts +16 -5
  35. package/dist/types/events/market-details/market-details.utils.d.ts +16 -5
  36. package/dist/types/onramp/index.d.mts +6 -0
  37. package/dist/types/onramp/index.d.ts +6 -0
  38. package/dist/types/onramp/onramp-modal.constants.d.mts +9 -0
  39. package/dist/types/onramp/onramp-modal.constants.d.ts +9 -0
  40. package/dist/types/onramp/onramp-modal.types.d.mts +64 -0
  41. package/dist/types/onramp/onramp-modal.types.d.ts +64 -0
  42. package/dist/types/onramp/steps/quote-card.d.mts +8 -0
  43. package/dist/types/onramp/steps/quote-card.d.ts +8 -0
  44. package/dist/types/onramp/steps/quote-form.d.mts +12 -0
  45. package/dist/types/onramp/steps/quote-form.d.ts +12 -0
  46. package/dist/types/onramp/steps/quote-selection.d.mts +14 -0
  47. package/dist/types/onramp/steps/quote-selection.d.ts +14 -0
  48. package/dist/types/onramp/steps/widget.d.mts +7 -0
  49. package/dist/types/onramp/steps/widget.d.ts +7 -0
  50. package/dist/types/pages/event-market/event-market.types.d.mts +2 -2
  51. package/dist/types/pages/event-market/event-market.types.d.ts +2 -2
  52. package/dist/types/primitives/chart/index.d.mts +10 -1
  53. package/dist/types/primitives/chart/index.d.ts +10 -1
  54. package/dist/types/primitives/icon/index.d.mts +2 -1
  55. package/dist/types/primitives/icon/index.d.ts +2 -1
  56. package/dist/types/primitives/icon/registry.d.mts +4 -0
  57. package/dist/types/primitives/icon/registry.d.ts +4 -0
  58. package/dist/types/primitives/icon/svg/image.d.mts +5 -0
  59. package/dist/types/primitives/icon/svg/image.d.ts +5 -0
  60. package/dist/types/primitives/index.d.mts +1 -0
  61. package/dist/types/primitives/index.d.ts +1 -0
  62. package/dist/types/primitives/remote-image/index.d.mts +6 -0
  63. package/dist/types/primitives/remote-image/index.d.ts +6 -0
  64. package/dist/types/primitives/remote-image/remote-image.constants.d.mts +4 -0
  65. package/dist/types/primitives/remote-image/remote-image.constants.d.ts +4 -0
  66. package/dist/types/primitives/remote-image/remote-image.types.d.mts +16 -0
  67. package/dist/types/primitives/remote-image/remote-image.types.d.ts +16 -0
  68. package/dist/types/trading/types.d.mts +2 -2
  69. package/dist/types/trading/types.d.ts +2 -2
  70. package/package.json +1 -1
  71. package/dist/chunk-EEQPPN7N.mjs +0 -214
  72. package/dist/chunk-EERL6BZF.mjs +0 -997
  73. package/dist/chunk-OAJBTVZT.mjs +0 -119
  74. package/dist/chunk-OVQVAUAI.mjs +0 -420
  75. package/dist/chunk-ZYUJ7YEJ.mjs +0 -645
@@ -1,645 +0,0 @@
1
- import {
2
- Button,
3
- WarningIcon,
4
- __objRest,
5
- __spreadProps,
6
- __spreadValues,
7
- cn,
8
- getIconA11yProps,
9
- getMotionClassName
10
- } from "./chunk-MUB7NYWZ.mjs";
11
-
12
- // src/primitives/switch-button/index.tsx
13
- import { useEffect, useMemo, useState } from "react";
14
- import { useSdkUiConfig } from "@agg-market/hooks";
15
- import { jsx, jsxs } from "react/jsx-runtime";
16
- var resolveActiveIndex = (options, value) => {
17
- const activeIndex = options.findIndex((option) => option.value === value);
18
- if (activeIndex >= 0)
19
- return activeIndex;
20
- return 0;
21
- };
22
- var resolveNextEnabledIndex = (options, currentIndex, direction) => {
23
- if (options.length <= 1)
24
- return currentIndex;
25
- const step = direction === "next" ? 1 : -1;
26
- for (let offset = 1; offset <= options.length; offset += 1) {
27
- const candidateIndex = (currentIndex + step * offset + options.length) % options.length;
28
- const candidate = options[candidateIndex];
29
- if (candidate && !candidate.disabled) {
30
- return candidateIndex;
31
- }
32
- }
33
- return currentIndex;
34
- };
35
- var SwitchButton = ({
36
- options,
37
- value,
38
- onValueChange,
39
- ariaLabel,
40
- className
41
- }) => {
42
- const { enableAnimations } = useSdkUiConfig();
43
- const activeIndex = useMemo(() => {
44
- return resolveActiveIndex(options, value);
45
- }, [options, value]);
46
- const [isAnimating, setIsAnimating] = useState(false);
47
- const [lastAnimatedIndex, setLastAnimatedIndex] = useState(activeIndex);
48
- useEffect(() => {
49
- if (lastAnimatedIndex === activeIndex) {
50
- return;
51
- }
52
- setLastAnimatedIndex(activeIndex);
53
- if (!enableAnimations) {
54
- setIsAnimating(false);
55
- return;
56
- }
57
- setIsAnimating(true);
58
- const timeoutId = window.setTimeout(() => {
59
- setIsAnimating(false);
60
- }, 350);
61
- return () => {
62
- window.clearTimeout(timeoutId);
63
- };
64
- }, [activeIndex, enableAnimations, lastAnimatedIndex]);
65
- if (options.length === 0) {
66
- return null;
67
- }
68
- const handleKeyDown = (event, optionIndex) => {
69
- if ((event == null ? void 0 : event.key) !== "ArrowLeft" && (event == null ? void 0 : event.key) !== "ArrowRight") {
70
- return;
71
- }
72
- event.preventDefault();
73
- const nextOptionIndex = resolveNextEnabledIndex(
74
- options,
75
- optionIndex,
76
- event.key === "ArrowRight" ? "next" : "previous"
77
- );
78
- const nextOption = options[nextOptionIndex];
79
- if (!nextOption || nextOption.disabled) {
80
- return;
81
- }
82
- onValueChange(nextOption.value);
83
- };
84
- return /* @__PURE__ */ jsx(
85
- "div",
86
- {
87
- className: cn(
88
- "group/agg-switch",
89
- "inline-flex min-w-0 rounded-agg-full bg-agg-secondary-hover font-agg-sans",
90
- getMotionClassName(enableAnimations, "transition-background duration-200 ease-in-out"),
91
- "cursor-pointer hover:bg-agg-tertiary",
92
- className
93
- ),
94
- children: /* @__PURE__ */ jsxs(
95
- "div",
96
- {
97
- className: "relative grid min-w-0 flex-1 items-center",
98
- style: {
99
- gridTemplateColumns: `repeat(${options.length}, minmax(0, 1fr))`
100
- },
101
- role: "tablist",
102
- "aria-label": ariaLabel,
103
- children: [
104
- /* @__PURE__ */ jsx(
105
- "span",
106
- {
107
- className: cn(
108
- "pointer-events-none absolute inset-y-0 left-0 rounded-agg-full border-2 border-agg-primary bg-agg-secondary",
109
- getMotionClassName(
110
- enableAnimations,
111
- "transition-transform duration-500 ease-[cubic-bezier(0.77,0,0.175,1)]"
112
- )
113
- ),
114
- style: {
115
- width: `${100 / options.length}%`,
116
- transform: `translateX(${activeIndex * 100}%) scaleX(${isAnimating ? 1.08 : 1})`
117
- },
118
- "aria-hidden": "true"
119
- }
120
- ),
121
- options.map((option, optionIndex) => {
122
- var _a;
123
- const isActive = optionIndex === activeIndex;
124
- return /* @__PURE__ */ jsx(
125
- "button",
126
- {
127
- type: "button",
128
- role: "tab",
129
- "aria-selected": isActive,
130
- "aria-label": (_a = option.ariaLabel) != null ? _a : void 0,
131
- tabIndex: isActive ? 0 : -1,
132
- disabled: option.disabled,
133
- className: cn(
134
- "relative z-10 min-w-0 rounded-agg-full px-5 py-1.5 font-agg-sans text-agg-base leading-agg-6 text-agg-foreground",
135
- getMotionClassName(
136
- enableAnimations,
137
- "transition-[colors] duration-200 ease-in-out"
138
- ),
139
- "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary-hover",
140
- "cursor-pointer disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
141
- isActive ? "font-agg-bold" : "font-agg-normal"
142
- ),
143
- onClick: (e) => {
144
- e.preventDefault();
145
- e.stopPropagation();
146
- if (option.disabled || isActive)
147
- return;
148
- onValueChange(option.value);
149
- },
150
- onKeyDown: (event) => {
151
- handleKeyDown(event, optionIndex);
152
- },
153
- children: option.label
154
- },
155
- option.value
156
- );
157
- })
158
- ]
159
- }
160
- )
161
- }
162
- );
163
- };
164
- SwitchButton.displayName = "SwitchButton";
165
-
166
- // src/primitives/typography/typography.constants.ts
167
- var typographyVariants = [
168
- "display",
169
- "heading",
170
- "title",
171
- "title-strong",
172
- "body-large",
173
- "body-large-strong",
174
- "body",
175
- "body-strong",
176
- "label",
177
- "label-strong",
178
- "label-caps",
179
- "caption",
180
- "caption-strong",
181
- "caption-caps",
182
- "overline"
183
- ];
184
- var typographyVariantClasses = {
185
- display: cn("agg-type-display"),
186
- heading: cn("agg-type-heading"),
187
- title: cn("agg-type-title"),
188
- "title-strong": cn("agg-type-title-strong"),
189
- "body-large": cn("agg-type-body-large"),
190
- "body-large-strong": cn("agg-type-body-large-strong"),
191
- body: cn("agg-type-body"),
192
- "body-strong": cn("agg-type-body-strong"),
193
- label: cn("agg-type-label"),
194
- "label-strong": cn("agg-type-label-strong"),
195
- "label-caps": cn("agg-type-label-caps"),
196
- caption: cn("agg-type-caption"),
197
- "caption-strong": cn("agg-type-caption-strong"),
198
- "caption-caps": cn("agg-type-caption-caps"),
199
- overline: cn("agg-type-overline")
200
- };
201
-
202
- // src/primitives/typography/index.tsx
203
- import { jsx as jsx2 } from "react/jsx-runtime";
204
- var Typography = ({
205
- as: Component = "p",
206
- variant = "body",
207
- className,
208
- children
209
- }) => {
210
- return /* @__PURE__ */ jsx2(
211
- Component,
212
- {
213
- className: cn(
214
- "group/agg-typography",
215
- "text-agg-foreground",
216
- typographyVariantClasses[variant],
217
- className
218
- ),
219
- children
220
- }
221
- );
222
- };
223
- Typography.displayName = "Typography";
224
-
225
- // src/primitives/chart/index.tsx
226
- import dayjs from "dayjs";
227
- import { useLabels, useSdkUiConfig as useSdkUiConfig2 } from "@agg-market/hooks";
228
- import { useEffect as useEffect2, useMemo as useMemo2, useState as useState2 } from "react";
229
- import { Liveline } from "liveline";
230
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
231
- var normalizeSeries = (series) => {
232
- return series.map((seriesItem) => {
233
- const pointsByTime = /* @__PURE__ */ new Map();
234
- seriesItem.points.forEach((point) => {
235
- if (!Number.isFinite(point.time) || !Number.isFinite(point.value)) {
236
- return;
237
- }
238
- const normalizedTime = Math.floor(point.time);
239
- const normalizedPoint = {
240
- time: normalizedTime,
241
- value: point.value,
242
- open: Number.isFinite(point.open) ? point.open : void 0,
243
- high: Number.isFinite(point.high) ? point.high : void 0,
244
- low: Number.isFinite(point.low) ? point.low : void 0,
245
- close: Number.isFinite(point.close) ? point.close : void 0
246
- };
247
- pointsByTime.set(normalizedTime, normalizedPoint);
248
- });
249
- const sortedPoints = [...pointsByTime.entries()].sort((left, right) => left[0] - right[0]).map(([, point]) => point);
250
- return __spreadProps(__spreadValues({}, seriesItem), {
251
- points: sortedPoints
252
- });
253
- }).filter((seriesItem) => seriesItem.points.length > 0);
254
- };
255
- var defaultValueFormatter = (value) => {
256
- return `${Math.round(value)}%`;
257
- };
258
- var resolveTimeFormatter = (windowSeconds) => {
259
- return (timestamp) => {
260
- if (!Number.isFinite(timestamp))
261
- return "";
262
- if (windowSeconds <= 48 * 60 * 60) {
263
- return dayjs.unix(timestamp).format("HH:mm");
264
- }
265
- if (windowSeconds <= 14 * 24 * 60 * 60) {
266
- return dayjs.unix(timestamp).format("MMM D HH:mm");
267
- }
268
- return dayjs.unix(timestamp).format("MMM D");
269
- };
270
- };
271
- var toLivelinePoints = (points) => {
272
- return points.map((point) => ({
273
- time: point.time,
274
- value: point.value
275
- }));
276
- };
277
- var toLivelineCandles = (points) => {
278
- return points.map((point) => {
279
- var _a, _b, _c, _d;
280
- const open = (_a = point.open) != null ? _a : point.value;
281
- const close = (_b = point.close) != null ? _b : point.value;
282
- const high = (_c = point.high) != null ? _c : Math.max(open, close, point.value);
283
- const low = (_d = point.low) != null ? _d : Math.min(open, close, point.value);
284
- if (!Number.isFinite(point.time) || !Number.isFinite(open) || !Number.isFinite(high) || !Number.isFinite(low) || !Number.isFinite(close)) {
285
- return null;
286
- }
287
- return {
288
- time: point.time,
289
- open,
290
- high: Math.max(open, close, high),
291
- low: Math.min(open, close, low),
292
- close
293
- };
294
- }).filter((point) => point != null);
295
- };
296
- var resolveCandleWidthSeconds = (points) => {
297
- if (points.length <= 1) {
298
- return void 0;
299
- }
300
- let minimumIntervalSeconds = null;
301
- for (let index = 1; index < points.length; index += 1) {
302
- const currentPoint = points[index];
303
- const previousPoint = points[index - 1];
304
- const intervalSeconds = currentPoint.time - previousPoint.time;
305
- if (!Number.isFinite(intervalSeconds) || intervalSeconds <= 0) {
306
- continue;
307
- }
308
- minimumIntervalSeconds = minimumIntervalSeconds == null ? intervalSeconds : Math.min(minimumIntervalSeconds, intervalSeconds);
309
- }
310
- if (minimumIntervalSeconds == null) {
311
- return void 0;
312
- }
313
- return Math.max(60, Math.floor(minimumIntervalSeconds));
314
- };
315
- var resolveWindowSeconds = (normalizedSeries) => {
316
- const timestamps = normalizedSeries.flatMap(
317
- (seriesItem) => seriesItem.points.map((point) => point.time)
318
- );
319
- if (timestamps.length <= 1)
320
- return 30;
321
- const minTimestamp = Math.min(...timestamps);
322
- const maxTimestamp = Math.max(...timestamps);
323
- const span = maxTimestamp - minTimestamp;
324
- if (!Number.isFinite(span) || span <= 0)
325
- return 30;
326
- return Math.max(1, Math.floor(span));
327
- };
328
- var resolveLatestValue = (points) => {
329
- const latestPoint = points[points.length - 1];
330
- if (!latestPoint)
331
- return 0;
332
- return latestPoint.value;
333
- };
334
- var resolveActiveSeriesId = (series, activeSeriesId) => {
335
- var _a, _b;
336
- if (activeSeriesId) {
337
- const matchingSeries = series.find((seriesItem) => seriesItem.id === activeSeriesId);
338
- if (matchingSeries) {
339
- return matchingSeries.id;
340
- }
341
- }
342
- return (_b = (_a = series[0]) == null ? void 0 : _a.id) != null ? _b : "";
343
- };
344
- var formatDefaultSeriesLabel = (seriesItem) => {
345
- return seriesItem.id.charAt(0).toUpperCase() + seriesItem.id.slice(1);
346
- };
347
- var renderDefaultSeriesControls = ({
348
- series,
349
- activeSeriesId,
350
- handleSeriesChange,
351
- defaultSeriesSwitchClassName,
352
- seriesSwitchAriaLabel,
353
- formatSeriesOptionAriaLabel
354
- }) => {
355
- return /* @__PURE__ */ jsx3(
356
- SwitchButton,
357
- {
358
- ariaLabel: seriesSwitchAriaLabel,
359
- className: defaultSeriesSwitchClassName,
360
- options: series.map((seriesItem) => ({
361
- value: seriesItem.id,
362
- label: formatDefaultSeriesLabel(seriesItem),
363
- ariaLabel: formatSeriesOptionAriaLabel(formatDefaultSeriesLabel(seriesItem))
364
- })),
365
- value: activeSeriesId,
366
- onValueChange: handleSeriesChange
367
- }
368
- );
369
- };
370
- var resolveSelectedSeries = (series, activeSeriesId) => {
371
- const availableSeriesIds = new Set(series.map((seriesItem) => seriesItem.id));
372
- if (!availableSeriesIds.has(activeSeriesId)) {
373
- return series[0];
374
- }
375
- return series.find((seriesItem) => seriesItem.id === activeSeriesId);
376
- };
377
- var LineChart = ({
378
- series,
379
- height = 280,
380
- width,
381
- classNames,
382
- isLoading = false,
383
- chartType = "line",
384
- showSeriesControls = true,
385
- renderSeriesControls
386
- }) => {
387
- var _a, _b;
388
- const labels = useLabels();
389
- const { theme } = useSdkUiConfig2();
390
- const normalizedSeries = useMemo2(() => {
391
- return normalizeSeries(series);
392
- }, [series]);
393
- const [activeSeriesId, setActiveSeriesId] = useState2(
394
- () => resolveActiveSeriesId(normalizedSeries, null)
395
- );
396
- useEffect2(() => {
397
- setActiveSeriesId(
398
- (currentActiveSeriesId) => resolveActiveSeriesId(normalizedSeries, currentActiveSeriesId)
399
- );
400
- }, [normalizedSeries]);
401
- const livelineTheme = theme;
402
- const handleSeriesChange = (seriesId) => {
403
- setActiveSeriesId(seriesId);
404
- };
405
- const primarySeries = useMemo2(() => {
406
- return resolveSelectedSeries(normalizedSeries, activeSeriesId);
407
- }, [activeSeriesId, normalizedSeries]);
408
- const primaryData = useMemo2(() => {
409
- if (!primarySeries) {
410
- return [];
411
- }
412
- return toLivelinePoints(primarySeries.points);
413
- }, [primarySeries]);
414
- const primaryCandles = useMemo2(() => {
415
- if (!primarySeries) {
416
- return [];
417
- }
418
- return toLivelineCandles(primarySeries.points);
419
- }, [primarySeries]);
420
- const primaryValue = useMemo2(() => {
421
- if (!primarySeries) {
422
- return 0;
423
- }
424
- return resolveLatestValue(primarySeries.points);
425
- }, [primarySeries]);
426
- const candleWidth = useMemo2(() => {
427
- if (!primarySeries) {
428
- return void 0;
429
- }
430
- return resolveCandleWidthSeconds(primarySeries.points);
431
- }, [primarySeries]);
432
- const livelineSeries = useMemo2(() => {
433
- return normalizedSeries.map((seriesItem) => ({
434
- id: seriesItem.id,
435
- color: seriesItem.color,
436
- data: toLivelinePoints(seriesItem.points),
437
- value: resolveLatestValue(seriesItem.points)
438
- }));
439
- }, [normalizedSeries]);
440
- const windowSeconds = useMemo2(() => {
441
- return resolveWindowSeconds(normalizedSeries);
442
- }, [normalizedSeries]);
443
- const timeFormatter = useMemo2(() => {
444
- return resolveTimeFormatter(windowSeconds);
445
- }, [windowSeconds]);
446
- const seriesControls = showSeriesControls && normalizedSeries.length > 0 ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
447
- series: normalizedSeries,
448
- activeSeriesId,
449
- handleSeriesChange
450
- })) != null ? _a : normalizedSeries.length > 1 ? renderDefaultSeriesControls({
451
- series: normalizedSeries,
452
- activeSeriesId,
453
- handleSeriesChange,
454
- defaultSeriesSwitchClassName: classNames == null ? void 0 : classNames.defaultSeriesSwitch,
455
- seriesSwitchAriaLabel: labels.common.lineChartSeriesSwitchAria,
456
- formatSeriesOptionAriaLabel: labels.common.lineChartSeriesOptionAria
457
- }) : null : null;
458
- return /* @__PURE__ */ jsxs2("div", { className: cn("group/agg-chart", "w-full", classNames == null ? void 0 : classNames.root), style: { width }, children: [
459
- !isLoading && seriesControls ? /* @__PURE__ */ jsx3("div", { className: cn("mb-3", classNames == null ? void 0 : classNames.controls), children: seriesControls }) : null,
460
- /* @__PURE__ */ jsx3(
461
- "div",
462
- {
463
- className: cn(
464
- "overflow-hidden [&>div:not(.agg-livechart):first-of-type]:hidden!",
465
- classNames == null ? void 0 : classNames.chartViewport
466
- ),
467
- style: { height },
468
- role: "img",
469
- "aria-label": chartType === "candlestick" ? labels.common.candlestickChartAria : labels.common.lineChartAria,
470
- children: /* @__PURE__ */ jsx3(
471
- Liveline,
472
- {
473
- className: cn("h-full w-full agg-livechart", classNames == null ? void 0 : classNames.liveline),
474
- data: primaryData,
475
- value: primaryValue,
476
- series: livelineSeries,
477
- color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
478
- theme: livelineTheme,
479
- grid: true,
480
- momentum: false,
481
- pulse: false,
482
- window: windowSeconds,
483
- mode: chartType === "candlestick" ? "candle" : "line",
484
- candles: chartType === "candlestick" ? primaryCandles : void 0,
485
- candleWidth: chartType === "candlestick" ? candleWidth : void 0,
486
- formatValue: defaultValueFormatter,
487
- formatTime: timeFormatter,
488
- padding: {
489
- top: 12,
490
- right: 80,
491
- bottom: 28,
492
- left: 12
493
- },
494
- loading: isLoading
495
- }
496
- )
497
- }
498
- )
499
- ] });
500
- };
501
- LineChart.displayName = "LineChart";
502
-
503
- // src/primitives/badge/badge.constants.ts
504
- var badgeSizes = ["small", "medium", "large"];
505
- var badgeSizeClasses = {
506
- small: cn("py-1.5 px-4 gap-1.5", "agg-type-label"),
507
- medium: cn("py-1.5 px-4 gap-2", "agg-type-body"),
508
- large: cn("py-2.5 px-6 gap-2", "agg-type-body")
509
- };
510
- var baseBadgeClasses = cn(
511
- "inline-flex items-center justify-center rounded-agg-full font-agg-sans",
512
- "bg-agg-secondary-hover text-agg-foreground whitespace-nowrap font-agg-normal"
513
- );
514
-
515
- // src/primitives/badge/index.tsx
516
- import { useSdkUiConfig as useSdkUiConfig3 } from "@agg-market/hooks";
517
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
518
- function Badge({
519
- text,
520
- prefix,
521
- suffix,
522
- size = "medium",
523
- classNames,
524
- onClick,
525
- isActive = false
526
- }) {
527
- const { enableAnimations } = useSdkUiConfig3();
528
- const resolvedText = `${text}`;
529
- const resolvedAriaLabel = resolvedText.length > 0 ? resolvedText : void 0;
530
- return /* @__PURE__ */ jsxs3(
531
- "span",
532
- __spreadProps(__spreadValues({
533
- "aria-label": resolvedAriaLabel,
534
- className: cn(
535
- "group/agg-badge",
536
- baseBadgeClasses,
537
- badgeSizeClasses[size],
538
- onClick ? "cursor-pointer hover:bg-agg-tertiary disabled:cursor-not-allowed" : "",
539
- getMotionClassName(
540
- enableAnimations,
541
- "transition-[border-color,background-color] duration-200 ease-in-out"
542
- ),
543
- isActive ? "border-agg-primary bg-agg-secondary! font-agg-bold!" : "border-transparent font-agg-normal",
544
- classNames == null ? void 0 : classNames.root
545
- )
546
- }, onClick && { onClick }), {
547
- children: [
548
- prefix ? /* @__PURE__ */ jsx4("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
549
- /* @__PURE__ */ jsx4("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
550
- suffix ? /* @__PURE__ */ jsx4("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
551
- ]
552
- })
553
- );
554
- }
555
- Badge.displayName = "Badge";
556
-
557
- // src/primitives/search/search-empty-icon.tsx
558
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
559
- var SearchEmptyIcon = (_a) => {
560
- var _b = _a, { title, className } = _b, props = __objRest(_b, ["title", "className"]);
561
- return /* @__PURE__ */ jsxs4(
562
- "svg",
563
- __spreadProps(__spreadValues(__spreadValues({
564
- viewBox: "0 0 40 40",
565
- fill: "none",
566
- xmlns: "http://www.w3.org/2000/svg",
567
- className
568
- }, getIconA11yProps(title)), props), {
569
- children: [
570
- title ? /* @__PURE__ */ jsx5("title", { children: title }) : null,
571
- /* @__PURE__ */ jsx5("circle", { cx: "19.9987", cy: "20.0013", r: "9.2", stroke: "currentColor", strokeWidth: "1.6" }),
572
- /* @__PURE__ */ jsx5(
573
- "ellipse",
574
- {
575
- cx: "19.9987",
576
- cy: "20.0012",
577
- rx: "17.2",
578
- ry: "6.6",
579
- transform: "rotate(-35 19.9987 20.0012)",
580
- stroke: "currentColor",
581
- strokeWidth: "1.6"
582
- }
583
- )
584
- ]
585
- })
586
- );
587
- };
588
- SearchEmptyIcon.displayName = "SearchEmptyIcon";
589
-
590
- // src/primitives/state-message/index.tsx
591
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
592
- var iconClassName = "h-9 w-9 text-agg-muted-foreground";
593
- var StateMessage = ({
594
- ariaLabel,
595
- tone = "empty",
596
- title,
597
- description,
598
- actionLabel,
599
- onAction,
600
- className
601
- }) => {
602
- const icon = tone === "warning" ? /* @__PURE__ */ jsx6(WarningIcon, { className: iconClassName, "aria-hidden": true }) : /* @__PURE__ */ jsx6(SearchEmptyIcon, { className: iconClassName, "aria-hidden": true });
603
- return /* @__PURE__ */ jsx6(
604
- "div",
605
- {
606
- className: cn(
607
- "flex min-h-[240px] w-full flex-col items-center justify-center px-5 py-10 text-center md:px-10",
608
- className
609
- ),
610
- role: "status",
611
- "aria-live": "polite",
612
- "aria-label": ariaLabel,
613
- children: /* @__PURE__ */ jsxs5("div", { className: "flex max-w-[360px] flex-col items-center gap-6", children: [
614
- icon,
615
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center gap-2", children: [
616
- /* @__PURE__ */ jsx6(Typography, { variant: "body-large-strong", children: title }),
617
- description ? /* @__PURE__ */ jsx6(Typography, { variant: "body", className: "whitespace-pre-line text-agg-muted-foreground", children: description }) : null
618
- ] }),
619
- actionLabel && onAction ? /* @__PURE__ */ jsx6(
620
- Button,
621
- {
622
- variant: "tertiary",
623
- size: "large",
624
- className: "text-agg-base leading-agg-6",
625
- "aria-label": actionLabel,
626
- onClick: onAction,
627
- children: actionLabel
628
- }
629
- ) : null
630
- ] })
631
- }
632
- );
633
- };
634
- StateMessage.displayName = "StateMessage";
635
-
636
- export {
637
- SwitchButton,
638
- typographyVariants,
639
- Typography,
640
- LineChart,
641
- badgeSizes,
642
- Badge,
643
- SearchEmptyIcon,
644
- StateMessage
645
- };