@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.
- package/README.md +17 -2
- package/dist/{chunk-G6YKGVQR.mjs → chunk-JE4MV5RL.mjs} +18 -60
- package/dist/{chunk-2ICOSP7N.mjs → chunk-KRCRD4AJ.mjs} +11 -14
- package/dist/{chunk-5ZKPBMRK.mjs → chunk-SBLIHCN2.mjs} +21 -24
- package/dist/{chunk-LMOJKJOY.mjs → chunk-TLFRGJ5B.mjs} +334 -217
- package/dist/chunk-WKY3IN52.mjs +4907 -0
- package/dist/events.js +3364 -2660
- package/dist/events.mjs +2 -5
- package/dist/index.js +2693 -1764
- package/dist/index.mjs +610 -38
- package/dist/modals.js +1356 -815
- package/dist/modals.mjs +2 -4
- package/dist/pages.js +3023 -2248
- package/dist/pages.mjs +4 -7
- package/dist/primitives.js +1072 -355
- package/dist/primitives.mjs +38 -30
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1153 -558
- package/dist/trading.mjs +2 -4
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.mts +31 -0
- package/dist/types/auth/connect-button-view/connect-button-view.constants.d.ts +31 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.mts +83 -0
- package/dist/types/auth/connect-button-view/connect-button-view.types.d.ts +83 -0
- package/dist/types/auth/connect-button-view/index.d.mts +7 -0
- package/dist/types/auth/connect-button-view/index.d.ts +7 -0
- package/dist/types/auth/index.d.mts +1 -1
- package/dist/types/auth/index.d.ts +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/primitives/chart/chart-type-switch.d.mts +10 -0
- package/dist/types/primitives/chart/chart-type-switch.d.ts +10 -0
- package/dist/types/primitives/chart/index.d.mts +7 -1
- package/dist/types/primitives/chart/index.d.ts +7 -1
- package/dist/types/primitives/icon/index.d.mts +9 -1
- package/dist/types/primitives/icon/index.d.ts +9 -1
- package/dist/types/primitives/icon/registry.d.mts +32 -0
- package/dist/types/primitives/icon/registry.d.ts +32 -0
- package/dist/types/primitives/icon/svg/apple.d.mts +5 -0
- package/dist/types/primitives/icon/svg/apple.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-candlestick.d.ts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.mts +5 -0
- package/dist/types/primitives/icon/svg/chart-line.d.ts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.mts +5 -0
- package/dist/types/primitives/icon/svg/error-filled.d.ts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.mts +5 -0
- package/dist/types/primitives/icon/svg/ethereum.d.ts +5 -0
- package/dist/types/primitives/icon/svg/google.d.mts +5 -0
- package/dist/types/primitives/icon/svg/google.d.ts +5 -0
- package/dist/types/primitives/icon/svg/image.d.mts +5 -0
- package/dist/types/primitives/icon/svg/image.d.ts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.mts +5 -0
- package/dist/types/primitives/icon/svg/solana.d.ts +5 -0
- package/dist/types/primitives/index.d.mts +2 -0
- package/dist/types/primitives/index.d.ts +2 -0
- package/dist/types/primitives/inline-alert/index.d.mts +16 -0
- package/dist/types/primitives/inline-alert/index.d.ts +16 -0
- package/dist/types/primitives/remote-image/index.d.mts +6 -0
- package/dist/types/primitives/remote-image/index.d.ts +6 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.mts +4 -0
- package/dist/types/primitives/remote-image/remote-image.constants.d.ts +4 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.mts +16 -0
- package/dist/types/primitives/remote-image/remote-image.types.d.ts +16 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.mts +5 -0
- package/dist/types/primitives/venue-logo/svg/logo-limitless.d.ts +5 -0
- package/dist/types/primitives/venue-logo/venue-logo.types.d.mts +1 -1
- package/dist/types/primitives/venue-logo/venue-logo.types.d.ts +1 -1
- package/dist/types/trading/types.d.mts +26 -26
- package/dist/types/trading/types.d.ts +26 -26
- package/package.json +3 -15
- package/dist/auth.d.mts +0 -1
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +0 -2290
- package/dist/auth.mjs +0 -8
- package/dist/chunk-ADGL6RFX.mjs +0 -214
- package/dist/chunk-CN7GI2RJ.mjs +0 -585
- package/dist/chunk-HI4EEDN5.mjs +0 -1880
- package/dist/chunk-INRG3D4M.mjs +0 -450
- package/dist/chunk-JE3Z52FD.mjs +0 -345
- package/dist/chunk-MHCHR65A.mjs +0 -165
- package/dist/chunk-PASXFYKQ.mjs +0 -81
- package/dist/chunk-UBBOLLOS.mjs +0 -999
- package/dist/types/auth/connect-button/connect-button.constants.d.mts +0 -10
- package/dist/types/auth/connect-button/connect-button.constants.d.ts +0 -10
- package/dist/types/auth/connect-button/connect-button.types.d.mts +0 -33
- package/dist/types/auth/connect-button/connect-button.types.d.ts +0 -33
- package/dist/types/auth/connect-button/index.d.mts +0 -7
- package/dist/types/auth/connect-button/index.d.ts +0 -7
package/dist/chunk-JE3Z52FD.mjs
DELETED
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SearchEmptyIcon,
|
|
3
|
-
Typography
|
|
4
|
-
} from "./chunk-CN7GI2RJ.mjs";
|
|
5
|
-
import {
|
|
6
|
-
Icon,
|
|
7
|
-
VenueLogo,
|
|
8
|
-
__spreadProps,
|
|
9
|
-
__spreadValues,
|
|
10
|
-
cn,
|
|
11
|
-
getMotionClassName
|
|
12
|
-
} from "./chunk-HI4EEDN5.mjs";
|
|
13
|
-
|
|
14
|
-
// src/primitives/hello-world.tsx
|
|
15
|
-
import { useHello } from "@agg-market/hooks";
|
|
16
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
-
function HelloWorld() {
|
|
18
|
-
const { data, error, isLoading } = useHello();
|
|
19
|
-
if (isLoading) {
|
|
20
|
-
return /* @__PURE__ */ jsx(Typography, { variant: "body", children: "Loading..." });
|
|
21
|
-
}
|
|
22
|
-
if (error) {
|
|
23
|
-
return /* @__PURE__ */ jsxs(Typography, { variant: "body", children: [
|
|
24
|
-
"Error: ",
|
|
25
|
-
error.message
|
|
26
|
-
] });
|
|
27
|
-
}
|
|
28
|
-
return /* @__PURE__ */ jsx(Typography, { variant: "body", children: data == null ? void 0 : data.message });
|
|
29
|
-
}
|
|
30
|
-
HelloWorld.displayName = "HelloWorld";
|
|
31
|
-
|
|
32
|
-
// src/primitives/number-value.tsx
|
|
33
|
-
import { useMemo } from "react";
|
|
34
|
-
import { useSdkUiConfig } from "@agg-market/hooks";
|
|
35
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
36
|
-
var NumberValue = ({
|
|
37
|
-
value,
|
|
38
|
-
format = "number",
|
|
39
|
-
fallback = "\u2014",
|
|
40
|
-
className,
|
|
41
|
-
ariaLabel
|
|
42
|
-
}) => {
|
|
43
|
-
const config = useSdkUiConfig();
|
|
44
|
-
const formatted = useMemo(() => {
|
|
45
|
-
if (value == null)
|
|
46
|
-
return fallback;
|
|
47
|
-
if (format === "date") {
|
|
48
|
-
if (value instanceof Date)
|
|
49
|
-
return config.formatDate(value);
|
|
50
|
-
return fallback;
|
|
51
|
-
}
|
|
52
|
-
if (typeof value !== "number")
|
|
53
|
-
return fallback;
|
|
54
|
-
if (format === "percent")
|
|
55
|
-
return config.formatPercent(value);
|
|
56
|
-
if (format === "currency")
|
|
57
|
-
return config.formatCurrency(value);
|
|
58
|
-
if (format === "compactCurrency") {
|
|
59
|
-
return config.formatCompactCurrency(value);
|
|
60
|
-
}
|
|
61
|
-
return config.formatNumber(value);
|
|
62
|
-
}, [config, fallback, format, value]);
|
|
63
|
-
return /* @__PURE__ */ jsx2("span", { className: cn("font-agg-sans", className), "aria-label": ariaLabel, children: formatted });
|
|
64
|
-
};
|
|
65
|
-
NumberValue.displayName = "NumberValue";
|
|
66
|
-
|
|
67
|
-
// src/primitives/search/index.tsx
|
|
68
|
-
import { useMemo as useMemo2 } from "react";
|
|
69
|
-
import { useLabels, useSdkUiConfig as useSdkUiConfig2 } from "@agg-market/hooks";
|
|
70
|
-
|
|
71
|
-
// src/primitives/search/search.types.ts
|
|
72
|
-
import { z } from "zod";
|
|
73
|
-
var searchResultVenues = ["kalshi", "polymarket", "opinion", "probable"];
|
|
74
|
-
var isSearchResultVenue = (value) => {
|
|
75
|
-
if (typeof value !== "string")
|
|
76
|
-
return false;
|
|
77
|
-
return searchResultVenues.includes(value);
|
|
78
|
-
};
|
|
79
|
-
var searchResultVenueSchema = z.custom(
|
|
80
|
-
(value) => isSearchResultVenue(value),
|
|
81
|
-
"Invalid venue logo name"
|
|
82
|
-
);
|
|
83
|
-
var searchResultItemSchema = z.object({
|
|
84
|
-
id: z.string().min(1),
|
|
85
|
-
title: z.string().min(1),
|
|
86
|
-
thumbnailSrc: z.string().min(1),
|
|
87
|
-
thumbnailAlt: z.string().optional(),
|
|
88
|
-
venue: searchResultVenueSchema,
|
|
89
|
-
valueLabel: z.string().min(1),
|
|
90
|
-
contextLabel: z.string().min(1)
|
|
91
|
-
});
|
|
92
|
-
var searchResultItemsSchema = z.array(searchResultItemSchema);
|
|
93
|
-
|
|
94
|
-
// src/primitives/search/index.tsx
|
|
95
|
-
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
96
|
-
var SearchResultRow = ({
|
|
97
|
-
item,
|
|
98
|
-
resultAria,
|
|
99
|
-
onSelect,
|
|
100
|
-
classNames
|
|
101
|
-
}) => {
|
|
102
|
-
var _a;
|
|
103
|
-
const handleResultClick = () => {
|
|
104
|
-
onSelect == null ? void 0 : onSelect(item);
|
|
105
|
-
};
|
|
106
|
-
return /* @__PURE__ */ jsxs2(
|
|
107
|
-
"button",
|
|
108
|
-
{
|
|
109
|
-
type: "button",
|
|
110
|
-
role: "option",
|
|
111
|
-
"aria-selected": "false",
|
|
112
|
-
className: cn(
|
|
113
|
-
"group/agg-search-result",
|
|
114
|
-
"group flex w-full items-center gap-6 px-5 py-3 text-left",
|
|
115
|
-
"focus-visible:outline-none focus-visible:bg-agg-secondary-hover",
|
|
116
|
-
"hover:bg-agg-secondary-hover",
|
|
117
|
-
classNames == null ? void 0 : classNames.resultButton
|
|
118
|
-
),
|
|
119
|
-
onClick: handleResultClick,
|
|
120
|
-
"aria-label": resultAria(item.title),
|
|
121
|
-
children: [
|
|
122
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-1 items-center gap-3", children: [
|
|
123
|
-
/* @__PURE__ */ jsx3(
|
|
124
|
-
"img",
|
|
125
|
-
{
|
|
126
|
-
src: item.thumbnailSrc,
|
|
127
|
-
alt: (_a = item.thumbnailAlt) != null ? _a : "",
|
|
128
|
-
className: cn(
|
|
129
|
-
"h-10 w-10 shrink-0 rounded-[8px] object-cover",
|
|
130
|
-
classNames == null ? void 0 : classNames.resultThumbnail
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
),
|
|
134
|
-
/* @__PURE__ */ jsx3(
|
|
135
|
-
"p",
|
|
136
|
-
{
|
|
137
|
-
className: cn(
|
|
138
|
-
"min-w-0 flex-1 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground",
|
|
139
|
-
classNames == null ? void 0 : classNames.resultTitle
|
|
140
|
-
),
|
|
141
|
-
children: item.title
|
|
142
|
-
}
|
|
143
|
-
)
|
|
144
|
-
] }),
|
|
145
|
-
/* @__PURE__ */ jsxs2("div", { className: cn("flex w-[200px] shrink-0 items-center gap-2", classNames == null ? void 0 : classNames.resultMeta), children: [
|
|
146
|
-
/* @__PURE__ */ jsx3(VenueLogo, { venue: item.venue, size: "small" }),
|
|
147
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex min-w-0 flex-1 items-baseline gap-2", children: [
|
|
148
|
-
/* @__PURE__ */ jsx3(
|
|
149
|
-
"p",
|
|
150
|
-
{
|
|
151
|
-
className: cn(
|
|
152
|
-
"agg-type-body-large-strong shrink-0 whitespace-nowrap text-agg-foreground",
|
|
153
|
-
classNames == null ? void 0 : classNames.resultValue
|
|
154
|
-
),
|
|
155
|
-
children: item.valueLabel
|
|
156
|
-
}
|
|
157
|
-
),
|
|
158
|
-
/* @__PURE__ */ jsx3(
|
|
159
|
-
"p",
|
|
160
|
-
{
|
|
161
|
-
className: cn(
|
|
162
|
-
"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground",
|
|
163
|
-
classNames == null ? void 0 : classNames.resultContext
|
|
164
|
-
),
|
|
165
|
-
children: item.contextLabel
|
|
166
|
-
}
|
|
167
|
-
)
|
|
168
|
-
] })
|
|
169
|
-
] }),
|
|
170
|
-
/* @__PURE__ */ jsx3(
|
|
171
|
-
Icon,
|
|
172
|
-
{
|
|
173
|
-
name: "chevron-right",
|
|
174
|
-
size: "medium",
|
|
175
|
-
className: cn("h-5 w-5 shrink-0 text-agg-muted-foreground", classNames == null ? void 0 : classNames.resultChevron)
|
|
176
|
-
}
|
|
177
|
-
)
|
|
178
|
-
]
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
};
|
|
182
|
-
var getValidatedResults = (results) => {
|
|
183
|
-
if (!(results == null ? void 0 : results.length))
|
|
184
|
-
return [];
|
|
185
|
-
const parsedResults = searchResultItemsSchema.safeParse(results);
|
|
186
|
-
if (!parsedResults.success)
|
|
187
|
-
return [];
|
|
188
|
-
return parsedResults.data;
|
|
189
|
-
};
|
|
190
|
-
var Search = ({
|
|
191
|
-
value,
|
|
192
|
-
onValueChange,
|
|
193
|
-
results,
|
|
194
|
-
onSelect,
|
|
195
|
-
classNames,
|
|
196
|
-
inputProps
|
|
197
|
-
}) => {
|
|
198
|
-
const labels = useLabels();
|
|
199
|
-
const { enableAnimations } = useSdkUiConfig2();
|
|
200
|
-
const validatedResults = useMemo2(() => {
|
|
201
|
-
return getValidatedResults(results);
|
|
202
|
-
}, [results]);
|
|
203
|
-
const hasSearchValue = value.trim().length > 0;
|
|
204
|
-
const resolvedIsActive = hasSearchValue;
|
|
205
|
-
const shouldRenderDropdown = hasSearchValue;
|
|
206
|
-
const shouldRenderNoResults = shouldRenderDropdown && !validatedResults.length;
|
|
207
|
-
const shouldRenderResults = shouldRenderDropdown && !!validatedResults.length;
|
|
208
|
-
const handleInputChange = (event) => {
|
|
209
|
-
onValueChange(event.target.value);
|
|
210
|
-
};
|
|
211
|
-
return /* @__PURE__ */ jsxs2("div", { className: cn("group/agg-search", "flex w-full flex-col gap-1", classNames == null ? void 0 : classNames.root), children: [
|
|
212
|
-
/* @__PURE__ */ jsx3("label", { className: "w-full", children: /* @__PURE__ */ jsxs2(
|
|
213
|
-
"div",
|
|
214
|
-
{
|
|
215
|
-
className: cn(
|
|
216
|
-
"flex h-10 w-full items-center gap-2 rounded-[4px] bg-agg-secondary px-3",
|
|
217
|
-
resolvedIsActive ? "border-2 border-agg-primary" : "border border-agg-separator",
|
|
218
|
-
"focus-within:border-2 focus-within:border-agg-primary",
|
|
219
|
-
getMotionClassName(
|
|
220
|
-
enableAnimations,
|
|
221
|
-
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
222
|
-
),
|
|
223
|
-
classNames == null ? void 0 : classNames.inputContainer
|
|
224
|
-
),
|
|
225
|
-
children: [
|
|
226
|
-
/* @__PURE__ */ jsx3(
|
|
227
|
-
Icon,
|
|
228
|
-
{
|
|
229
|
-
name: "search",
|
|
230
|
-
size: "small",
|
|
231
|
-
className: cn("text-agg-muted-foreground", classNames == null ? void 0 : classNames.searchIcon)
|
|
232
|
-
}
|
|
233
|
-
),
|
|
234
|
-
/* @__PURE__ */ jsx3(
|
|
235
|
-
"input",
|
|
236
|
-
__spreadProps(__spreadValues({}, inputProps), {
|
|
237
|
-
type: "text",
|
|
238
|
-
value,
|
|
239
|
-
onChange: handleInputChange,
|
|
240
|
-
placeholder: labels.search.placeholder,
|
|
241
|
-
"aria-label": labels.search.inputAria,
|
|
242
|
-
className: cn(
|
|
243
|
-
"h-6 w-full min-w-0 border-0 bg-transparent p-0",
|
|
244
|
-
"font-agg-sans text-agg-base leading-agg-6 font-agg-normal text-agg-foreground",
|
|
245
|
-
"placeholder:text-agg-muted-foreground",
|
|
246
|
-
"outline-none focus:outline-none",
|
|
247
|
-
"disabled:cursor-not-allowed disabled:text-agg-muted-foreground",
|
|
248
|
-
classNames == null ? void 0 : classNames.input
|
|
249
|
-
)
|
|
250
|
-
})
|
|
251
|
-
)
|
|
252
|
-
]
|
|
253
|
-
}
|
|
254
|
-
) }),
|
|
255
|
-
shouldRenderResults ? /* @__PURE__ */ jsx3(
|
|
256
|
-
"div",
|
|
257
|
-
{
|
|
258
|
-
className: cn(
|
|
259
|
-
"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)]",
|
|
260
|
-
classNames == null ? void 0 : classNames.dropdown
|
|
261
|
-
),
|
|
262
|
-
children: /* @__PURE__ */ jsx3(
|
|
263
|
-
"ul",
|
|
264
|
-
{
|
|
265
|
-
className: cn("m-0 flex list-none flex-col p-0", classNames == null ? void 0 : classNames.resultsList),
|
|
266
|
-
role: "listbox",
|
|
267
|
-
"aria-label": labels.search.resultsAria,
|
|
268
|
-
children: validatedResults.map((item, index) => /* @__PURE__ */ jsx3(
|
|
269
|
-
"li",
|
|
270
|
-
{
|
|
271
|
-
role: "presentation",
|
|
272
|
-
className: cn(index > 0 && "border-t border-agg-separator", classNames == null ? void 0 : classNames.resultItem),
|
|
273
|
-
children: /* @__PURE__ */ jsx3(
|
|
274
|
-
SearchResultRow,
|
|
275
|
-
{
|
|
276
|
-
item,
|
|
277
|
-
resultAria: labels.search.resultAria,
|
|
278
|
-
onSelect,
|
|
279
|
-
classNames
|
|
280
|
-
}
|
|
281
|
-
)
|
|
282
|
-
},
|
|
283
|
-
item.id
|
|
284
|
-
))
|
|
285
|
-
}
|
|
286
|
-
)
|
|
287
|
-
}
|
|
288
|
-
) : null,
|
|
289
|
-
shouldRenderNoResults ? /* @__PURE__ */ jsx3(
|
|
290
|
-
"div",
|
|
291
|
-
{
|
|
292
|
-
className: cn(
|
|
293
|
-
"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)]",
|
|
294
|
-
classNames == null ? void 0 : classNames.emptyState
|
|
295
|
-
),
|
|
296
|
-
children: /* @__PURE__ */ jsxs2(
|
|
297
|
-
"div",
|
|
298
|
-
{
|
|
299
|
-
className: cn("flex flex-col items-center gap-5", classNames == null ? void 0 : classNames.emptyStateContent),
|
|
300
|
-
role: "status",
|
|
301
|
-
"aria-live": "polite",
|
|
302
|
-
children: [
|
|
303
|
-
/* @__PURE__ */ jsx3(
|
|
304
|
-
SearchEmptyIcon,
|
|
305
|
-
{
|
|
306
|
-
className: cn("h-10 w-10 text-agg-muted-foreground", classNames == null ? void 0 : classNames.emptyStateIcon),
|
|
307
|
-
"aria-hidden": true
|
|
308
|
-
}
|
|
309
|
-
),
|
|
310
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex flex-col items-center gap-1 text-center", children: [
|
|
311
|
-
/* @__PURE__ */ jsx3(
|
|
312
|
-
"p",
|
|
313
|
-
{
|
|
314
|
-
className: cn(
|
|
315
|
-
"font-agg-sans text-agg-base leading-agg-6 font-agg-bold text-agg-foreground",
|
|
316
|
-
classNames == null ? void 0 : classNames.emptyStateTitle
|
|
317
|
-
),
|
|
318
|
-
children: labels.search.noResultsTitle
|
|
319
|
-
}
|
|
320
|
-
),
|
|
321
|
-
/* @__PURE__ */ jsx3(
|
|
322
|
-
"p",
|
|
323
|
-
{
|
|
324
|
-
className: cn(
|
|
325
|
-
"font-agg-sans text-agg-sm leading-agg-5 font-agg-normal text-agg-foreground",
|
|
326
|
-
classNames == null ? void 0 : classNames.emptyStateDescription
|
|
327
|
-
),
|
|
328
|
-
children: labels.search.noResultsDescription
|
|
329
|
-
}
|
|
330
|
-
)
|
|
331
|
-
] })
|
|
332
|
-
]
|
|
333
|
-
}
|
|
334
|
-
)
|
|
335
|
-
}
|
|
336
|
-
) : null
|
|
337
|
-
] });
|
|
338
|
-
};
|
|
339
|
-
Search.displayName = "Search";
|
|
340
|
-
|
|
341
|
-
export {
|
|
342
|
-
HelloWorld,
|
|
343
|
-
NumberValue,
|
|
344
|
-
Search
|
|
345
|
-
};
|
package/dist/chunk-MHCHR65A.mjs
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Icon,
|
|
3
|
-
cn,
|
|
4
|
-
getMotionClassName
|
|
5
|
-
} from "./chunk-HI4EEDN5.mjs";
|
|
6
|
-
|
|
7
|
-
// src/primitives/select/index.tsx
|
|
8
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
9
|
-
import { useLabels, useSdkUiConfig } from "@agg-market/hooks";
|
|
10
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
-
var Select = ({
|
|
12
|
-
items,
|
|
13
|
-
value,
|
|
14
|
-
onChange,
|
|
15
|
-
ariaLabel,
|
|
16
|
-
className,
|
|
17
|
-
disabled = false
|
|
18
|
-
}) => {
|
|
19
|
-
var _a;
|
|
20
|
-
const labels = useLabels();
|
|
21
|
-
const { enableAnimations } = useSdkUiConfig();
|
|
22
|
-
const hasEnabledItems = items.some((item) => !item.disabled);
|
|
23
|
-
const hasAnyIcon = items.some((item) => item.iconUrl);
|
|
24
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
25
|
-
const containerRef = useRef(null);
|
|
26
|
-
const close = useCallback(() => setIsOpen(false), []);
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (!isOpen)
|
|
29
|
-
return;
|
|
30
|
-
const handlePointerDown = (e) => {
|
|
31
|
-
if (containerRef.current && !containerRef.current.contains(e == null ? void 0 : e.target)) {
|
|
32
|
-
close();
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
document.addEventListener("mousedown", handlePointerDown);
|
|
36
|
-
return () => document.removeEventListener("mousedown", handlePointerDown);
|
|
37
|
-
}, [isOpen, close]);
|
|
38
|
-
useEffect(() => {
|
|
39
|
-
if (!isOpen)
|
|
40
|
-
return;
|
|
41
|
-
const handleKey = (e) => {
|
|
42
|
-
if ((e == null ? void 0 : e.key) === "Escape")
|
|
43
|
-
close();
|
|
44
|
-
};
|
|
45
|
-
document.addEventListener("keydown", handleKey);
|
|
46
|
-
return () => document.removeEventListener("keydown", handleKey);
|
|
47
|
-
}, [isOpen, close]);
|
|
48
|
-
const isDisabled = disabled || !hasEnabledItems;
|
|
49
|
-
const selectedItem = items.find((item) => item.value === value);
|
|
50
|
-
if (!hasAnyIcon) {
|
|
51
|
-
return /* @__PURE__ */ jsxs("label", { className: cn("group/agg-select", "relative inline-flex w-full", className), children: [
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
53
|
-
"select",
|
|
54
|
-
{
|
|
55
|
-
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
56
|
-
className: cn(
|
|
57
|
-
"w-full appearance-none rounded-agg-md border border-agg-separator bg-agg-secondary px-4 py-2 pr-10 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
|
|
58
|
-
getMotionClassName(
|
|
59
|
-
enableAnimations,
|
|
60
|
-
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
61
|
-
),
|
|
62
|
-
"focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15",
|
|
63
|
-
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
64
|
-
),
|
|
65
|
-
disabled: isDisabled,
|
|
66
|
-
value,
|
|
67
|
-
onChange: (event) => onChange(event.target.value),
|
|
68
|
-
children: items.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))
|
|
69
|
-
}
|
|
70
|
-
),
|
|
71
|
-
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) })
|
|
72
|
-
] });
|
|
73
|
-
}
|
|
74
|
-
return /* @__PURE__ */ jsxs(
|
|
75
|
-
"div",
|
|
76
|
-
{
|
|
77
|
-
ref: containerRef,
|
|
78
|
-
className: cn("group/agg-select", "relative inline-flex w-full", className),
|
|
79
|
-
children: [
|
|
80
|
-
/* @__PURE__ */ jsxs(
|
|
81
|
-
"button",
|
|
82
|
-
{
|
|
83
|
-
type: "button",
|
|
84
|
-
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
85
|
-
"aria-expanded": isOpen,
|
|
86
|
-
"aria-haspopup": "listbox",
|
|
87
|
-
disabled: isDisabled,
|
|
88
|
-
className: cn(
|
|
89
|
-
"w-full rounded-agg-md border border-agg-separator bg-agg-secondary px-4 py-2 pr-10 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
|
|
90
|
-
"flex items-center gap-2 text-left",
|
|
91
|
-
getMotionClassName(
|
|
92
|
-
enableAnimations,
|
|
93
|
-
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
94
|
-
),
|
|
95
|
-
"focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15",
|
|
96
|
-
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
97
|
-
),
|
|
98
|
-
onClick: () => setIsOpen((prev) => !prev),
|
|
99
|
-
children: [
|
|
100
|
-
(selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ jsx(
|
|
101
|
-
"img",
|
|
102
|
-
{
|
|
103
|
-
src: selectedItem.iconUrl,
|
|
104
|
-
alt: "",
|
|
105
|
-
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
106
|
-
}
|
|
107
|
-
) : null,
|
|
108
|
-
/* @__PURE__ */ jsx("span", { className: "flex-1 truncate", children: (_a = selectedItem == null ? void 0 : selectedItem.label) != null ? _a : "" })
|
|
109
|
-
]
|
|
110
|
-
}
|
|
111
|
-
),
|
|
112
|
-
/* @__PURE__ */ jsx("span", { className: "pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ jsx(Icon, { name: "chevron-down", size: "small", color: "currentColor" }) }),
|
|
113
|
-
isOpen ? /* @__PURE__ */ jsx(
|
|
114
|
-
"div",
|
|
115
|
-
{
|
|
116
|
-
role: "listbox",
|
|
117
|
-
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
118
|
-
className: "absolute top-full left-0 z-50 mt-1 w-full overflow-hidden rounded-agg-md border border-agg-separator bg-agg-secondary shadow-lg",
|
|
119
|
-
children: items.map((item) => {
|
|
120
|
-
const isSelected = item.value === value;
|
|
121
|
-
return /* @__PURE__ */ jsxs(
|
|
122
|
-
"button",
|
|
123
|
-
{
|
|
124
|
-
type: "button",
|
|
125
|
-
role: "option",
|
|
126
|
-
"aria-selected": isSelected,
|
|
127
|
-
disabled: item.disabled,
|
|
128
|
-
className: cn(
|
|
129
|
-
"flex w-full items-center gap-2 px-4 py-2 text-left text-agg-sm leading-agg-5 outline-none",
|
|
130
|
-
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
131
|
-
isSelected ? "font-agg-bold text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
132
|
-
item.disabled && "cursor-not-allowed opacity-60"
|
|
133
|
-
),
|
|
134
|
-
onClick: () => {
|
|
135
|
-
if (!item.disabled) {
|
|
136
|
-
onChange(item.value);
|
|
137
|
-
close();
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
children: [
|
|
141
|
-
item.iconUrl ? /* @__PURE__ */ jsx(
|
|
142
|
-
"img",
|
|
143
|
-
{
|
|
144
|
-
src: item.iconUrl,
|
|
145
|
-
alt: "",
|
|
146
|
-
className: "h-4 w-4 shrink-0 rounded-sm object-contain"
|
|
147
|
-
}
|
|
148
|
-
) : null,
|
|
149
|
-
/* @__PURE__ */ jsx("span", { className: "truncate", children: item.label })
|
|
150
|
-
]
|
|
151
|
-
},
|
|
152
|
-
item.value
|
|
153
|
-
);
|
|
154
|
-
})
|
|
155
|
-
}
|
|
156
|
-
) : null
|
|
157
|
-
]
|
|
158
|
-
}
|
|
159
|
-
);
|
|
160
|
-
};
|
|
161
|
-
Select.displayName = "Select";
|
|
162
|
-
|
|
163
|
-
export {
|
|
164
|
-
Select
|
|
165
|
-
};
|
package/dist/chunk-PASXFYKQ.mjs
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
cn,
|
|
3
|
-
iconSizeClasses
|
|
4
|
-
} from "./chunk-HI4EEDN5.mjs";
|
|
5
|
-
|
|
6
|
-
// src/primitives/loading-icon/index.tsx
|
|
7
|
-
import { useLabels, useSdkUiConfig } from "@agg-market/hooks";
|
|
8
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
-
var LoadingIcon = ({
|
|
10
|
-
size = "medium",
|
|
11
|
-
className,
|
|
12
|
-
ariaLabel
|
|
13
|
-
}) => {
|
|
14
|
-
const labels = useLabels();
|
|
15
|
-
const { enableAnimations } = useSdkUiConfig();
|
|
16
|
-
return /* @__PURE__ */ jsx(
|
|
17
|
-
"span",
|
|
18
|
-
{
|
|
19
|
-
role: "status",
|
|
20
|
-
"aria-label": ariaLabel != null ? ariaLabel : labels.common.loading,
|
|
21
|
-
className: cn(
|
|
22
|
-
"group/agg-loading-icon",
|
|
23
|
-
"inline-grid place-items-center text-agg-primary will-change-transform",
|
|
24
|
-
className
|
|
25
|
-
),
|
|
26
|
-
children: /* @__PURE__ */ jsx("span", { className: "inline-grid place-items-center", "aria-hidden": "true", children: /* @__PURE__ */ jsx("svg", { viewBox: "0 0 44 44", className: cn("block", iconSizeClasses[size]), children: /* @__PURE__ */ jsxs("g", { children: [
|
|
27
|
-
enableAnimations ? /* @__PURE__ */ jsx(
|
|
28
|
-
"animateTransform",
|
|
29
|
-
{
|
|
30
|
-
attributeName: "transform",
|
|
31
|
-
attributeType: "XML",
|
|
32
|
-
type: "rotate",
|
|
33
|
-
from: "0 22 22",
|
|
34
|
-
to: "360 22 22",
|
|
35
|
-
dur: "1.4s",
|
|
36
|
-
repeatCount: "indefinite"
|
|
37
|
-
}
|
|
38
|
-
) : null,
|
|
39
|
-
/* @__PURE__ */ jsx(
|
|
40
|
-
"circle",
|
|
41
|
-
{
|
|
42
|
-
cx: "22",
|
|
43
|
-
cy: "22",
|
|
44
|
-
r: "16",
|
|
45
|
-
fill: "none",
|
|
46
|
-
stroke: "currentColor",
|
|
47
|
-
strokeWidth: "6",
|
|
48
|
-
strokeLinecap: "round",
|
|
49
|
-
strokeDasharray: "60 100",
|
|
50
|
-
strokeDashoffset: "0",
|
|
51
|
-
children: enableAnimations ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
52
|
-
/* @__PURE__ */ jsx(
|
|
53
|
-
"animate",
|
|
54
|
-
{
|
|
55
|
-
attributeName: "stroke-dasharray",
|
|
56
|
-
values: "1 100;60 100;1 100",
|
|
57
|
-
dur: "1.2s",
|
|
58
|
-
repeatCount: "indefinite"
|
|
59
|
-
}
|
|
60
|
-
),
|
|
61
|
-
/* @__PURE__ */ jsx(
|
|
62
|
-
"animate",
|
|
63
|
-
{
|
|
64
|
-
attributeName: "stroke-dashoffset",
|
|
65
|
-
values: "0;-25;-100",
|
|
66
|
-
dur: "1.2s",
|
|
67
|
-
repeatCount: "indefinite"
|
|
68
|
-
}
|
|
69
|
-
)
|
|
70
|
-
] }) : null
|
|
71
|
-
}
|
|
72
|
-
)
|
|
73
|
-
] }) }) })
|
|
74
|
-
}
|
|
75
|
-
);
|
|
76
|
-
};
|
|
77
|
-
LoadingIcon.displayName = "LoadingIcon";
|
|
78
|
-
|
|
79
|
-
export {
|
|
80
|
-
LoadingIcon
|
|
81
|
-
};
|