@agg-market/ui 6.0.0 → 8.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 (89) hide show
  1. package/README.md +17 -2
  2. package/dist/{chunk-G6YKGVQR.mjs → chunk-JE4MV5RL.mjs} +18 -60
  3. package/dist/{chunk-2ICOSP7N.mjs → chunk-KRCRD4AJ.mjs} +11 -14
  4. package/dist/{chunk-5ZKPBMRK.mjs → chunk-SBLIHCN2.mjs} +21 -24
  5. package/dist/{chunk-LMOJKJOY.mjs → chunk-TLFRGJ5B.mjs} +334 -217
  6. package/dist/chunk-WKY3IN52.mjs +4907 -0
  7. package/dist/events.js +3364 -2660
  8. package/dist/events.mjs +2 -5
  9. package/dist/index.js +2693 -1764
  10. package/dist/index.mjs +610 -38
  11. package/dist/modals.js +1356 -815
  12. package/dist/modals.mjs +2 -4
  13. package/dist/pages.js +3023 -2248
  14. package/dist/pages.mjs +4 -7
  15. package/dist/primitives.js +1072 -355
  16. package/dist/primitives.mjs +38 -30
  17. package/dist/styles.css +1 -1
  18. package/dist/tailwind.css +1 -1
  19. package/dist/trading.js +1153 -558
  20. package/dist/trading.mjs +2 -4
  21. package/dist/types/auth/connect-button-view/connect-button-view.constants.d.mts +31 -0
  22. package/dist/types/auth/connect-button-view/connect-button-view.constants.d.ts +31 -0
  23. package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +83 -0
  24. package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +83 -0
  25. package/dist/types/auth/connect-button-view/index.d.mts +7 -0
  26. package/dist/types/auth/connect-button-view/index.d.ts +7 -0
  27. package/dist/types/auth/index.d.mts +1 -1
  28. package/dist/types/auth/index.d.ts +1 -1
  29. package/dist/types/index.d.mts +1 -1
  30. package/dist/types/index.d.ts +1 -1
  31. package/dist/types/primitives/chart/chart-type-switch.d.mts +10 -0
  32. package/dist/types/primitives/chart/chart-type-switch.d.ts +10 -0
  33. package/dist/types/primitives/chart/index.d.mts +7 -1
  34. package/dist/types/primitives/chart/index.d.ts +7 -1
  35. package/dist/types/primitives/icon/index.d.mts +9 -1
  36. package/dist/types/primitives/icon/index.d.ts +9 -1
  37. package/dist/types/primitives/icon/registry.d.mts +32 -0
  38. package/dist/types/primitives/icon/registry.d.ts +32 -0
  39. package/dist/types/primitives/icon/svg/apple.d.mts +5 -0
  40. package/dist/types/primitives/icon/svg/apple.d.ts +5 -0
  41. package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +5 -0
  42. package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +5 -0
  43. package/dist/types/primitives/icon/svg/chart-line.d.mts +5 -0
  44. package/dist/types/primitives/icon/svg/chart-line.d.ts +5 -0
  45. package/dist/types/primitives/icon/svg/error-filled.d.mts +5 -0
  46. package/dist/types/primitives/icon/svg/error-filled.d.ts +5 -0
  47. package/dist/types/primitives/icon/svg/ethereum.d.mts +5 -0
  48. package/dist/types/primitives/icon/svg/ethereum.d.ts +5 -0
  49. package/dist/types/primitives/icon/svg/google.d.mts +5 -0
  50. package/dist/types/primitives/icon/svg/google.d.ts +5 -0
  51. package/dist/types/primitives/icon/svg/image.d.mts +5 -0
  52. package/dist/types/primitives/icon/svg/image.d.ts +5 -0
  53. package/dist/types/primitives/icon/svg/solana.d.mts +5 -0
  54. package/dist/types/primitives/icon/svg/solana.d.ts +5 -0
  55. package/dist/types/primitives/index.d.mts +2 -0
  56. package/dist/types/primitives/index.d.ts +2 -0
  57. package/dist/types/primitives/inline-alert/index.d.mts +16 -0
  58. package/dist/types/primitives/inline-alert/index.d.ts +16 -0
  59. package/dist/types/primitives/remote-image/index.d.mts +6 -0
  60. package/dist/types/primitives/remote-image/index.d.ts +6 -0
  61. package/dist/types/primitives/remote-image/remote-image.constants.d.mts +4 -0
  62. package/dist/types/primitives/remote-image/remote-image.constants.d.ts +4 -0
  63. package/dist/types/primitives/remote-image/remote-image.types.d.mts +16 -0
  64. package/dist/types/primitives/remote-image/remote-image.types.d.ts +16 -0
  65. package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +5 -0
  66. package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +5 -0
  67. package/dist/types/primitives/venue-logo/venue-logo.types.d.mts +1 -1
  68. package/dist/types/primitives/venue-logo/venue-logo.types.d.ts +1 -1
  69. package/dist/types/trading/types.d.mts +26 -26
  70. package/dist/types/trading/types.d.ts +26 -26
  71. package/package.json +3 -15
  72. package/dist/auth.d.mts +0 -1
  73. package/dist/auth.d.ts +0 -1
  74. package/dist/auth.js +0 -2290
  75. package/dist/auth.mjs +0 -8
  76. package/dist/chunk-ADGL6RFX.mjs +0 -214
  77. package/dist/chunk-CN7GI2RJ.mjs +0 -585
  78. package/dist/chunk-HI4EEDN5.mjs +0 -1880
  79. package/dist/chunk-INRG3D4M.mjs +0 -450
  80. package/dist/chunk-JE3Z52FD.mjs +0 -345
  81. package/dist/chunk-MHCHR65A.mjs +0 -165
  82. package/dist/chunk-PASXFYKQ.mjs +0 -81
  83. package/dist/chunk-UBBOLLOS.mjs +0 -999
  84. package/dist/types/auth/connect-button/connect-button.constants.d.mts +0 -10
  85. package/dist/types/auth/connect-button/connect-button.constants.d.ts +0 -10
  86. package/dist/types/auth/connect-button/connect-button.types.d.mts +0 -33
  87. package/dist/types/auth/connect-button/connect-button.types.d.ts +0 -33
  88. package/dist/types/auth/connect-button/index.d.mts +0 -7
  89. package/dist/types/auth/connect-button/index.d.ts +0 -7
@@ -1,585 +0,0 @@
1
- import {
2
- Button,
3
- WarningIcon,
4
- __objRest,
5
- __spreadProps,
6
- __spreadValues,
7
- cn,
8
- getIconA11yProps,
9
- getMotionClassName
10
- } from "./chunk-HI4EEDN5.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 == null ? void 0 : 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
- pointsByTime.set(Math.floor(point.time), point.value);
239
- });
240
- const sortedPoints = [...pointsByTime.entries()].sort((left, right) => left[0] - right[0]).map(([time, value]) => ({
241
- time,
242
- value
243
- }));
244
- return __spreadProps(__spreadValues({}, seriesItem), {
245
- points: sortedPoints
246
- });
247
- }).filter((seriesItem) => seriesItem.points.length > 0);
248
- };
249
- var defaultValueFormatter = (value) => {
250
- return `${Math.round(value)}%`;
251
- };
252
- var resolveTimeFormatter = (windowSeconds) => {
253
- return (timestamp) => {
254
- if (!Number.isFinite(timestamp))
255
- return "";
256
- if (windowSeconds <= 48 * 60 * 60) {
257
- return dayjs.unix(timestamp).format("HH:mm");
258
- }
259
- if (windowSeconds <= 14 * 24 * 60 * 60) {
260
- return dayjs.unix(timestamp).format("MMM D HH:mm");
261
- }
262
- return dayjs.unix(timestamp).format("MMM D");
263
- };
264
- };
265
- var toLivelinePoints = (points) => {
266
- return points.map((point) => ({
267
- time: point.time,
268
- value: point.value
269
- }));
270
- };
271
- var resolveWindowSeconds = (normalizedSeries) => {
272
- const timestamps = normalizedSeries.flatMap(
273
- (seriesItem) => seriesItem.points.map((point) => point.time)
274
- );
275
- if (timestamps.length <= 1)
276
- return 30;
277
- const minTimestamp = Math.min(...timestamps);
278
- const maxTimestamp = Math.max(...timestamps);
279
- const span = maxTimestamp - minTimestamp;
280
- if (!Number.isFinite(span) || span <= 0)
281
- return 30;
282
- return Math.max(1, Math.floor(span));
283
- };
284
- var resolveLatestValue = (points) => {
285
- const latestPoint = points[points.length - 1];
286
- if (!latestPoint)
287
- return 0;
288
- return latestPoint.value;
289
- };
290
- var resolveActiveSeriesId = (series, activeSeriesId) => {
291
- var _a, _b;
292
- if (activeSeriesId) {
293
- const matchingSeries = series.find((seriesItem) => seriesItem.id === activeSeriesId);
294
- if (matchingSeries) {
295
- return matchingSeries.id;
296
- }
297
- }
298
- return (_b = (_a = series[0]) == null ? void 0 : _a.id) != null ? _b : "";
299
- };
300
- var formatDefaultSeriesLabel = (seriesItem) => {
301
- return seriesItem.id.charAt(0).toUpperCase() + seriesItem.id.slice(1);
302
- };
303
- var renderDefaultSeriesControls = ({
304
- series,
305
- activeSeriesId,
306
- handleSeriesChange,
307
- defaultSeriesSwitchClassName,
308
- seriesSwitchAriaLabel,
309
- formatSeriesOptionAriaLabel
310
- }) => {
311
- return /* @__PURE__ */ jsx3(
312
- SwitchButton,
313
- {
314
- ariaLabel: seriesSwitchAriaLabel,
315
- className: defaultSeriesSwitchClassName,
316
- options: series.map((seriesItem) => ({
317
- value: seriesItem.id,
318
- label: formatDefaultSeriesLabel(seriesItem),
319
- ariaLabel: formatSeriesOptionAriaLabel(formatDefaultSeriesLabel(seriesItem))
320
- })),
321
- value: activeSeriesId,
322
- onValueChange: handleSeriesChange
323
- }
324
- );
325
- };
326
- var resolveSelectedSeries = (series, activeSeriesId) => {
327
- const availableSeriesIds = new Set(series.map((seriesItem) => seriesItem.id));
328
- if (!availableSeriesIds.has(activeSeriesId)) {
329
- return series[0];
330
- }
331
- return series.find((seriesItem) => seriesItem.id === activeSeriesId);
332
- };
333
- var LineChart = ({
334
- series,
335
- height = 280,
336
- width,
337
- classNames,
338
- isLoading = false,
339
- showSeriesControls = true,
340
- renderSeriesControls
341
- }) => {
342
- var _a, _b;
343
- const labels = useLabels();
344
- const { theme } = useSdkUiConfig2();
345
- const normalizedSeries = useMemo2(() => {
346
- return normalizeSeries(series);
347
- }, [series]);
348
- const [activeSeriesId, setActiveSeriesId] = useState2(
349
- () => resolveActiveSeriesId(normalizedSeries, null)
350
- );
351
- useEffect2(() => {
352
- setActiveSeriesId(
353
- (currentActiveSeriesId) => resolveActiveSeriesId(normalizedSeries, currentActiveSeriesId)
354
- );
355
- }, [normalizedSeries]);
356
- const livelineTheme = theme;
357
- const handleSeriesChange = (seriesId) => {
358
- setActiveSeriesId(seriesId);
359
- };
360
- const primarySeries = useMemo2(() => {
361
- return resolveSelectedSeries(normalizedSeries, activeSeriesId);
362
- }, [activeSeriesId, normalizedSeries]);
363
- const primaryData = useMemo2(() => {
364
- if (!primarySeries) {
365
- return [];
366
- }
367
- return toLivelinePoints(primarySeries.points);
368
- }, [primarySeries]);
369
- const primaryValue = useMemo2(() => {
370
- if (!primarySeries) {
371
- return 0;
372
- }
373
- return resolveLatestValue(primarySeries.points);
374
- }, [primarySeries]);
375
- const livelineSeries = useMemo2(() => {
376
- return normalizedSeries.map((seriesItem) => ({
377
- id: seriesItem.id,
378
- color: seriesItem.color,
379
- data: toLivelinePoints(seriesItem.points),
380
- value: resolveLatestValue(seriesItem.points)
381
- }));
382
- }, [normalizedSeries]);
383
- const windowSeconds = useMemo2(() => {
384
- return resolveWindowSeconds(normalizedSeries);
385
- }, [normalizedSeries]);
386
- const timeFormatter = useMemo2(() => {
387
- return resolveTimeFormatter(windowSeconds);
388
- }, [windowSeconds]);
389
- const seriesControls = showSeriesControls && normalizedSeries.length > 0 ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
390
- series: normalizedSeries,
391
- activeSeriesId,
392
- handleSeriesChange
393
- })) != null ? _a : normalizedSeries.length > 1 ? renderDefaultSeriesControls({
394
- series: normalizedSeries,
395
- activeSeriesId,
396
- handleSeriesChange,
397
- defaultSeriesSwitchClassName: classNames == null ? void 0 : classNames.defaultSeriesSwitch,
398
- seriesSwitchAriaLabel: labels.common.lineChartSeriesSwitchAria,
399
- formatSeriesOptionAriaLabel: labels.common.lineChartSeriesOptionAria
400
- }) : null : null;
401
- return /* @__PURE__ */ jsxs2("div", { className: cn("group/agg-chart", "w-full", classNames == null ? void 0 : classNames.root), style: { width }, children: [
402
- !isLoading && seriesControls ? /* @__PURE__ */ jsx3("div", { className: cn("mb-3", classNames == null ? void 0 : classNames.controls), children: seriesControls }) : null,
403
- /* @__PURE__ */ jsx3(
404
- "div",
405
- {
406
- className: cn(
407
- "overflow-hidden [&>div:not(.agg-livechart):first-of-type]:hidden!",
408
- classNames == null ? void 0 : classNames.chartViewport
409
- ),
410
- style: { height },
411
- role: "img",
412
- "aria-label": labels.common.lineChartAria,
413
- children: /* @__PURE__ */ jsx3(
414
- Liveline,
415
- {
416
- className: cn("h-full w-full agg-livechart", classNames == null ? void 0 : classNames.liveline),
417
- data: primaryData,
418
- value: primaryValue,
419
- series: livelineSeries,
420
- color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
421
- theme: livelineTheme,
422
- grid: true,
423
- momentum: false,
424
- pulse: false,
425
- window: windowSeconds,
426
- formatValue: defaultValueFormatter,
427
- formatTime: timeFormatter,
428
- padding: {
429
- top: 12,
430
- right: 80,
431
- bottom: 28,
432
- left: 12
433
- },
434
- loading: isLoading
435
- }
436
- )
437
- }
438
- )
439
- ] });
440
- };
441
- LineChart.displayName = "LineChart";
442
-
443
- // src/primitives/badge/badge.constants.ts
444
- var badgeSizes = ["small", "medium", "large"];
445
- var badgeSizeClasses = {
446
- small: cn("py-1.5 px-4 gap-1.5", "agg-type-label"),
447
- medium: cn("py-1.5 px-4 gap-2", "agg-type-body"),
448
- large: cn("py-2.5 px-6 gap-2", "agg-type-body")
449
- };
450
- var baseBadgeClasses = cn(
451
- "inline-flex items-center justify-center rounded-agg-full font-agg-sans",
452
- "bg-agg-secondary-hover text-agg-foreground whitespace-nowrap font-agg-normal"
453
- );
454
-
455
- // src/primitives/badge/index.tsx
456
- import { useSdkUiConfig as useSdkUiConfig3 } from "@agg-market/hooks";
457
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
458
- function Badge({
459
- text,
460
- prefix,
461
- suffix,
462
- size = "medium",
463
- classNames,
464
- onClick,
465
- isActive = false
466
- }) {
467
- const { enableAnimations } = useSdkUiConfig3();
468
- const resolvedText = `${text}`;
469
- const resolvedAriaLabel = resolvedText.length > 0 ? resolvedText : void 0;
470
- return /* @__PURE__ */ jsxs3(
471
- "span",
472
- __spreadProps(__spreadValues({
473
- "aria-label": resolvedAriaLabel,
474
- className: cn(
475
- "group/agg-badge",
476
- baseBadgeClasses,
477
- badgeSizeClasses[size],
478
- onClick ? "cursor-pointer hover:bg-agg-tertiary disabled:cursor-not-allowed" : "",
479
- getMotionClassName(
480
- enableAnimations,
481
- "transition-[border-color,background-color] duration-200 ease-in-out"
482
- ),
483
- isActive ? "border-agg-primary bg-agg-secondary! font-agg-bold!" : "border-transparent font-agg-normal",
484
- classNames == null ? void 0 : classNames.root
485
- )
486
- }, onClick && { onClick }), {
487
- children: [
488
- prefix ? /* @__PURE__ */ jsx4("span", { className: classNames == null ? void 0 : classNames.prefix, children: prefix }) : null,
489
- /* @__PURE__ */ jsx4("span", { className: cn("truncate", classNames == null ? void 0 : classNames.text), children: text }),
490
- suffix ? /* @__PURE__ */ jsx4("span", { className: classNames == null ? void 0 : classNames.suffix, children: suffix }) : null
491
- ]
492
- })
493
- );
494
- }
495
- Badge.displayName = "Badge";
496
-
497
- // src/primitives/search/search-empty-icon.tsx
498
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
499
- var SearchEmptyIcon = (_a) => {
500
- var _b = _a, { title, className } = _b, props = __objRest(_b, ["title", "className"]);
501
- return /* @__PURE__ */ jsxs4(
502
- "svg",
503
- __spreadProps(__spreadValues(__spreadValues({
504
- viewBox: "0 0 40 40",
505
- fill: "none",
506
- xmlns: "http://www.w3.org/2000/svg",
507
- className
508
- }, getIconA11yProps(title)), props), {
509
- children: [
510
- title ? /* @__PURE__ */ jsx5("title", { children: title }) : null,
511
- /* @__PURE__ */ jsx5("circle", { cx: "19.9987", cy: "20.0013", r: "9.2", stroke: "currentColor", strokeWidth: "1.6" }),
512
- /* @__PURE__ */ jsx5(
513
- "ellipse",
514
- {
515
- cx: "19.9987",
516
- cy: "20.0012",
517
- rx: "17.2",
518
- ry: "6.6",
519
- transform: "rotate(-35 19.9987 20.0012)",
520
- stroke: "currentColor",
521
- strokeWidth: "1.6"
522
- }
523
- )
524
- ]
525
- })
526
- );
527
- };
528
- SearchEmptyIcon.displayName = "SearchEmptyIcon";
529
-
530
- // src/primitives/state-message/index.tsx
531
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
532
- var iconClassName = "h-9 w-9 text-agg-muted-foreground";
533
- var StateMessage = ({
534
- ariaLabel,
535
- tone = "empty",
536
- title,
537
- description,
538
- actionLabel,
539
- onAction,
540
- className
541
- }) => {
542
- const icon = tone === "warning" ? /* @__PURE__ */ jsx6(WarningIcon, { className: iconClassName, "aria-hidden": true }) : /* @__PURE__ */ jsx6(SearchEmptyIcon, { className: iconClassName, "aria-hidden": true });
543
- return /* @__PURE__ */ jsx6(
544
- "div",
545
- {
546
- className: cn(
547
- "flex min-h-[240px] w-full flex-col items-center justify-center px-5 py-10 text-center md:px-10",
548
- className
549
- ),
550
- role: "status",
551
- "aria-live": "polite",
552
- "aria-label": ariaLabel,
553
- children: /* @__PURE__ */ jsxs5("div", { className: "flex max-w-[360px] flex-col items-center gap-6", children: [
554
- icon,
555
- /* @__PURE__ */ jsxs5("div", { className: "flex flex-col items-center gap-2", children: [
556
- /* @__PURE__ */ jsx6(Typography, { variant: "body-large-strong", children: title }),
557
- description ? /* @__PURE__ */ jsx6(Typography, { variant: "body", className: "whitespace-pre-line text-agg-muted-foreground", children: description }) : null
558
- ] }),
559
- actionLabel && onAction ? /* @__PURE__ */ jsx6(
560
- Button,
561
- {
562
- variant: "tertiary",
563
- size: "large",
564
- className: "text-agg-base leading-agg-6",
565
- "aria-label": actionLabel,
566
- onClick: onAction,
567
- children: actionLabel
568
- }
569
- ) : null
570
- ] })
571
- }
572
- );
573
- };
574
- StateMessage.displayName = "StateMessage";
575
-
576
- export {
577
- SwitchButton,
578
- typographyVariants,
579
- Typography,
580
- LineChart,
581
- badgeSizes,
582
- Badge,
583
- SearchEmptyIcon,
584
- StateMessage
585
- };