@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.
Files changed (192) hide show
  1. package/dist/badge.d.mts +26 -0
  2. package/dist/badge.d.ts +26 -0
  3. package/dist/badge.js +70 -0
  4. package/dist/badge.mjs +9 -0
  5. package/dist/button.d.mts +20 -0
  6. package/dist/button.d.ts +20 -0
  7. package/dist/button.js +197 -0
  8. package/dist/button.mjs +8 -0
  9. package/dist/card.d.mts +8 -0
  10. package/dist/card.d.ts +8 -0
  11. package/dist/card.js +84 -0
  12. package/dist/card.mjs +7 -0
  13. package/dist/chart.d.mts +40 -0
  14. package/dist/chart.d.ts +40 -0
  15. package/dist/chart.js +418 -0
  16. package/dist/chart.mjs +8 -0
  17. package/dist/chunk-2PGUPOXY.mjs +285 -0
  18. package/dist/chunk-3DV3D2LH.mjs +155 -0
  19. package/dist/chunk-44UEI6KD.mjs +280 -0
  20. package/dist/chunk-4ADCXJE6.mjs +297 -0
  21. package/dist/chunk-4GSXVVSA.mjs +64 -0
  22. package/dist/chunk-4NK2FNAG.mjs +581 -0
  23. package/dist/chunk-4XWCYUV3.mjs +355 -0
  24. package/dist/chunk-5MN6ZNFA.mjs +355 -0
  25. package/dist/chunk-6RRBINER.mjs +50 -0
  26. package/dist/chunk-765JPQDG.mjs +280 -0
  27. package/dist/chunk-7CD7GIZC.mjs +850 -0
  28. package/dist/chunk-7XRKA6XF.mjs +462 -0
  29. package/dist/chunk-AOFP74IB.mjs +850 -0
  30. package/dist/chunk-BNDFQPHF.mjs +9 -0
  31. package/dist/chunk-C4OI72SM.mjs +14 -0
  32. package/dist/chunk-CB2MLGCJ.mjs +279 -0
  33. package/dist/chunk-CKTAVEW2.mjs +212 -0
  34. package/dist/chunk-DA6KZWSK.mjs +807 -0
  35. package/dist/chunk-DBD5GHHD.mjs +147 -0
  36. package/dist/chunk-DQ6XFBYJ.mjs +37 -0
  37. package/dist/chunk-FACIYUNK.mjs +217 -0
  38. package/dist/chunk-FUJQIYOF.mjs +37 -0
  39. package/dist/chunk-FZTAHWOS.mjs +82 -0
  40. package/dist/chunk-GC3QIIH7.mjs +112 -0
  41. package/dist/chunk-GPBLZGJ2.mjs +136 -0
  42. package/dist/chunk-H4LELROL.mjs +262 -0
  43. package/dist/chunk-H7P6DIX4.mjs +262 -0
  44. package/dist/chunk-H7YEBGYY.mjs +42 -0
  45. package/dist/chunk-HJOBAMDU.mjs +142 -0
  46. package/dist/chunk-IJG5I642.mjs +462 -0
  47. package/dist/chunk-IY2AA3OL.mjs +50 -0
  48. package/dist/chunk-J6L5BLKX.mjs +136 -0
  49. package/dist/chunk-J7OETCZ7.mjs +147 -0
  50. package/dist/chunk-JLLMIPIX.mjs +42 -0
  51. package/dist/chunk-KBRLFTJT.mjs +741 -0
  52. package/dist/chunk-KDBYDMYV.mjs +64 -0
  53. package/dist/chunk-L6E6Q4C4.mjs +217 -0
  54. package/dist/chunk-LY6474C4.mjs +297 -0
  55. package/dist/chunk-M23S2DVV.mjs +581 -0
  56. package/dist/chunk-MG243DSX.mjs +44 -0
  57. package/dist/chunk-MRHSN2B7.mjs +279 -0
  58. package/dist/chunk-MXWRCVRJ.mjs +285 -0
  59. package/dist/chunk-NFYS557L.mjs +481 -0
  60. package/dist/chunk-NNSY462N.mjs +212 -0
  61. package/dist/chunk-OUOIDPGX.mjs +25 -0
  62. package/dist/chunk-P5PFQX75.mjs +31 -0
  63. package/dist/chunk-P674XRDY.mjs +481 -0
  64. package/dist/chunk-PAQ542ER.mjs +170 -0
  65. package/dist/chunk-QE46DVJG.mjs +323 -0
  66. package/dist/chunk-QXFDXXDB.mjs +792 -0
  67. package/dist/chunk-R3DRVI4J.mjs +741 -0
  68. package/dist/chunk-TTOR7JCT.mjs +155 -0
  69. package/dist/chunk-V5WIYMKS.mjs +25 -0
  70. package/dist/chunk-VAZE267Q.mjs +82 -0
  71. package/dist/chunk-VLIJ7PQK.mjs +792 -0
  72. package/dist/chunk-VYNVBJK6.mjs +44 -0
  73. package/dist/chunk-WIWJ6DIE.mjs +323 -0
  74. package/dist/chunk-XDAEEJYR.mjs +142 -0
  75. package/dist/chunk-YUIZZ6XE.mjs +31 -0
  76. package/dist/connect-button.d.mts +40 -0
  77. package/dist/connect-button.d.ts +40 -0
  78. package/dist/connect-button.js +1815 -0
  79. package/dist/connect-button.mjs +14 -0
  80. package/dist/event-list-item-details.d.mts +11 -0
  81. package/dist/event-list-item-details.d.ts +11 -0
  82. package/dist/event-list-item-details.js +2140 -0
  83. package/dist/event-list-item-details.mjs +19 -0
  84. package/dist/event-list-item-details.types-CMbXOrT-.d.ts +53 -0
  85. package/dist/event-list-item-details.types-CxWr4Qn1.d.ts +53 -0
  86. package/dist/event-list-item-details.types-DRi99PZq.d.mts +53 -0
  87. package/dist/event-list-item-details.types-DekJKeMD.d.mts +53 -0
  88. package/dist/event-list-item.d.mts +10 -0
  89. package/dist/event-list-item.d.ts +10 -0
  90. package/dist/event-list-item.js +2097 -0
  91. package/dist/event-list-item.mjs +17 -0
  92. package/dist/event-list-item.types-B1490EQm.d.mts +46 -0
  93. package/dist/event-list-item.types-B1490EQm.d.ts +46 -0
  94. package/dist/event-list-item.types-Y6IeJ4e4.d.mts +46 -0
  95. package/dist/event-list-item.types-Y6IeJ4e4.d.ts +46 -0
  96. package/dist/event-list.d.mts +9 -0
  97. package/dist/event-list.d.ts +9 -0
  98. package/dist/event-list.js +3151 -0
  99. package/dist/event-list.mjs +20 -0
  100. package/dist/event-list.types-Bpp6Vn-t.d.mts +13 -0
  101. package/dist/event-list.types-Bpp6Vn-t.d.ts +13 -0
  102. package/dist/event-list.types-CkAAUqwW.d.mts +13 -0
  103. package/dist/event-list.types-CkAAUqwW.d.ts +13 -0
  104. package/dist/event-market-page.d.mts +52 -0
  105. package/dist/event-market-page.d.ts +52 -0
  106. package/dist/event-market-page.js +5369 -0
  107. package/dist/event-market-page.mjs +29 -0
  108. package/dist/hello-world.d.mts +8 -0
  109. package/dist/hello-world.d.ts +8 -0
  110. package/dist/hello-world.js +80 -0
  111. package/dist/hello-world.mjs +8 -0
  112. package/dist/home-page.d.mts +51 -0
  113. package/dist/home-page.d.ts +51 -0
  114. package/dist/home-page.js +3415 -0
  115. package/dist/home-page.mjs +21 -0
  116. package/dist/icon.d.mts +123 -0
  117. package/dist/icon.d.ts +123 -0
  118. package/dist/icon.js +922 -0
  119. package/dist/icon.mjs +57 -0
  120. package/dist/index.d.mts +70 -0
  121. package/dist/index.d.ts +70 -0
  122. package/dist/index.js +8184 -0
  123. package/dist/index.mjs +307 -0
  124. package/dist/loading-icon.d.mts +14 -0
  125. package/dist/loading-icon.d.ts +14 -0
  126. package/dist/loading-icon.js +115 -0
  127. package/dist/loading-icon.mjs +8 -0
  128. package/dist/market-details.d.mts +73 -0
  129. package/dist/market-details.d.ts +73 -0
  130. package/dist/market-details.js +3923 -0
  131. package/dist/market-details.mjs +22 -0
  132. package/dist/modal.d.mts +66 -0
  133. package/dist/modal.d.ts +66 -0
  134. package/dist/modal.js +317 -0
  135. package/dist/modal.mjs +9 -0
  136. package/dist/number-value.d.mts +14 -0
  137. package/dist/number-value.d.ts +14 -0
  138. package/dist/number-value.js +67 -0
  139. package/dist/number-value.mjs +7 -0
  140. package/dist/onboarding-modal.d.mts +88 -0
  141. package/dist/onboarding-modal.d.ts +88 -0
  142. package/dist/onboarding-modal.js +2242 -0
  143. package/dist/onboarding-modal.mjs +24 -0
  144. package/dist/place-order.d.mts +20 -0
  145. package/dist/place-order.d.ts +20 -0
  146. package/dist/place-order.js +2916 -0
  147. package/dist/place-order.mjs +18 -0
  148. package/dist/registry-CVn79H3I.d.mts +106 -0
  149. package/dist/registry-CVn79H3I.d.ts +106 -0
  150. package/dist/search.d.mts +69 -0
  151. package/dist/search.d.ts +69 -0
  152. package/dist/search.js +1465 -0
  153. package/dist/search.mjs +12 -0
  154. package/dist/select.d.mts +19 -0
  155. package/dist/select.d.ts +19 -0
  156. package/dist/select.js +920 -0
  157. package/dist/select.mjs +11 -0
  158. package/dist/settlement.d.mts +16 -0
  159. package/dist/settlement.d.ts +16 -0
  160. package/dist/settlement.js +1769 -0
  161. package/dist/settlement.mjs +15 -0
  162. package/dist/skeleton.d.mts +22 -0
  163. package/dist/skeleton.d.ts +22 -0
  164. package/dist/skeleton.js +523 -0
  165. package/dist/skeleton.mjs +10 -0
  166. package/dist/styles.css +2 -0
  167. package/dist/switch-button.d.mts +21 -0
  168. package/dist/switch-button.d.ts +21 -0
  169. package/dist/switch-button.js +184 -0
  170. package/dist/switch-button.mjs +7 -0
  171. package/dist/tabs.d.mts +27 -0
  172. package/dist/tabs.d.ts +27 -0
  173. package/dist/tabs.js +1708 -0
  174. package/dist/tabs.mjs +12 -0
  175. package/dist/tailwind.css +2 -0
  176. package/dist/types-8VUuQVZq.d.mts +387 -0
  177. package/dist/types-8VUuQVZq.d.ts +387 -0
  178. package/dist/types-CayJ8tWA.d.mts +3 -0
  179. package/dist/types-CayJ8tWA.d.ts +3 -0
  180. package/dist/typography.d.mts +16 -0
  181. package/dist/typography.d.ts +16 -0
  182. package/dist/typography.js +62 -0
  183. package/dist/typography.mjs +7 -0
  184. package/dist/venue-logo.d.mts +12 -0
  185. package/dist/venue-logo.d.ts +12 -0
  186. package/dist/venue-logo.js +350 -0
  187. package/dist/venue-logo.mjs +10 -0
  188. package/dist/venue-logo.types-4hmCg3D3.d.ts +17 -0
  189. package/dist/venue-logo.types-B1iPJgiD.d.mts +17 -0
  190. package/dist/venue-logo.types-Bg8eXtGp.d.ts +17 -0
  191. package/dist/venue-logo.types-QNDwiQ77.d.mts +17 -0
  192. package/package.json +195 -0
@@ -0,0 +1,280 @@
1
+ import {
2
+ EventList
3
+ } from "./chunk-H4LELROL.mjs";
4
+ import {
5
+ Tabs
6
+ } from "./chunk-VLIJ7PQK.mjs";
7
+ import {
8
+ Icon
9
+ } from "./chunk-DA6KZWSK.mjs";
10
+ import {
11
+ cn
12
+ } from "./chunk-GC3QIIH7.mjs";
13
+
14
+ // src/pages/home/index.tsx
15
+ import { useEffect, useMemo, useState } from "react";
16
+ import { useCategories, useLabels } from "@agg/hooks";
17
+
18
+ // src/pages/home/home.constants.ts
19
+ var ALL_CATEGORIES_TAB_VALUE = "trending";
20
+ var DEFAULT_CATEGORIES_LIMIT = 100;
21
+ var DEFAULT_ALL_CATEGORY_TAB_LABEL = "Trending";
22
+ var CATEGORY_TAB_NAME_ORDER = [
23
+ "crypto",
24
+ "economy",
25
+ "entertainment",
26
+ "finance",
27
+ "geopolitics",
28
+ "health",
29
+ "mentions",
30
+ "politics",
31
+ "science",
32
+ "sports",
33
+ "technology",
34
+ "weather",
35
+ "world"
36
+ ];
37
+ var getDefaultHomePageTabs = (allCategoryTabLabel) => {
38
+ return [
39
+ {
40
+ value: ALL_CATEGORIES_TAB_VALUE,
41
+ label: allCategoryTabLabel,
42
+ iconName: "arrow-trend-up"
43
+ },
44
+ { value: "crypto", label: "crypto", categoryIds: ["crypto"] },
45
+ { value: "economy", label: "economy", categoryIds: ["economy"] },
46
+ {
47
+ value: "entertainment",
48
+ label: "entertainment",
49
+ categoryIds: ["entertainment"]
50
+ },
51
+ { value: "finance", label: "finance", categoryIds: ["finance"] },
52
+ {
53
+ value: "geopolitics",
54
+ label: "geopolitics",
55
+ categoryIds: ["geopolitics"]
56
+ },
57
+ { value: "health", label: "health", categoryIds: ["health"] },
58
+ { value: "mentions", label: "mentions", categoryIds: ["mentions"] },
59
+ { value: "politics", label: "politics", categoryIds: ["politics"] },
60
+ { value: "science", label: "science", categoryIds: ["science"] },
61
+ { value: "sports", label: "sports", categoryIds: ["sports"] },
62
+ { value: "technology", label: "technology", categoryIds: ["technology"] },
63
+ { value: "weather", label: "weather", categoryIds: ["weather"] },
64
+ { value: "world", label: "world", categoryIds: ["world"] }
65
+ ];
66
+ };
67
+ var getDefaultEventSectionItems = (labels) => {
68
+ return [
69
+ {
70
+ id: "top-markets",
71
+ title: labels.home.topMarkets,
72
+ maxItemsPerRow: 3,
73
+ limit: 3,
74
+ maxVisibleItems: 3
75
+ },
76
+ {
77
+ id: "new-markets",
78
+ title: labels.home.newMarkets,
79
+ maxItemsPerRow: 3,
80
+ limit: 3,
81
+ maxVisibleItems: 3
82
+ }
83
+ ];
84
+ };
85
+
86
+ // src/pages/home/home.utils.ts
87
+ var categoryOrderMap = CATEGORY_TAB_NAME_ORDER.reduce(
88
+ (accumulator, name, index) => {
89
+ accumulator.set(name, index);
90
+ return accumulator;
91
+ },
92
+ /* @__PURE__ */ new Map()
93
+ );
94
+ var normalizeCategoryName = (name) => {
95
+ return name.trim().toLowerCase();
96
+ };
97
+ var resolveCategoryTabs = (categories, allCategoryTabLabel) => {
98
+ const sortedCategories = [...categories].sort((left, right) => {
99
+ const leftName = normalizeCategoryName(left.name);
100
+ const rightName = normalizeCategoryName(right.name);
101
+ const leftOrder = categoryOrderMap.get(leftName);
102
+ const rightOrder = categoryOrderMap.get(rightName);
103
+ if (leftOrder != null && rightOrder != null) {
104
+ return leftOrder - rightOrder;
105
+ }
106
+ if (leftOrder != null)
107
+ return -1;
108
+ if (rightOrder != null)
109
+ return 1;
110
+ return leftName.localeCompare(rightName);
111
+ });
112
+ const seenCategoryIds = /* @__PURE__ */ new Set();
113
+ const tabs = [
114
+ {
115
+ value: ALL_CATEGORIES_TAB_VALUE,
116
+ label: allCategoryTabLabel,
117
+ iconName: "arrow-trend-up"
118
+ }
119
+ ];
120
+ for (const category of sortedCategories) {
121
+ if (seenCategoryIds.has(category.id))
122
+ continue;
123
+ seenCategoryIds.add(category.id);
124
+ tabs.push({
125
+ value: category.id,
126
+ label: normalizeCategoryName(category.name),
127
+ categoryIds: [category.id]
128
+ });
129
+ }
130
+ return tabs;
131
+ };
132
+ var resolveInitialTabValue = (tabs, defaultActiveTab) => {
133
+ var _a, _b;
134
+ if (defaultActiveTab) {
135
+ const hasDefaultTab = tabs.some((tab) => tab.value === defaultActiveTab);
136
+ if (hasDefaultTab)
137
+ return defaultActiveTab;
138
+ }
139
+ return (_b = (_a = tabs[0]) == null ? void 0 : _a.value) != null ? _b : "trending";
140
+ };
141
+
142
+ // src/pages/home/index.tsx
143
+ import { jsx, jsxs } from "react/jsx-runtime";
144
+ var HomePage = ({
145
+ tabs,
146
+ defaultActiveTab,
147
+ onTabChange,
148
+ eventSectionItems,
149
+ classNames,
150
+ useCategoriesTabs = true,
151
+ categoriesLimit = DEFAULT_CATEGORIES_LIMIT,
152
+ allCategoryTabLabel = DEFAULT_ALL_CATEGORY_TAB_LABEL
153
+ }) => {
154
+ const labels = useLabels();
155
+ const hasCustomTabs = !!tabs && tabs.length > 0;
156
+ const shouldUseCategoriesTabs = !hasCustomTabs && useCategoriesTabs;
157
+ const resolvedAllCategoryTabLabel = allCategoryTabLabel === DEFAULT_ALL_CATEGORY_TAB_LABEL ? labels.home.trending : allCategoryTabLabel;
158
+ const { categories } = useCategories({
159
+ limit: categoriesLimit,
160
+ enabled: shouldUseCategoriesTabs
161
+ });
162
+ const categoryTabs = useMemo(() => {
163
+ return resolveCategoryTabs(categories, resolvedAllCategoryTabLabel);
164
+ }, [categories, resolvedAllCategoryTabLabel]);
165
+ const resolvedTabs = useMemo(() => {
166
+ if (hasCustomTabs && tabs)
167
+ return tabs;
168
+ if (shouldUseCategoriesTabs)
169
+ return categoryTabs;
170
+ return getDefaultHomePageTabs(resolvedAllCategoryTabLabel);
171
+ }, [categoryTabs, hasCustomTabs, resolvedAllCategoryTabLabel, shouldUseCategoriesTabs, tabs]);
172
+ const resolvedEventSectionItems = eventSectionItems && eventSectionItems.length > 0 ? eventSectionItems : getDefaultEventSectionItems(labels);
173
+ const [activeTabValue, setActiveTabValue] = useState(() => {
174
+ return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
175
+ });
176
+ useEffect(() => {
177
+ setActiveTabValue((currentValue) => {
178
+ const hasCurrentValue = resolvedTabs.some((tab) => tab.value === currentValue);
179
+ if (hasCurrentValue)
180
+ return currentValue;
181
+ return resolveInitialTabValue(resolvedTabs, defaultActiveTab);
182
+ });
183
+ }, [defaultActiveTab, resolvedTabs]);
184
+ const tabsItems = useMemo(() => {
185
+ return resolvedTabs.map((tab) => {
186
+ const isActive = tab.value === activeTabValue;
187
+ return {
188
+ value: tab.value,
189
+ label: tab.label,
190
+ icon: tab.iconName ? /* @__PURE__ */ jsx(
191
+ Icon,
192
+ {
193
+ name: tab.iconName,
194
+ size: "m",
195
+ color: isActive ? "var(--agg-color-primary)" : "var(--agg-color-foreground)"
196
+ }
197
+ ) : void 0,
198
+ disabled: tab.disabled
199
+ };
200
+ });
201
+ }, [activeTabValue, resolvedTabs]);
202
+ const activeTab = useMemo(() => {
203
+ return resolvedTabs.find((tab) => tab.value === activeTabValue);
204
+ }, [activeTabValue, resolvedTabs]);
205
+ const resolvedSectionItems = useMemo(() => {
206
+ var _a, _b, _c, _d, _e;
207
+ if (activeTabValue === ALL_CATEGORIES_TAB_VALUE) {
208
+ return resolvedEventSectionItems;
209
+ }
210
+ const maxItemsPerRow = (_b = (_a = resolvedEventSectionItems[0]) == null ? void 0 : _a.maxItemsPerRow) != null ? _b : 3;
211
+ const showVenueLogo = (_c = resolvedEventSectionItems[0]) == null ? void 0 : _c.showVenueLogo;
212
+ const firstSectionLimit = (_d = resolvedEventSectionItems[0]) == null ? void 0 : _d.limit;
213
+ const limit = firstSectionLimit && Number.isFinite(firstSectionLimit) ? Math.max(9, Math.floor(firstSectionLimit)) : 9;
214
+ return [
215
+ {
216
+ id: `${activeTabValue}-markets`,
217
+ title: (_e = activeTab == null ? void 0 : activeTab.label) != null ? _e : activeTabValue,
218
+ maxItemsPerRow,
219
+ limit,
220
+ maxVisibleItems: void 0,
221
+ showVenueLogo,
222
+ search: activeTab == null ? void 0 : activeTab.search,
223
+ categoryIds: activeTab == null ? void 0 : activeTab.categoryIds
224
+ }
225
+ ];
226
+ }, [activeTab, activeTabValue, resolvedEventSectionItems]);
227
+ const handleTabChange = (value) => {
228
+ setActiveTabValue(value);
229
+ onTabChange == null ? void 0 : onTabChange(value);
230
+ };
231
+ return /* @__PURE__ */ jsxs("section", { className: cn("flex w-full flex-col", classNames == null ? void 0 : classNames.root), children: [
232
+ /* @__PURE__ */ jsx(
233
+ "header",
234
+ {
235
+ className: cn("w-full bg-agg-secondary border-b border-agg-separator", classNames == null ? void 0 : classNames.header),
236
+ children: /* @__PURE__ */ jsx(
237
+ Tabs,
238
+ {
239
+ ariaLabel: labels.home.categoryTabsAria,
240
+ variant: "underline",
241
+ className: cn("w-full px-4 md:px-10", classNames == null ? void 0 : classNames.tabs),
242
+ items: tabsItems,
243
+ value: activeTabValue,
244
+ onChange: handleTabChange
245
+ }
246
+ )
247
+ }
248
+ ),
249
+ /* @__PURE__ */ jsx(
250
+ "main",
251
+ {
252
+ className: cn(
253
+ "flex w-full flex-col gap-4 md:gap-10 px-4 md:px-10 py-4 md:py-8",
254
+ classNames == null ? void 0 : classNames.sections
255
+ ),
256
+ children: resolvedSectionItems.map((eventSectionItem) => {
257
+ var _a, _b, _c;
258
+ return /* @__PURE__ */ jsx(
259
+ EventList,
260
+ {
261
+ title: eventSectionItem.title,
262
+ maxItemsPerRow: eventSectionItem.maxItemsPerRow,
263
+ limit: eventSectionItem.limit,
264
+ maxVisibleItems: eventSectionItem.maxVisibleItems,
265
+ showVenueLogo: eventSectionItem.showVenueLogo,
266
+ search: (_b = eventSectionItem.search) != null ? _b : activeTab == null ? void 0 : activeTab.search,
267
+ categoryIds: (_c = eventSectionItem.categoryIds) != null ? _c : activeTab == null ? void 0 : activeTab.categoryIds
268
+ },
269
+ (_a = eventSectionItem.id) != null ? _a : eventSectionItem.title
270
+ );
271
+ })
272
+ }
273
+ )
274
+ ] });
275
+ };
276
+ HomePage.displayName = "HomePage";
277
+
278
+ export {
279
+ HomePage
280
+ };
@@ -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/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
+ };
@@ -0,0 +1,64 @@
1
+ import {
2
+ formatUsd
3
+ } from "./chunk-GC3QIIH7.mjs";
4
+
5
+ // src/trading/utils.ts
6
+ import { resolveAggUiLabels } from "@agg/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
+ };