@agg-market/ui 4.0.0 → 5.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 (44) hide show
  1. package/dist/{chunk-HOXTJ742.mjs → chunk-34IRJYSU.mjs} +1 -1
  2. package/dist/chunk-4343LYSH.mjs +45 -0
  3. package/dist/{chunk-LA3FBBSJ.mjs → chunk-CTYJVVHJ.mjs} +25 -2
  4. package/dist/{chunk-GNSPZ53C.mjs → chunk-DHBHKIJR.mjs} +73 -15
  5. package/dist/{chunk-OH56VUYK.mjs → chunk-GFBF2J3Y.mjs} +14 -7
  6. package/dist/{chunk-P2PJBO5C.mjs → chunk-KIYMVWL4.mjs} +1 -1
  7. package/dist/{chunk-QM7CGMFG.mjs → chunk-MKVGQ7AS.mjs} +12 -0
  8. package/dist/{chunk-JNH64AKR.mjs → chunk-Q6DGDBPV.mjs} +58 -4
  9. package/dist/{chunk-DCORNTCY.mjs → chunk-QDMHLRDY.mjs} +31 -62
  10. package/dist/{chunk-MBHTXNHX.mjs → chunk-T7TATHPD.mjs} +32 -8
  11. package/dist/chunk-XUCS575S.mjs +65 -0
  12. package/dist/event-list-item-details.js +1529 -72
  13. package/dist/event-list-item-details.mjs +7 -3
  14. package/dist/event-list-item.js +292 -71
  15. package/dist/event-list-item.mjs +5 -2
  16. package/dist/event-list.js +628 -404
  17. package/dist/event-list.mjs +6 -3
  18. package/dist/event-market-page.d.mts +1 -1
  19. package/dist/event-market-page.d.ts +1 -1
  20. package/dist/event-market-page.js +2478 -2268
  21. package/dist/event-market-page.mjs +7 -5
  22. package/dist/home-page.js +638 -414
  23. package/dist/home-page.mjs +7 -4
  24. package/dist/index.d.mts +3 -2
  25. package/dist/index.d.ts +3 -2
  26. package/dist/index.js +1062 -858
  27. package/dist/index.mjs +18 -13
  28. package/dist/market-details.js +645 -391
  29. package/dist/market-details.mjs +6 -3
  30. package/dist/place-order.d.mts +1 -1
  31. package/dist/place-order.d.ts +1 -1
  32. package/dist/search.js +3 -0
  33. package/dist/search.mjs +2 -1
  34. package/dist/settlement.d.mts +1 -1
  35. package/dist/settlement.d.ts +1 -1
  36. package/dist/state-message.d.mts +16 -0
  37. package/dist/state-message.d.ts +16 -0
  38. package/dist/state-message.js +1629 -0
  39. package/dist/state-message.mjs +14 -0
  40. package/dist/styles.css +1 -1
  41. package/dist/tailwind.css +1 -1
  42. package/package.json +14 -2
  43. package/dist/{types-DkGlbmXq.d.mts → types-BImwqY4o.d.mts} +4 -4
  44. package/dist/{types-DkGlbmXq.d.ts → types-BImwqY4o.d.ts} +4 -4
@@ -1,3 +1,6 @@
1
+ import {
2
+ SearchEmptyIcon
3
+ } from "./chunk-4343LYSH.mjs";
1
4
  import {
2
5
  VenueLogo
3
6
  } from "./chunk-PORVP72S.mjs";
@@ -5,10 +8,6 @@ import {
5
8
  Icon
6
9
  } from "./chunk-PZTHM6WG.mjs";
7
10
  import {
8
- getIconA11yProps
9
- } from "./chunk-BNDFQPHF.mjs";
10
- import {
11
- __objRest,
12
11
  __spreadProps,
13
12
  __spreadValues,
14
13
  cn,
@@ -19,39 +18,6 @@ import {
19
18
  import { useMemo } from "react";
20
19
  import { useLabels, useSdkUiConfig } from "@agg-market/hooks";
21
20
 
22
- // src/primitives/search/search-empty-icon.tsx
23
- import { jsx, jsxs } from "react/jsx-runtime";
24
- var SearchEmptyIcon = (_a) => {
25
- var _b = _a, { title, className } = _b, props = __objRest(_b, ["title", "className"]);
26
- return /* @__PURE__ */ jsxs(
27
- "svg",
28
- __spreadProps(__spreadValues(__spreadValues({
29
- viewBox: "0 0 40 40",
30
- fill: "none",
31
- xmlns: "http://www.w3.org/2000/svg",
32
- className
33
- }, getIconA11yProps(title)), props), {
34
- children: [
35
- title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
36
- /* @__PURE__ */ jsx("circle", { cx: "19.9987", cy: "20.0013", r: "9.2", stroke: "currentColor", strokeWidth: "1.6" }),
37
- /* @__PURE__ */ jsx(
38
- "ellipse",
39
- {
40
- cx: "19.9987",
41
- cy: "20.0012",
42
- rx: "17.2",
43
- ry: "6.6",
44
- transform: "rotate(-35 19.9987 20.0012)",
45
- stroke: "currentColor",
46
- strokeWidth: "1.6"
47
- }
48
- )
49
- ]
50
- })
51
- );
52
- };
53
- SearchEmptyIcon.displayName = "SearchEmptyIcon";
54
-
55
21
  // src/primitives/search/search.types.ts
56
22
  import { z } from "zod";
57
23
  var searchResultVenues = ["kalshi", "polymarket", "opinion", "probable"];
@@ -76,7 +42,7 @@ var searchResultItemSchema = z.object({
76
42
  var searchResultItemsSchema = z.array(searchResultItemSchema);
77
43
 
78
44
  // src/primitives/search/index.tsx
79
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
45
+ import { jsx, jsxs } from "react/jsx-runtime";
80
46
  var SearchResultRow = ({
81
47
  item,
82
48
  resultAria,
@@ -87,10 +53,12 @@ var SearchResultRow = ({
87
53
  const handleResultClick = () => {
88
54
  onSelect == null ? void 0 : onSelect(item);
89
55
  };
90
- return /* @__PURE__ */ jsxs2(
56
+ return /* @__PURE__ */ jsxs(
91
57
  "button",
92
58
  {
93
59
  type: "button",
60
+ role: "option",
61
+ "aria-selected": "false",
94
62
  className: cn(
95
63
  "group/agg-search-result",
96
64
  "group flex w-full items-center gap-6 px-5 py-3 text-left",
@@ -101,8 +69,8 @@ var SearchResultRow = ({
101
69
  onClick: handleResultClick,
102
70
  "aria-label": resultAria(item.title),
103
71
  children: [
104
- /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
105
- /* @__PURE__ */ jsx2(
72
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
73
+ /* @__PURE__ */ jsx(
106
74
  "img",
107
75
  {
108
76
  src: item.thumbnailSrc,
@@ -113,7 +81,7 @@ var SearchResultRow = ({
113
81
  )
114
82
  }
115
83
  ),
116
- /* @__PURE__ */ jsx2(
84
+ /* @__PURE__ */ jsx(
117
85
  "p",
118
86
  {
119
87
  className: cn(
@@ -124,10 +92,10 @@ var SearchResultRow = ({
124
92
  }
125
93
  )
126
94
  ] }),
127
- /* @__PURE__ */ jsxs2("div", { className: cn("flex w-[200px] shrink-0 items-center gap-2", classNames == null ? void 0 : classNames.resultMeta), children: [
128
- /* @__PURE__ */ jsx2(VenueLogo, { venue: item.venue, size: "small" }),
129
- /* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
130
- /* @__PURE__ */ jsx2(
95
+ /* @__PURE__ */ jsxs("div", { className: cn("flex w-[200px] shrink-0 items-center gap-2", classNames == null ? void 0 : classNames.resultMeta), children: [
96
+ /* @__PURE__ */ jsx(VenueLogo, { venue: item.venue, size: "small" }),
97
+ /* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
98
+ /* @__PURE__ */ jsx(
131
99
  "p",
132
100
  {
133
101
  className: cn(
@@ -137,7 +105,7 @@ var SearchResultRow = ({
137
105
  children: item.valueLabel
138
106
  }
139
107
  ),
140
- /* @__PURE__ */ jsx2(
108
+ /* @__PURE__ */ jsx(
141
109
  "p",
142
110
  {
143
111
  className: cn(
@@ -149,7 +117,7 @@ var SearchResultRow = ({
149
117
  )
150
118
  ] })
151
119
  ] }),
152
- /* @__PURE__ */ jsx2(
120
+ /* @__PURE__ */ jsx(
153
121
  Icon,
154
122
  {
155
123
  name: "chevron-right",
@@ -190,8 +158,8 @@ var Search = ({
190
158
  const handleInputChange = (event) => {
191
159
  onValueChange(event.target.value);
192
160
  };
193
- return /* @__PURE__ */ jsxs2("div", { className: cn("group/agg-search", "flex w-full flex-col gap-1", classNames == null ? void 0 : classNames.root), children: [
194
- /* @__PURE__ */ jsx2("label", { className: "w-full", children: /* @__PURE__ */ jsxs2(
161
+ return /* @__PURE__ */ jsxs("div", { className: cn("group/agg-search", "flex w-full flex-col gap-1", classNames == null ? void 0 : classNames.root), children: [
162
+ /* @__PURE__ */ jsx("label", { className: "w-full", children: /* @__PURE__ */ jsxs(
195
163
  "div",
196
164
  {
197
165
  className: cn(
@@ -205,7 +173,7 @@ var Search = ({
205
173
  classNames == null ? void 0 : classNames.inputContainer
206
174
  ),
207
175
  children: [
208
- /* @__PURE__ */ jsx2(
176
+ /* @__PURE__ */ jsx(
209
177
  Icon,
210
178
  {
211
179
  name: "search",
@@ -213,7 +181,7 @@ var Search = ({
213
181
  className: cn("text-agg-muted-foreground", classNames == null ? void 0 : classNames.searchIcon)
214
182
  }
215
183
  ),
216
- /* @__PURE__ */ jsx2(
184
+ /* @__PURE__ */ jsx(
217
185
  "input",
218
186
  __spreadProps(__spreadValues({}, inputProps), {
219
187
  type: "text",
@@ -234,24 +202,25 @@ var Search = ({
234
202
  ]
235
203
  }
236
204
  ) }),
237
- shouldRenderResults ? /* @__PURE__ */ jsx2(
205
+ shouldRenderResults ? /* @__PURE__ */ jsx(
238
206
  "div",
239
207
  {
240
208
  className: cn(
241
209
  "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary py-2 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]",
242
210
  classNames == null ? void 0 : classNames.dropdown
243
211
  ),
244
- children: /* @__PURE__ */ jsx2(
212
+ children: /* @__PURE__ */ jsx(
245
213
  "ul",
246
214
  {
247
215
  className: cn("m-0 flex list-none flex-col p-0", classNames == null ? void 0 : classNames.resultsList),
248
216
  role: "listbox",
249
217
  "aria-label": labels.search.resultsAria,
250
- children: validatedResults.map((item, index) => /* @__PURE__ */ jsx2(
218
+ children: validatedResults.map((item, index) => /* @__PURE__ */ jsx(
251
219
  "li",
252
220
  {
221
+ role: "presentation",
253
222
  className: cn(index > 0 && "border-t border-agg-separator", classNames == null ? void 0 : classNames.resultItem),
254
- children: /* @__PURE__ */ jsx2(
223
+ children: /* @__PURE__ */ jsx(
255
224
  SearchResultRow,
256
225
  {
257
226
  item,
@@ -267,29 +236,29 @@ var Search = ({
267
236
  )
268
237
  }
269
238
  ) : null,
270
- shouldRenderNoResults ? /* @__PURE__ */ jsx2(
239
+ shouldRenderNoResults ? /* @__PURE__ */ jsx(
271
240
  "div",
272
241
  {
273
242
  className: cn(
274
243
  "w-full overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary py-10 shadow-[0px_8px_16px_0px_rgba(0,0,0,0.1)]",
275
244
  classNames == null ? void 0 : classNames.emptyState
276
245
  ),
277
- children: /* @__PURE__ */ jsxs2(
246
+ children: /* @__PURE__ */ jsxs(
278
247
  "div",
279
248
  {
280
249
  className: cn("flex flex-col items-center gap-5", classNames == null ? void 0 : classNames.emptyStateContent),
281
250
  role: "status",
282
251
  "aria-live": "polite",
283
252
  children: [
284
- /* @__PURE__ */ jsx2(
253
+ /* @__PURE__ */ jsx(
285
254
  SearchEmptyIcon,
286
255
  {
287
256
  className: cn("h-10 w-10 text-agg-muted-foreground", classNames == null ? void 0 : classNames.emptyStateIcon),
288
257
  "aria-hidden": true
289
258
  }
290
259
  ),
291
- /* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-1 text-center", children: [
292
- /* @__PURE__ */ jsx2(
260
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-1 text-center", children: [
261
+ /* @__PURE__ */ jsx(
293
262
  "p",
294
263
  {
295
264
  className: cn(
@@ -299,7 +268,7 @@ var Search = ({
299
268
  children: labels.search.noResultsTitle
300
269
  }
301
270
  ),
302
- /* @__PURE__ */ jsx2(
271
+ /* @__PURE__ */ jsx(
303
272
  "p",
304
273
  {
305
274
  className: cn(
@@ -6,10 +6,16 @@ import {
6
6
  } from "./chunk-MJHKBCXQ.mjs";
7
7
  import {
8
8
  EventListItemDetails
9
- } from "./chunk-JNH64AKR.mjs";
9
+ } from "./chunk-Q6DGDBPV.mjs";
10
10
  import {
11
11
  MarketDetails
12
- } from "./chunk-GNSPZ53C.mjs";
12
+ } from "./chunk-DHBHKIJR.mjs";
13
+ import {
14
+ isErrorWithStatus
15
+ } from "./chunk-MKVGQ7AS.mjs";
16
+ import {
17
+ StateMessage
18
+ } from "./chunk-XUCS575S.mjs";
13
19
  import {
14
20
  Typography
15
21
  } from "./chunk-ERGNR6UQ.mjs";
@@ -99,6 +105,20 @@ var EventMarketPageUnavailableState = ({
99
105
  }
100
106
  );
101
107
  };
108
+ var EventMarketPageNotFoundState = ({
109
+ ariaLabel
110
+ }) => {
111
+ const labels = useLabels();
112
+ return /* @__PURE__ */ jsx(Card, { className: "overflow-hidden rounded-agg-xl border border-agg-separator bg-agg-secondary p-0 shadow-none hover:shadow-none", children: /* @__PURE__ */ jsx(
113
+ StateMessage,
114
+ {
115
+ ariaLabel: ariaLabel != null ? ariaLabel : labels.eventItemDetails.notFoundAria,
116
+ title: labels.eventItemDetails.notFoundTitle,
117
+ description: labels.eventItemDetails.notFoundDescription,
118
+ className: "min-h-[320px] md:min-h-[360px]"
119
+ }
120
+ ) });
121
+ };
102
122
  var EventMarketPageLoadingState = ({
103
123
  placeOrder,
104
124
  settlement,
@@ -255,12 +275,13 @@ var EventMarketPageContent = ({
255
275
  };
256
276
  var EventMarketPage = (props) => {
257
277
  const hasEventProp = "event" in props && !!props.event;
258
- const { event: fetchedEvent, isLoading: isFetchingEvent } = useEvent(
259
- hasEventProp ? void 0 : props.eventId,
260
- {
261
- enabled: !props.isLoading && !hasEventProp && !!props.eventId
262
- }
263
- );
278
+ const {
279
+ event: fetchedEvent,
280
+ error: eventError,
281
+ isLoading: isFetchingEvent
282
+ } = useEvent(hasEventProp ? void 0 : props.eventId, {
283
+ enabled: !props.isLoading && !hasEventProp && !!props.eventId
284
+ });
264
285
  if (props.isLoading) {
265
286
  return /* @__PURE__ */ jsx(EventMarketPageLoadingState, { placeOrder: props.placeOrder, settlement: props.settlement });
266
287
  }
@@ -278,6 +299,9 @@ var EventMarketPage = (props) => {
278
299
  );
279
300
  }
280
301
  if (!fetchedEvent) {
302
+ if (isErrorWithStatus(eventError, 404)) {
303
+ return /* @__PURE__ */ jsx(EventMarketPageNotFoundState, { ariaLabel: props.ariaLabel });
304
+ }
281
305
  return /* @__PURE__ */ jsx(EventMarketPageUnavailableState, { ariaLabel: props.ariaLabel });
282
306
  }
283
307
  return /* @__PURE__ */ jsx(EventMarketPageContent, __spreadProps(__spreadValues({}, props), { event: fetchedEvent }));
@@ -0,0 +1,65 @@
1
+ import {
2
+ SearchEmptyIcon
3
+ } from "./chunk-4343LYSH.mjs";
4
+ import {
5
+ WarningIcon
6
+ } from "./chunk-PZTHM6WG.mjs";
7
+ import {
8
+ Button
9
+ } from "./chunk-KAGYJ4XT.mjs";
10
+ import {
11
+ Typography
12
+ } from "./chunk-ERGNR6UQ.mjs";
13
+ import {
14
+ cn
15
+ } from "./chunk-GJ4U5NCE.mjs";
16
+
17
+ // src/primitives/state-message/index.tsx
18
+ import { jsx, jsxs } from "react/jsx-runtime";
19
+ var iconClassName = "h-9 w-9 text-agg-muted-foreground";
20
+ var StateMessage = ({
21
+ ariaLabel,
22
+ tone = "empty",
23
+ title,
24
+ description,
25
+ actionLabel,
26
+ onAction,
27
+ className
28
+ }) => {
29
+ const icon = tone === "warning" ? /* @__PURE__ */ jsx(WarningIcon, { className: iconClassName, "aria-hidden": true }) : /* @__PURE__ */ jsx(SearchEmptyIcon, { className: iconClassName, "aria-hidden": true });
30
+ return /* @__PURE__ */ jsx(
31
+ "div",
32
+ {
33
+ className: cn(
34
+ "flex min-h-[240px] w-full flex-col items-center justify-center px-5 py-10 text-center md:px-10",
35
+ className
36
+ ),
37
+ role: "status",
38
+ "aria-live": "polite",
39
+ "aria-label": ariaLabel,
40
+ children: /* @__PURE__ */ jsxs("div", { className: "flex max-w-[360px] flex-col items-center gap-6", children: [
41
+ icon,
42
+ /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center gap-2", children: [
43
+ /* @__PURE__ */ jsx(Typography, { variant: "body-large-strong", children: title }),
44
+ description ? /* @__PURE__ */ jsx(Typography, { variant: "body", className: "whitespace-pre-line text-agg-muted-foreground", children: description }) : null
45
+ ] }),
46
+ actionLabel && onAction ? /* @__PURE__ */ jsx(
47
+ Button,
48
+ {
49
+ variant: "tertiary",
50
+ size: "large",
51
+ className: "text-agg-base leading-agg-6",
52
+ "aria-label": actionLabel,
53
+ onClick: onAction,
54
+ children: actionLabel
55
+ }
56
+ ) : null
57
+ ] })
58
+ }
59
+ );
60
+ };
61
+ StateMessage.displayName = "StateMessage";
62
+
63
+ export {
64
+ StateMessage
65
+ };