@agg-market/ui 0.0.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.
- package/dist/badge.d.mts +26 -0
- package/dist/badge.d.ts +26 -0
- package/dist/badge.js +70 -0
- package/dist/badge.mjs +9 -0
- package/dist/button.d.mts +20 -0
- package/dist/button.d.ts +20 -0
- package/dist/button.js +197 -0
- package/dist/button.mjs +8 -0
- package/dist/card.d.mts +8 -0
- package/dist/card.d.ts +8 -0
- package/dist/card.js +84 -0
- package/dist/card.mjs +7 -0
- package/dist/chart.d.mts +40 -0
- package/dist/chart.d.ts +40 -0
- package/dist/chart.js +418 -0
- package/dist/chart.mjs +8 -0
- package/dist/chunk-2PGUPOXY.mjs +285 -0
- package/dist/chunk-3DV3D2LH.mjs +155 -0
- package/dist/chunk-44UEI6KD.mjs +280 -0
- package/dist/chunk-4ADCXJE6.mjs +297 -0
- package/dist/chunk-4GSXVVSA.mjs +64 -0
- package/dist/chunk-4NK2FNAG.mjs +581 -0
- package/dist/chunk-4XWCYUV3.mjs +355 -0
- package/dist/chunk-5MN6ZNFA.mjs +355 -0
- package/dist/chunk-6RRBINER.mjs +50 -0
- package/dist/chunk-765JPQDG.mjs +280 -0
- package/dist/chunk-7CD7GIZC.mjs +850 -0
- package/dist/chunk-7XRKA6XF.mjs +462 -0
- package/dist/chunk-AOFP74IB.mjs +850 -0
- package/dist/chunk-BNDFQPHF.mjs +9 -0
- package/dist/chunk-C4OI72SM.mjs +14 -0
- package/dist/chunk-CB2MLGCJ.mjs +279 -0
- package/dist/chunk-CKTAVEW2.mjs +212 -0
- package/dist/chunk-DA6KZWSK.mjs +807 -0
- package/dist/chunk-DBD5GHHD.mjs +147 -0
- package/dist/chunk-DQ6XFBYJ.mjs +37 -0
- package/dist/chunk-FACIYUNK.mjs +217 -0
- package/dist/chunk-FUJQIYOF.mjs +37 -0
- package/dist/chunk-FZTAHWOS.mjs +82 -0
- package/dist/chunk-GC3QIIH7.mjs +112 -0
- package/dist/chunk-GPBLZGJ2.mjs +136 -0
- package/dist/chunk-H4LELROL.mjs +262 -0
- package/dist/chunk-H7P6DIX4.mjs +262 -0
- package/dist/chunk-H7YEBGYY.mjs +42 -0
- package/dist/chunk-HJOBAMDU.mjs +142 -0
- package/dist/chunk-IJG5I642.mjs +462 -0
- package/dist/chunk-IY2AA3OL.mjs +50 -0
- package/dist/chunk-J6L5BLKX.mjs +136 -0
- package/dist/chunk-J7OETCZ7.mjs +147 -0
- package/dist/chunk-JLLMIPIX.mjs +42 -0
- package/dist/chunk-KBRLFTJT.mjs +741 -0
- package/dist/chunk-KDBYDMYV.mjs +64 -0
- package/dist/chunk-L6E6Q4C4.mjs +217 -0
- package/dist/chunk-LY6474C4.mjs +297 -0
- package/dist/chunk-M23S2DVV.mjs +581 -0
- package/dist/chunk-MG243DSX.mjs +44 -0
- package/dist/chunk-MRHSN2B7.mjs +279 -0
- package/dist/chunk-MXWRCVRJ.mjs +285 -0
- package/dist/chunk-NFYS557L.mjs +481 -0
- package/dist/chunk-NNSY462N.mjs +212 -0
- package/dist/chunk-OUOIDPGX.mjs +25 -0
- package/dist/chunk-P5PFQX75.mjs +31 -0
- package/dist/chunk-P674XRDY.mjs +481 -0
- package/dist/chunk-PAQ542ER.mjs +170 -0
- package/dist/chunk-QE46DVJG.mjs +323 -0
- package/dist/chunk-QXFDXXDB.mjs +792 -0
- package/dist/chunk-R3DRVI4J.mjs +741 -0
- package/dist/chunk-TTOR7JCT.mjs +155 -0
- package/dist/chunk-V5WIYMKS.mjs +25 -0
- package/dist/chunk-VAZE267Q.mjs +82 -0
- package/dist/chunk-VLIJ7PQK.mjs +792 -0
- package/dist/chunk-VYNVBJK6.mjs +44 -0
- package/dist/chunk-WIWJ6DIE.mjs +323 -0
- package/dist/chunk-XDAEEJYR.mjs +142 -0
- package/dist/chunk-YUIZZ6XE.mjs +31 -0
- package/dist/connect-button.d.mts +40 -0
- package/dist/connect-button.d.ts +40 -0
- package/dist/connect-button.js +1815 -0
- package/dist/connect-button.mjs +14 -0
- package/dist/event-list-item-details.d.mts +11 -0
- package/dist/event-list-item-details.d.ts +11 -0
- package/dist/event-list-item-details.js +2140 -0
- package/dist/event-list-item-details.mjs +19 -0
- package/dist/event-list-item-details.types-CMbXOrT-.d.ts +53 -0
- package/dist/event-list-item-details.types-CxWr4Qn1.d.ts +53 -0
- package/dist/event-list-item-details.types-DRi99PZq.d.mts +53 -0
- package/dist/event-list-item-details.types-DekJKeMD.d.mts +53 -0
- package/dist/event-list-item.d.mts +10 -0
- package/dist/event-list-item.d.ts +10 -0
- package/dist/event-list-item.js +2097 -0
- package/dist/event-list-item.mjs +17 -0
- package/dist/event-list-item.types-B1490EQm.d.mts +46 -0
- package/dist/event-list-item.types-B1490EQm.d.ts +46 -0
- package/dist/event-list-item.types-Y6IeJ4e4.d.mts +46 -0
- package/dist/event-list-item.types-Y6IeJ4e4.d.ts +46 -0
- package/dist/event-list.d.mts +9 -0
- package/dist/event-list.d.ts +9 -0
- package/dist/event-list.js +3151 -0
- package/dist/event-list.mjs +20 -0
- package/dist/event-list.types-Bpp6Vn-t.d.mts +13 -0
- package/dist/event-list.types-Bpp6Vn-t.d.ts +13 -0
- package/dist/event-list.types-CkAAUqwW.d.mts +13 -0
- package/dist/event-list.types-CkAAUqwW.d.ts +13 -0
- package/dist/event-market-page.d.mts +52 -0
- package/dist/event-market-page.d.ts +52 -0
- package/dist/event-market-page.js +5369 -0
- package/dist/event-market-page.mjs +29 -0
- package/dist/hello-world.d.mts +8 -0
- package/dist/hello-world.d.ts +8 -0
- package/dist/hello-world.js +80 -0
- package/dist/hello-world.mjs +8 -0
- package/dist/home-page.d.mts +51 -0
- package/dist/home-page.d.ts +51 -0
- package/dist/home-page.js +3415 -0
- package/dist/home-page.mjs +21 -0
- package/dist/icon.d.mts +123 -0
- package/dist/icon.d.ts +123 -0
- package/dist/icon.js +922 -0
- package/dist/icon.mjs +57 -0
- package/dist/index.d.mts +70 -0
- package/dist/index.d.ts +70 -0
- package/dist/index.js +8184 -0
- package/dist/index.mjs +307 -0
- package/dist/loading-icon.d.mts +14 -0
- package/dist/loading-icon.d.ts +14 -0
- package/dist/loading-icon.js +115 -0
- package/dist/loading-icon.mjs +8 -0
- package/dist/market-details.d.mts +73 -0
- package/dist/market-details.d.ts +73 -0
- package/dist/market-details.js +3923 -0
- package/dist/market-details.mjs +22 -0
- package/dist/modal.d.mts +66 -0
- package/dist/modal.d.ts +66 -0
- package/dist/modal.js +317 -0
- package/dist/modal.mjs +9 -0
- package/dist/number-value.d.mts +14 -0
- package/dist/number-value.d.ts +14 -0
- package/dist/number-value.js +67 -0
- package/dist/number-value.mjs +7 -0
- package/dist/onboarding-modal.d.mts +88 -0
- package/dist/onboarding-modal.d.ts +88 -0
- package/dist/onboarding-modal.js +2242 -0
- package/dist/onboarding-modal.mjs +24 -0
- package/dist/place-order.d.mts +20 -0
- package/dist/place-order.d.ts +20 -0
- package/dist/place-order.js +2916 -0
- package/dist/place-order.mjs +18 -0
- package/dist/registry-CVn79H3I.d.mts +106 -0
- package/dist/registry-CVn79H3I.d.ts +106 -0
- package/dist/search.d.mts +69 -0
- package/dist/search.d.ts +69 -0
- package/dist/search.js +1465 -0
- package/dist/search.mjs +12 -0
- package/dist/select.d.mts +19 -0
- package/dist/select.d.ts +19 -0
- package/dist/select.js +920 -0
- package/dist/select.mjs +11 -0
- package/dist/settlement.d.mts +16 -0
- package/dist/settlement.d.ts +16 -0
- package/dist/settlement.js +1769 -0
- package/dist/settlement.mjs +15 -0
- package/dist/skeleton.d.mts +22 -0
- package/dist/skeleton.d.ts +22 -0
- package/dist/skeleton.js +523 -0
- package/dist/skeleton.mjs +10 -0
- package/dist/styles.css +2 -0
- package/dist/switch-button.d.mts +21 -0
- package/dist/switch-button.d.ts +21 -0
- package/dist/switch-button.js +184 -0
- package/dist/switch-button.mjs +7 -0
- package/dist/tabs.d.mts +27 -0
- package/dist/tabs.d.ts +27 -0
- package/dist/tabs.js +1708 -0
- package/dist/tabs.mjs +12 -0
- package/dist/tailwind.css +2 -0
- package/dist/types-8VUuQVZq.d.mts +387 -0
- package/dist/types-8VUuQVZq.d.ts +387 -0
- package/dist/types-CayJ8tWA.d.mts +3 -0
- package/dist/types-CayJ8tWA.d.ts +3 -0
- package/dist/typography.d.mts +16 -0
- package/dist/typography.d.ts +16 -0
- package/dist/typography.js +62 -0
- package/dist/typography.mjs +7 -0
- package/dist/venue-logo.d.mts +12 -0
- package/dist/venue-logo.d.ts +12 -0
- package/dist/venue-logo.js +350 -0
- package/dist/venue-logo.mjs +10 -0
- package/dist/venue-logo.types-4hmCg3D3.d.ts +17 -0
- package/dist/venue-logo.types-B1iPJgiD.d.mts +17 -0
- package/dist/venue-logo.types-Bg8eXtGp.d.ts +17 -0
- package/dist/venue-logo.types-QNDwiQ77.d.mts +17 -0
- package/package.json +195 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatUsd
|
|
3
|
+
} from "./chunk-GC3QIIH7.mjs";
|
|
4
|
+
|
|
5
|
+
// src/trading/utils.ts
|
|
6
|
+
import { resolveAggUiLabels } from "@agg-market/hooks";
|
|
7
|
+
import dayjs from "dayjs";
|
|
8
|
+
var defaultLabels = resolveAggUiLabels("en-US");
|
|
9
|
+
var defaultSettlementSectionLabel = defaultLabels.trading.settlementSection;
|
|
10
|
+
var defaultSettlementDifferencesTitle = defaultLabels.trading.settlementDifferencesTitle;
|
|
11
|
+
var defaultTradingDisclaimer = defaultLabels.trading.disclaimer;
|
|
12
|
+
var getTradingDateLabel = (value) => {
|
|
13
|
+
const parsedValue = dayjs(value);
|
|
14
|
+
if (!parsedValue.isValid()) {
|
|
15
|
+
return typeof value === "string" ? value : "";
|
|
16
|
+
}
|
|
17
|
+
return parsedValue.format("MMM D, YYYY");
|
|
18
|
+
};
|
|
19
|
+
var getTradingVenueLabel = (venue, label) => {
|
|
20
|
+
if (label)
|
|
21
|
+
return label;
|
|
22
|
+
return defaultLabels.venues[venue];
|
|
23
|
+
};
|
|
24
|
+
var getTradingValueLabel = ({
|
|
25
|
+
amount,
|
|
26
|
+
minimumFractionDigits = 0,
|
|
27
|
+
maximumFractionDigits = 2
|
|
28
|
+
}) => {
|
|
29
|
+
return amount.toLocaleString("en-US", {
|
|
30
|
+
style: "currency",
|
|
31
|
+
currency: "USD",
|
|
32
|
+
minimumFractionDigits,
|
|
33
|
+
maximumFractionDigits
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var getTradingPriceLabel = (value) => {
|
|
37
|
+
return `${Math.round(value * 100)}\xA2`;
|
|
38
|
+
};
|
|
39
|
+
var getTradingAveragePriceLabel = (value) => {
|
|
40
|
+
return defaultLabels.trading.averagePrice(value);
|
|
41
|
+
};
|
|
42
|
+
var getTradingBalanceLabel = (value) => {
|
|
43
|
+
return defaultLabels.trading.balance(formatUsd(value));
|
|
44
|
+
};
|
|
45
|
+
var getTradingSharesLabel = (value) => {
|
|
46
|
+
return defaultLabels.trading.shares(value);
|
|
47
|
+
};
|
|
48
|
+
var getTradingSlippageLabel = (value) => {
|
|
49
|
+
return defaultLabels.trading.slippage(value);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export {
|
|
53
|
+
defaultSettlementSectionLabel,
|
|
54
|
+
defaultSettlementDifferencesTitle,
|
|
55
|
+
defaultTradingDisclaimer,
|
|
56
|
+
getTradingDateLabel,
|
|
57
|
+
getTradingVenueLabel,
|
|
58
|
+
getTradingValueLabel,
|
|
59
|
+
getTradingPriceLabel,
|
|
60
|
+
getTradingAveragePriceLabel,
|
|
61
|
+
getTradingBalanceLabel,
|
|
62
|
+
getTradingSharesLabel,
|
|
63
|
+
getTradingSlippageLabel
|
|
64
|
+
};
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SwitchButton
|
|
3
|
+
} from "./chunk-3DV3D2LH.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__spreadProps,
|
|
6
|
+
__spreadValues,
|
|
7
|
+
cn
|
|
8
|
+
} from "./chunk-GC3QIIH7.mjs";
|
|
9
|
+
|
|
10
|
+
// src/primitives/chart/index.tsx
|
|
11
|
+
import dayjs from "dayjs";
|
|
12
|
+
import { useLabels, useSdkUiConfig } from "@agg/hooks";
|
|
13
|
+
import { useEffect, useMemo, useState } from "react";
|
|
14
|
+
import { Liveline } from "liveline";
|
|
15
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
16
|
+
var normalizeSeries = (series) => {
|
|
17
|
+
return series.map((seriesItem) => {
|
|
18
|
+
const pointsByTime = /* @__PURE__ */ new Map();
|
|
19
|
+
seriesItem.points.forEach((point) => {
|
|
20
|
+
if (!Number.isFinite(point.time) || !Number.isFinite(point.value)) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
pointsByTime.set(Math.floor(point.time), point.value);
|
|
24
|
+
});
|
|
25
|
+
const sortedPoints = [...pointsByTime.entries()].sort((left, right) => left[0] - right[0]).map(([time, value]) => ({
|
|
26
|
+
time,
|
|
27
|
+
value
|
|
28
|
+
}));
|
|
29
|
+
return __spreadProps(__spreadValues({}, seriesItem), {
|
|
30
|
+
points: sortedPoints
|
|
31
|
+
});
|
|
32
|
+
}).filter((seriesItem) => seriesItem.points.length > 0);
|
|
33
|
+
};
|
|
34
|
+
var defaultValueFormatter = (value) => {
|
|
35
|
+
return `${Math.round(value)}%`;
|
|
36
|
+
};
|
|
37
|
+
var defaultTimeFormatter = (timestamp) => {
|
|
38
|
+
return dayjs.unix(timestamp).format("MMM D");
|
|
39
|
+
};
|
|
40
|
+
var toLivelinePoints = (points) => {
|
|
41
|
+
return points.map((point) => ({
|
|
42
|
+
time: point.time,
|
|
43
|
+
value: point.value
|
|
44
|
+
}));
|
|
45
|
+
};
|
|
46
|
+
var resolveWindowSeconds = (normalizedSeries) => {
|
|
47
|
+
const timestamps = normalizedSeries.flatMap(
|
|
48
|
+
(seriesItem) => seriesItem.points.map((point) => point.time)
|
|
49
|
+
);
|
|
50
|
+
if (timestamps.length <= 1)
|
|
51
|
+
return 30;
|
|
52
|
+
const minTimestamp = Math.min(...timestamps);
|
|
53
|
+
const maxTimestamp = Math.max(...timestamps);
|
|
54
|
+
const span = maxTimestamp - minTimestamp;
|
|
55
|
+
if (!Number.isFinite(span) || span <= 0)
|
|
56
|
+
return 30;
|
|
57
|
+
return Math.max(1, Math.floor(span));
|
|
58
|
+
};
|
|
59
|
+
var resolveLatestValue = (points) => {
|
|
60
|
+
const latestPoint = points[points.length - 1];
|
|
61
|
+
if (!latestPoint)
|
|
62
|
+
return 0;
|
|
63
|
+
return latestPoint.value;
|
|
64
|
+
};
|
|
65
|
+
var resolveActiveSeriesId = (series, activeSeriesId) => {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
if (activeSeriesId) {
|
|
68
|
+
const matchingSeries = series.find((seriesItem) => seriesItem.id === activeSeriesId);
|
|
69
|
+
if (matchingSeries) {
|
|
70
|
+
return matchingSeries.id;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return (_b = (_a = series[0]) == null ? void 0 : _a.id) != null ? _b : "";
|
|
74
|
+
};
|
|
75
|
+
var formatDefaultSeriesLabel = (seriesItem) => {
|
|
76
|
+
return seriesItem.id.charAt(0).toUpperCase() + seriesItem.id.slice(1);
|
|
77
|
+
};
|
|
78
|
+
var renderDefaultSeriesControls = ({
|
|
79
|
+
series,
|
|
80
|
+
activeSeriesId,
|
|
81
|
+
handleSeriesChange,
|
|
82
|
+
defaultSeriesSwitchClassName,
|
|
83
|
+
seriesSwitchAriaLabel,
|
|
84
|
+
formatSeriesOptionAriaLabel
|
|
85
|
+
}) => {
|
|
86
|
+
return /* @__PURE__ */ jsx(
|
|
87
|
+
SwitchButton,
|
|
88
|
+
{
|
|
89
|
+
ariaLabel: seriesSwitchAriaLabel,
|
|
90
|
+
className: defaultSeriesSwitchClassName,
|
|
91
|
+
options: series.map((seriesItem) => ({
|
|
92
|
+
value: seriesItem.id,
|
|
93
|
+
label: formatDefaultSeriesLabel(seriesItem),
|
|
94
|
+
ariaLabel: formatSeriesOptionAriaLabel(formatDefaultSeriesLabel(seriesItem))
|
|
95
|
+
})),
|
|
96
|
+
value: activeSeriesId,
|
|
97
|
+
onValueChange: handleSeriesChange
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
var resolveSelectedSeries = (series, activeSeriesId) => {
|
|
102
|
+
const availableSeriesIds = new Set(series.map((seriesItem) => seriesItem.id));
|
|
103
|
+
if (!availableSeriesIds.has(activeSeriesId)) {
|
|
104
|
+
return series[0];
|
|
105
|
+
}
|
|
106
|
+
return series.find((seriesItem) => seriesItem.id === activeSeriesId);
|
|
107
|
+
};
|
|
108
|
+
var LineChart = ({
|
|
109
|
+
series,
|
|
110
|
+
height = 280,
|
|
111
|
+
width,
|
|
112
|
+
classNames,
|
|
113
|
+
isLoading = false,
|
|
114
|
+
showSeriesControls = true,
|
|
115
|
+
renderSeriesControls
|
|
116
|
+
}) => {
|
|
117
|
+
var _a, _b;
|
|
118
|
+
const labels = useLabels();
|
|
119
|
+
const { theme } = useSdkUiConfig();
|
|
120
|
+
const normalizedSeries = useMemo(() => {
|
|
121
|
+
return normalizeSeries(series);
|
|
122
|
+
}, [series]);
|
|
123
|
+
const [activeSeriesId, setActiveSeriesId] = useState(
|
|
124
|
+
() => resolveActiveSeriesId(normalizedSeries, null)
|
|
125
|
+
);
|
|
126
|
+
useEffect(() => {
|
|
127
|
+
setActiveSeriesId(
|
|
128
|
+
(currentActiveSeriesId) => resolveActiveSeriesId(normalizedSeries, currentActiveSeriesId)
|
|
129
|
+
);
|
|
130
|
+
}, [normalizedSeries]);
|
|
131
|
+
const livelineTheme = theme;
|
|
132
|
+
const handleSeriesChange = (seriesId) => {
|
|
133
|
+
setActiveSeriesId(seriesId);
|
|
134
|
+
};
|
|
135
|
+
const primarySeries = useMemo(() => {
|
|
136
|
+
return resolveSelectedSeries(normalizedSeries, activeSeriesId);
|
|
137
|
+
}, [activeSeriesId, normalizedSeries]);
|
|
138
|
+
const primaryData = useMemo(() => {
|
|
139
|
+
if (!primarySeries) {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
return toLivelinePoints(primarySeries.points);
|
|
143
|
+
}, [primarySeries]);
|
|
144
|
+
const primaryValue = useMemo(() => {
|
|
145
|
+
if (!primarySeries) {
|
|
146
|
+
return 0;
|
|
147
|
+
}
|
|
148
|
+
return resolveLatestValue(primarySeries.points);
|
|
149
|
+
}, [primarySeries]);
|
|
150
|
+
const livelineSeries = useMemo(() => {
|
|
151
|
+
return normalizedSeries.map((seriesItem) => ({
|
|
152
|
+
id: seriesItem.id,
|
|
153
|
+
color: seriesItem.color,
|
|
154
|
+
data: toLivelinePoints(seriesItem.points),
|
|
155
|
+
value: resolveLatestValue(seriesItem.points)
|
|
156
|
+
}));
|
|
157
|
+
}, [normalizedSeries]);
|
|
158
|
+
const windowSeconds = useMemo(() => {
|
|
159
|
+
return resolveWindowSeconds(normalizedSeries);
|
|
160
|
+
}, [normalizedSeries]);
|
|
161
|
+
const seriesControls = showSeriesControls && normalizedSeries.length > 0 ? (_a = renderSeriesControls == null ? void 0 : renderSeriesControls({
|
|
162
|
+
series: normalizedSeries,
|
|
163
|
+
activeSeriesId,
|
|
164
|
+
handleSeriesChange
|
|
165
|
+
})) != null ? _a : normalizedSeries.length > 1 ? renderDefaultSeriesControls({
|
|
166
|
+
series: normalizedSeries,
|
|
167
|
+
activeSeriesId,
|
|
168
|
+
handleSeriesChange,
|
|
169
|
+
defaultSeriesSwitchClassName: classNames == null ? void 0 : classNames.defaultSeriesSwitch,
|
|
170
|
+
seriesSwitchAriaLabel: labels.common.lineChartSeriesSwitchAria,
|
|
171
|
+
formatSeriesOptionAriaLabel: labels.common.lineChartSeriesOptionAria
|
|
172
|
+
}) : null : null;
|
|
173
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("w-full", classNames == null ? void 0 : classNames.root), style: { width }, children: [
|
|
174
|
+
!isLoading && seriesControls ? /* @__PURE__ */ jsx("div", { className: cn("mb-3", classNames == null ? void 0 : classNames.controls), children: seriesControls }) : null,
|
|
175
|
+
/* @__PURE__ */ jsx(
|
|
176
|
+
"div",
|
|
177
|
+
{
|
|
178
|
+
className: cn(
|
|
179
|
+
"overflow-hidden [&>div:not(.agg-livechart):first-of-type]:hidden!",
|
|
180
|
+
classNames == null ? void 0 : classNames.chartViewport
|
|
181
|
+
),
|
|
182
|
+
style: { height },
|
|
183
|
+
role: "img",
|
|
184
|
+
"aria-label": labels.common.lineChartAria,
|
|
185
|
+
children: /* @__PURE__ */ jsx(
|
|
186
|
+
Liveline,
|
|
187
|
+
{
|
|
188
|
+
className: cn("h-full w-full agg-livechart", classNames == null ? void 0 : classNames.liveline),
|
|
189
|
+
data: primaryData,
|
|
190
|
+
value: primaryValue,
|
|
191
|
+
series: livelineSeries,
|
|
192
|
+
color: (_b = primarySeries == null ? void 0 : primarySeries.color) != null ? _b : "var(--agg-color-primary)",
|
|
193
|
+
theme: livelineTheme,
|
|
194
|
+
grid: true,
|
|
195
|
+
momentum: false,
|
|
196
|
+
pulse: false,
|
|
197
|
+
window: windowSeconds,
|
|
198
|
+
formatValue: defaultValueFormatter,
|
|
199
|
+
formatTime: defaultTimeFormatter,
|
|
200
|
+
padding: {
|
|
201
|
+
top: 12,
|
|
202
|
+
right: 80,
|
|
203
|
+
bottom: 28,
|
|
204
|
+
left: 12
|
|
205
|
+
},
|
|
206
|
+
loading: isLoading
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
)
|
|
211
|
+
] });
|
|
212
|
+
};
|
|
213
|
+
LineChart.displayName = "LineChart";
|
|
214
|
+
|
|
215
|
+
export {
|
|
216
|
+
LineChart
|
|
217
|
+
};
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getIconA11yProps
|
|
3
|
+
} from "./chunk-BNDFQPHF.mjs";
|
|
4
|
+
import {
|
|
5
|
+
__objRest,
|
|
6
|
+
__spreadProps,
|
|
7
|
+
__spreadValues,
|
|
8
|
+
cn
|
|
9
|
+
} from "./chunk-GC3QIIH7.mjs";
|
|
10
|
+
|
|
11
|
+
// src/primitives/venue-logo/index.tsx
|
|
12
|
+
import { useLabels } from "@agg-market/hooks";
|
|
13
|
+
|
|
14
|
+
// src/primitives/venue-logo/logo-props.ts
|
|
15
|
+
var DEFAULT_MONOCHROME_COLOR = "#000000";
|
|
16
|
+
var resolveLogoPrimaryColor = ({
|
|
17
|
+
brandColor,
|
|
18
|
+
isColor = true,
|
|
19
|
+
color
|
|
20
|
+
}) => {
|
|
21
|
+
if (typeof color === "string" && color.trim())
|
|
22
|
+
return color;
|
|
23
|
+
if (!isColor)
|
|
24
|
+
return DEFAULT_MONOCHROME_COLOR;
|
|
25
|
+
return brandColor;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// src/primitives/venue-logo/svg/logo-kalshi.tsx
|
|
29
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
30
|
+
var KALSHI_GREEN = "#18C590";
|
|
31
|
+
var LogoKalshiIcon = (_a) => {
|
|
32
|
+
var _b = _a, {
|
|
33
|
+
title,
|
|
34
|
+
className,
|
|
35
|
+
isColor = true,
|
|
36
|
+
color
|
|
37
|
+
} = _b, props = __objRest(_b, [
|
|
38
|
+
"title",
|
|
39
|
+
"className",
|
|
40
|
+
"isColor",
|
|
41
|
+
"color"
|
|
42
|
+
]);
|
|
43
|
+
const primaryColor = resolveLogoPrimaryColor({
|
|
44
|
+
brandColor: KALSHI_GREEN,
|
|
45
|
+
isColor,
|
|
46
|
+
color
|
|
47
|
+
});
|
|
48
|
+
return /* @__PURE__ */ jsxs(
|
|
49
|
+
"svg",
|
|
50
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
51
|
+
viewBox: "0 0 100 100",
|
|
52
|
+
className,
|
|
53
|
+
fill: "none"
|
|
54
|
+
}, getIconA11yProps(title)), props), {
|
|
55
|
+
children: [
|
|
56
|
+
title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
|
|
57
|
+
/* @__PURE__ */ jsx("path", { d: "M20 10H36V90H20V10Z", fill: primaryColor }),
|
|
58
|
+
/* @__PURE__ */ jsx("path", { d: "M44 50L74 10H92L62 50L92 90H74L44 50Z", fill: primaryColor })
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
);
|
|
62
|
+
};
|
|
63
|
+
LogoKalshiIcon.displayName = "LogoKalshiIcon";
|
|
64
|
+
|
|
65
|
+
// src/primitives/venue-logo/svg/logo-opinion.tsx
|
|
66
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
67
|
+
var OPINION_BLACK = "#000000";
|
|
68
|
+
var OPINION_WHITE = "#FFFFFF";
|
|
69
|
+
var LogoOpinionIcon = (_a) => {
|
|
70
|
+
var _b = _a, {
|
|
71
|
+
title,
|
|
72
|
+
className,
|
|
73
|
+
isColor = true,
|
|
74
|
+
color
|
|
75
|
+
} = _b, props = __objRest(_b, [
|
|
76
|
+
"title",
|
|
77
|
+
"className",
|
|
78
|
+
"isColor",
|
|
79
|
+
"color"
|
|
80
|
+
]);
|
|
81
|
+
const primaryColor = resolveLogoPrimaryColor({
|
|
82
|
+
brandColor: OPINION_BLACK,
|
|
83
|
+
isColor,
|
|
84
|
+
color
|
|
85
|
+
});
|
|
86
|
+
const accentColor = (color == null ? void 0 : color.trim()) ? primaryColor : OPINION_WHITE;
|
|
87
|
+
return /* @__PURE__ */ jsxs2(
|
|
88
|
+
"svg",
|
|
89
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
90
|
+
viewBox: "0 0 100 100",
|
|
91
|
+
className,
|
|
92
|
+
fill: "none"
|
|
93
|
+
}, getIconA11yProps(title)), props), {
|
|
94
|
+
children: [
|
|
95
|
+
title ? /* @__PURE__ */ jsx2("title", { children: title }) : null,
|
|
96
|
+
/* @__PURE__ */ jsx2("circle", { cx: "50", cy: "50", r: "40", fill: primaryColor }),
|
|
97
|
+
/* @__PURE__ */ jsx2(
|
|
98
|
+
"rect",
|
|
99
|
+
{
|
|
100
|
+
x: "21",
|
|
101
|
+
y: "18",
|
|
102
|
+
width: "8",
|
|
103
|
+
height: "64",
|
|
104
|
+
rx: "4",
|
|
105
|
+
transform: "rotate(-7 21 18)",
|
|
106
|
+
fill: accentColor
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
/* @__PURE__ */ jsx2(
|
|
110
|
+
"rect",
|
|
111
|
+
{
|
|
112
|
+
x: "37",
|
|
113
|
+
y: "12",
|
|
114
|
+
width: "8",
|
|
115
|
+
height: "76",
|
|
116
|
+
rx: "4",
|
|
117
|
+
transform: "rotate(-4 37 12)",
|
|
118
|
+
fill: accentColor
|
|
119
|
+
}
|
|
120
|
+
),
|
|
121
|
+
/* @__PURE__ */ jsx2(
|
|
122
|
+
"rect",
|
|
123
|
+
{
|
|
124
|
+
x: "53",
|
|
125
|
+
y: "12",
|
|
126
|
+
width: "8",
|
|
127
|
+
height: "76",
|
|
128
|
+
rx: "4",
|
|
129
|
+
transform: "rotate(-4 53 12)",
|
|
130
|
+
fill: accentColor
|
|
131
|
+
}
|
|
132
|
+
),
|
|
133
|
+
/* @__PURE__ */ jsx2(
|
|
134
|
+
"rect",
|
|
135
|
+
{
|
|
136
|
+
x: "69",
|
|
137
|
+
y: "18",
|
|
138
|
+
width: "8",
|
|
139
|
+
height: "64",
|
|
140
|
+
rx: "4",
|
|
141
|
+
transform: "rotate(-7 69 18)",
|
|
142
|
+
fill: accentColor
|
|
143
|
+
}
|
|
144
|
+
),
|
|
145
|
+
/* @__PURE__ */ jsx2("rect", { x: "12", y: "44", width: "76", height: "12", fill: primaryColor })
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
);
|
|
149
|
+
};
|
|
150
|
+
LogoOpinionIcon.displayName = "LogoOpinionIcon";
|
|
151
|
+
|
|
152
|
+
// src/primitives/venue-logo/svg/logo-polymarket.tsx
|
|
153
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
154
|
+
var POLYMARKET_BLUE = "#3861FB";
|
|
155
|
+
var LogoPolymarketIcon = (_a) => {
|
|
156
|
+
var _b = _a, {
|
|
157
|
+
title,
|
|
158
|
+
className,
|
|
159
|
+
isColor = true,
|
|
160
|
+
color
|
|
161
|
+
} = _b, props = __objRest(_b, [
|
|
162
|
+
"title",
|
|
163
|
+
"className",
|
|
164
|
+
"isColor",
|
|
165
|
+
"color"
|
|
166
|
+
]);
|
|
167
|
+
const primaryColor = resolveLogoPrimaryColor({
|
|
168
|
+
brandColor: POLYMARKET_BLUE,
|
|
169
|
+
isColor,
|
|
170
|
+
color
|
|
171
|
+
});
|
|
172
|
+
return /* @__PURE__ */ jsxs3(
|
|
173
|
+
"svg",
|
|
174
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
175
|
+
viewBox: "0 0 100 100",
|
|
176
|
+
className,
|
|
177
|
+
fill: "none"
|
|
178
|
+
}, getIconA11yProps(title)), props), {
|
|
179
|
+
children: [
|
|
180
|
+
title ? /* @__PURE__ */ jsx3("title", { children: title }) : null,
|
|
181
|
+
/* @__PURE__ */ jsx3(
|
|
182
|
+
"path",
|
|
183
|
+
{
|
|
184
|
+
d: "M18 10L78 2V98L18 88V10Z",
|
|
185
|
+
stroke: primaryColor,
|
|
186
|
+
strokeWidth: "8",
|
|
187
|
+
strokeLinejoin: "round"
|
|
188
|
+
}
|
|
189
|
+
),
|
|
190
|
+
/* @__PURE__ */ jsx3("path", { d: "M18 32L78 44", stroke: primaryColor, strokeWidth: "8", strokeLinecap: "round" }),
|
|
191
|
+
/* @__PURE__ */ jsx3("path", { d: "M18 58L78 70", stroke: primaryColor, strokeWidth: "8", strokeLinecap: "round" })
|
|
192
|
+
]
|
|
193
|
+
})
|
|
194
|
+
);
|
|
195
|
+
};
|
|
196
|
+
LogoPolymarketIcon.displayName = "LogoPolymarketIcon";
|
|
197
|
+
|
|
198
|
+
// src/primitives/venue-logo/svg/logo-probable.tsx
|
|
199
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
200
|
+
var PROBABLE_ORANGE = "#F85B22";
|
|
201
|
+
var LogoProbableIcon = (_a) => {
|
|
202
|
+
var _b = _a, {
|
|
203
|
+
title,
|
|
204
|
+
className,
|
|
205
|
+
isColor = true,
|
|
206
|
+
color
|
|
207
|
+
} = _b, props = __objRest(_b, [
|
|
208
|
+
"title",
|
|
209
|
+
"className",
|
|
210
|
+
"isColor",
|
|
211
|
+
"color"
|
|
212
|
+
]);
|
|
213
|
+
const primaryColor = resolveLogoPrimaryColor({
|
|
214
|
+
brandColor: PROBABLE_ORANGE,
|
|
215
|
+
isColor,
|
|
216
|
+
color
|
|
217
|
+
});
|
|
218
|
+
return /* @__PURE__ */ jsxs4(
|
|
219
|
+
"svg",
|
|
220
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
221
|
+
viewBox: "0 0 100 100",
|
|
222
|
+
className,
|
|
223
|
+
fill: "none"
|
|
224
|
+
}, getIconA11yProps(title)), props), {
|
|
225
|
+
children: [
|
|
226
|
+
title ? /* @__PURE__ */ jsx4("title", { children: title }) : null,
|
|
227
|
+
/* @__PURE__ */ jsx4("rect", { x: "20", y: "16", width: "60", height: "12", fill: primaryColor }),
|
|
228
|
+
/* @__PURE__ */ jsx4("rect", { x: "18", y: "36", width: "64", height: "46", rx: "23", fill: primaryColor }),
|
|
229
|
+
/* @__PURE__ */ jsx4(
|
|
230
|
+
"rect",
|
|
231
|
+
{
|
|
232
|
+
x: "32",
|
|
233
|
+
y: "50",
|
|
234
|
+
width: "40",
|
|
235
|
+
height: "18",
|
|
236
|
+
rx: "9",
|
|
237
|
+
fill: isColor && !color ? "white" : primaryColor
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
/* @__PURE__ */ jsx4("circle", { cx: "61", cy: "59", r: "7", fill: primaryColor })
|
|
241
|
+
]
|
|
242
|
+
})
|
|
243
|
+
);
|
|
244
|
+
};
|
|
245
|
+
LogoProbableIcon.displayName = "LogoProbableIcon";
|
|
246
|
+
|
|
247
|
+
// src/primitives/venue-logo/venue-logo.constants.ts
|
|
248
|
+
var venueLogoRegistry = {
|
|
249
|
+
kalshi: LogoKalshiIcon,
|
|
250
|
+
polymarket: LogoPolymarketIcon,
|
|
251
|
+
opinion: LogoOpinionIcon,
|
|
252
|
+
probable: LogoProbableIcon
|
|
253
|
+
};
|
|
254
|
+
var venueLogoNames = Object.keys(venueLogoRegistry);
|
|
255
|
+
var sizeClasses = {
|
|
256
|
+
xxs: "h-2 w-2",
|
|
257
|
+
xs: "h-3 w-3",
|
|
258
|
+
s: "h-4 w-4",
|
|
259
|
+
m: "h-6 w-6",
|
|
260
|
+
l: "h-8 w-8",
|
|
261
|
+
xl: "h-10 w-10",
|
|
262
|
+
xxl: "h-12 w-12"
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
// src/primitives/venue-logo/index.tsx
|
|
266
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
267
|
+
var VenueLogo = ({
|
|
268
|
+
venue,
|
|
269
|
+
isColor = true,
|
|
270
|
+
isMonochromatic = false,
|
|
271
|
+
color,
|
|
272
|
+
size = "m",
|
|
273
|
+
className,
|
|
274
|
+
ariaLabel,
|
|
275
|
+
title
|
|
276
|
+
}) => {
|
|
277
|
+
const labels = useLabels();
|
|
278
|
+
const Component = venueLogoRegistry[venue];
|
|
279
|
+
const sizeClass = sizeClasses[size];
|
|
280
|
+
const resolvedIsColor = isMonochromatic ? false : isColor;
|
|
281
|
+
return /* @__PURE__ */ jsx5(
|
|
282
|
+
Component,
|
|
283
|
+
{
|
|
284
|
+
className: cn("shrink-0", sizeClass, className),
|
|
285
|
+
isColor: resolvedIsColor,
|
|
286
|
+
color,
|
|
287
|
+
"aria-label": ariaLabel != null ? ariaLabel : labels.venues[venue],
|
|
288
|
+
title
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
};
|
|
292
|
+
VenueLogo.displayName = "VenueLogo";
|
|
293
|
+
|
|
294
|
+
export {
|
|
295
|
+
venueLogoNames,
|
|
296
|
+
VenueLogo
|
|
297
|
+
};
|