@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,142 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveOutcomeTitle,
|
|
3
|
+
selectPrimaryVenueMarket,
|
|
4
|
+
sortOutcomes
|
|
5
|
+
} from "./chunk-PAQ542ER.mjs";
|
|
6
|
+
import {
|
|
7
|
+
fallbackLineColors,
|
|
8
|
+
lineColorByVenue
|
|
9
|
+
} from "./chunk-P674XRDY.mjs";
|
|
10
|
+
|
|
11
|
+
// src/events/item-details/event-list-item-details.utils.ts
|
|
12
|
+
import dayjs from "dayjs";
|
|
13
|
+
var normalizeLabel = (value) => {
|
|
14
|
+
return value.trim().toLowerCase();
|
|
15
|
+
};
|
|
16
|
+
var isDateLikeLabel = (value) => {
|
|
17
|
+
if (!value.trim())
|
|
18
|
+
return false;
|
|
19
|
+
return dayjs(value).isValid();
|
|
20
|
+
};
|
|
21
|
+
var formatDateLabel = (value) => {
|
|
22
|
+
if (!isDateLikeLabel(value))
|
|
23
|
+
return value;
|
|
24
|
+
return dayjs(value).format("MMM D, YYYY");
|
|
25
|
+
};
|
|
26
|
+
var getDefaultSelectedTimeRange = (value) => {
|
|
27
|
+
if (!value)
|
|
28
|
+
return "1M";
|
|
29
|
+
return value;
|
|
30
|
+
};
|
|
31
|
+
var getTimeWindowByRange = (range) => {
|
|
32
|
+
const endTs = dayjs().unix();
|
|
33
|
+
if (range === "1H") {
|
|
34
|
+
return {
|
|
35
|
+
startTs: dayjs.unix(endTs).subtract(1, "hour").unix(),
|
|
36
|
+
endTs,
|
|
37
|
+
intervalMinutes: 5
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (range === "6H") {
|
|
41
|
+
return {
|
|
42
|
+
startTs: dayjs.unix(endTs).subtract(6, "hour").unix(),
|
|
43
|
+
endTs,
|
|
44
|
+
intervalMinutes: 15
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (range === "1D") {
|
|
48
|
+
return {
|
|
49
|
+
startTs: dayjs.unix(endTs).subtract(1, "day").unix(),
|
|
50
|
+
endTs,
|
|
51
|
+
intervalMinutes: 30
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (range === "1W") {
|
|
55
|
+
return {
|
|
56
|
+
startTs: dayjs.unix(endTs).subtract(7, "day").unix(),
|
|
57
|
+
endTs,
|
|
58
|
+
intervalMinutes: 60
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (range === "1M") {
|
|
62
|
+
return {
|
|
63
|
+
startTs: dayjs.unix(endTs).subtract(1, "month").unix(),
|
|
64
|
+
endTs,
|
|
65
|
+
intervalMinutes: 240
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
startTs: dayjs.unix(endTs).subtract(6, "month").unix(),
|
|
70
|
+
endTs,
|
|
71
|
+
intervalMinutes: 720
|
|
72
|
+
};
|
|
73
|
+
};
|
|
74
|
+
var resolveOutcomeLabels = (venueMarkets) => {
|
|
75
|
+
var _a;
|
|
76
|
+
const primaryMarket = selectPrimaryVenueMarket(venueMarkets);
|
|
77
|
+
const initialLabels = ((_a = primaryMarket == null ? void 0 : primaryMarket.venueMarketOutcomes) != null ? _a : []).map(
|
|
78
|
+
(outcome) => resolveOutcomeTitle(outcome)
|
|
79
|
+
);
|
|
80
|
+
const labels = new Set(initialLabels);
|
|
81
|
+
venueMarkets.forEach((market) => {
|
|
82
|
+
sortOutcomes(market.venueMarketOutcomes).forEach((outcome) => {
|
|
83
|
+
labels.add(resolveOutcomeTitle(outcome));
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
return [...labels];
|
|
87
|
+
};
|
|
88
|
+
var resolveDefaultOutcomeLabel = (outcomeLabels) => {
|
|
89
|
+
return outcomeLabels[0];
|
|
90
|
+
};
|
|
91
|
+
var matchOutcomeByLabel = (outcome, selectedOutcomeLabel) => {
|
|
92
|
+
const normalizedSelectedLabel = normalizeLabel(selectedOutcomeLabel);
|
|
93
|
+
const resolvedTitle = resolveOutcomeTitle(outcome);
|
|
94
|
+
return normalizeLabel(resolvedTitle) === normalizedSelectedLabel || normalizeLabel(outcome.label) === normalizedSelectedLabel;
|
|
95
|
+
};
|
|
96
|
+
var resolveOutcomesByVenue = (venueMarkets, selectedOutcomeLabel) => {
|
|
97
|
+
return venueMarkets.map((market) => {
|
|
98
|
+
const matchedOutcome = sortOutcomes(market.venueMarketOutcomes).find((outcome) => {
|
|
99
|
+
return matchOutcomeByLabel(outcome, selectedOutcomeLabel);
|
|
100
|
+
});
|
|
101
|
+
if (!matchedOutcome)
|
|
102
|
+
return null;
|
|
103
|
+
return {
|
|
104
|
+
venue: market.venue,
|
|
105
|
+
market,
|
|
106
|
+
outcome: matchedOutcome
|
|
107
|
+
};
|
|
108
|
+
}).filter((item) => item != null);
|
|
109
|
+
};
|
|
110
|
+
var buildPriceHistoryGroups = (selectedOutcomes) => {
|
|
111
|
+
const venueMarketOutcomeIdsByVenue = /* @__PURE__ */ new Map();
|
|
112
|
+
selectedOutcomes.forEach(({ venue, outcome }) => {
|
|
113
|
+
var _a;
|
|
114
|
+
if (!venueMarketOutcomeIdsByVenue.has(venue)) {
|
|
115
|
+
venueMarketOutcomeIdsByVenue.set(venue, []);
|
|
116
|
+
}
|
|
117
|
+
(_a = venueMarketOutcomeIdsByVenue.get(venue)) == null ? void 0 : _a.push(outcome.id);
|
|
118
|
+
});
|
|
119
|
+
return [...venueMarketOutcomeIdsByVenue.entries()].map(([venue, venueMarketOutcomeIds]) => ({
|
|
120
|
+
venue,
|
|
121
|
+
venueMarketOutcomeIds
|
|
122
|
+
})).filter((group) => group.venueMarketOutcomeIds.length > 0);
|
|
123
|
+
};
|
|
124
|
+
var resolveSeriesColor = (venue, index) => {
|
|
125
|
+
var _a;
|
|
126
|
+
const colorFromVenue = lineColorByVenue[venue];
|
|
127
|
+
if (colorFromVenue)
|
|
128
|
+
return colorFromVenue;
|
|
129
|
+
return (_a = fallbackLineColors[index % fallbackLineColors.length]) != null ? _a : "#2e5cff";
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export {
|
|
133
|
+
isDateLikeLabel,
|
|
134
|
+
formatDateLabel,
|
|
135
|
+
getDefaultSelectedTimeRange,
|
|
136
|
+
getTimeWindowByRange,
|
|
137
|
+
resolveOutcomeLabels,
|
|
138
|
+
resolveDefaultOutcomeLabel,
|
|
139
|
+
resolveOutcomesByVenue,
|
|
140
|
+
buildPriceHistoryGroups,
|
|
141
|
+
resolveSeriesColor
|
|
142
|
+
};
|
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
import {
|
|
2
|
+
LoadingIcon
|
|
3
|
+
} from "./chunk-VAZE267Q.mjs";
|
|
4
|
+
import {
|
|
5
|
+
VenueLogo
|
|
6
|
+
} from "./chunk-4ADCXJE6.mjs";
|
|
7
|
+
import {
|
|
8
|
+
Icon
|
|
9
|
+
} from "./chunk-DA6KZWSK.mjs";
|
|
10
|
+
import {
|
|
11
|
+
Button
|
|
12
|
+
} from "./chunk-GPBLZGJ2.mjs";
|
|
13
|
+
import {
|
|
14
|
+
AGG_ROOT_CLASS_NAME,
|
|
15
|
+
__spreadProps,
|
|
16
|
+
__spreadValues,
|
|
17
|
+
cn,
|
|
18
|
+
formatUsd,
|
|
19
|
+
getMotionClassName,
|
|
20
|
+
shortenAddress
|
|
21
|
+
} from "./chunk-GC3QIIH7.mjs";
|
|
22
|
+
|
|
23
|
+
// src/auth/connect-button/index.tsx
|
|
24
|
+
import { useEffect, useMemo, useRef, useState } from "react";
|
|
25
|
+
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
26
|
+
import { isAddress } from "viem";
|
|
27
|
+
import { useAccount, useConnect, useDisconnect, useSignMessage } from "wagmi";
|
|
28
|
+
import {
|
|
29
|
+
getWalletAddressFromUserProfile,
|
|
30
|
+
useAggAuth,
|
|
31
|
+
useAggBalanceState,
|
|
32
|
+
useLabels,
|
|
33
|
+
useSdkUiConfig
|
|
34
|
+
} from "@agg/hooks";
|
|
35
|
+
|
|
36
|
+
// src/auth/connect-button/connect-button.constants.ts
|
|
37
|
+
var connectButtonContainerClassName = cn(
|
|
38
|
+
"inline-flex flex-col items-start gap-2 font-agg-sans"
|
|
39
|
+
);
|
|
40
|
+
var connectedButtonsRowClassName = cn("inline-flex h-10 items-center gap-2");
|
|
41
|
+
var connectedBalanceChipClassName = cn(
|
|
42
|
+
"inline-flex h-10 items-center gap-3 rounded-agg-full border border-agg-separator bg-agg-secondary pl-3 pr-12 font-agg-sans"
|
|
43
|
+
);
|
|
44
|
+
var connectedProfileChipClassName = cn(
|
|
45
|
+
"-ml-12",
|
|
46
|
+
"inline-flex h-10 items-center gap-3 rounded-agg-full border border-agg-separator bg-agg-secondary pl-2 pr-3 font-agg-sans",
|
|
47
|
+
"cursor-pointer hover:bg-agg-secondary-hover",
|
|
48
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-agg-primary-hover focus-visible:ring-offset-2 focus-visible:ring-offset-agg-secondary"
|
|
49
|
+
);
|
|
50
|
+
var profileMenuContentClassName = cn(
|
|
51
|
+
"z-50 w-64 overflow-hidden rounded-agg-xl font-agg-sans",
|
|
52
|
+
"border border-agg-separator bg-agg-secondary",
|
|
53
|
+
"shadow-agg-popover"
|
|
54
|
+
);
|
|
55
|
+
var profileMenuSectionClassName = cn("flex w-full flex-col gap-5 px-5 py-5");
|
|
56
|
+
var profileMenuSeparatorClassName = cn("h-px w-full bg-agg-separator");
|
|
57
|
+
var profileMenuActionItemClassName = cn(
|
|
58
|
+
"flex w-full items-center gap-3 px-5 py-4 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground",
|
|
59
|
+
"outline-none",
|
|
60
|
+
"hover:bg-agg-secondary-hover focus:bg-agg-secondary-hover"
|
|
61
|
+
);
|
|
62
|
+
var avatarRootClassName = cn(
|
|
63
|
+
"inline-flex size-6 shrink-0 items-center justify-center rounded-agg-full bg-agg-separator"
|
|
64
|
+
);
|
|
65
|
+
var avatarIconClassName = cn("h-[66%] w-[66%] text-agg-muted-foreground");
|
|
66
|
+
|
|
67
|
+
// src/auth/connect-button/index.tsx
|
|
68
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
69
|
+
var venueLogoNameSet = /* @__PURE__ */ new Set([
|
|
70
|
+
"polymarket",
|
|
71
|
+
"kalshi",
|
|
72
|
+
"opinion",
|
|
73
|
+
"probable"
|
|
74
|
+
]);
|
|
75
|
+
var toVenueLogoName = (value) => {
|
|
76
|
+
if (!venueLogoNameSet.has(value))
|
|
77
|
+
return null;
|
|
78
|
+
return value;
|
|
79
|
+
};
|
|
80
|
+
function WalletAvatar({ className }) {
|
|
81
|
+
return /* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn(avatarRootClassName, className), children: /* @__PURE__ */ jsx(Icon, { className: avatarIconClassName, name: "wallet-avatar" }) });
|
|
82
|
+
}
|
|
83
|
+
var ConnectButton = ({
|
|
84
|
+
autoSignInOnConnect = true,
|
|
85
|
+
buttonProps,
|
|
86
|
+
classNames,
|
|
87
|
+
disabled,
|
|
88
|
+
onConnect,
|
|
89
|
+
onDepositClick,
|
|
90
|
+
onDisconnect,
|
|
91
|
+
onProfileClick,
|
|
92
|
+
onViewAllBalancesClick,
|
|
93
|
+
onWithdrawClick
|
|
94
|
+
}) => {
|
|
95
|
+
var _a, _b;
|
|
96
|
+
const [isProfileMenuOpen, setIsProfileMenuOpen] = useState(false);
|
|
97
|
+
const autoSignInAttemptRef = useRef(null);
|
|
98
|
+
const { enableAnimations, rootClassName } = useSdkUiConfig();
|
|
99
|
+
const labels = useLabels();
|
|
100
|
+
const { address: walletAddress, chainId, isConnected: isWalletConnected } = useAccount();
|
|
101
|
+
const { connect, connectors, isPending: isConnectPending } = useConnect();
|
|
102
|
+
const { disconnect } = useDisconnect();
|
|
103
|
+
const { signMessageAsync } = useSignMessage();
|
|
104
|
+
const {
|
|
105
|
+
totalBalance,
|
|
106
|
+
balanceBreakdown,
|
|
107
|
+
connectedVenues,
|
|
108
|
+
isLoading: isBalanceLoading,
|
|
109
|
+
error: balanceError
|
|
110
|
+
} = useAggBalanceState();
|
|
111
|
+
const preferredConnector = useMemo(() => {
|
|
112
|
+
var _a2;
|
|
113
|
+
return (_a2 = connectors.find((connector) => connector.name === "MetaMask")) != null ? _a2 : connectors[0];
|
|
114
|
+
}, [connectors]);
|
|
115
|
+
const signInStatement = labels.auth.signInStatement;
|
|
116
|
+
const { signIn, signOut, isAuthenticated, user, isLoading, error } = useAggAuth({
|
|
117
|
+
signMessage: (message) => signMessageAsync({ message }),
|
|
118
|
+
address: walletAddress != null ? walletAddress : "",
|
|
119
|
+
chainId
|
|
120
|
+
});
|
|
121
|
+
const resolvedWalletAddress = (_b = (_a = getWalletAddressFromUserProfile(user)) != null ? _a : walletAddress) != null ? _b : "";
|
|
122
|
+
const resolvedAddressLabel = shortenAddress(resolvedWalletAddress);
|
|
123
|
+
const resolvedProfileLabel = resolvedAddressLabel;
|
|
124
|
+
const resolvedBalanceRows = useMemo(() => {
|
|
125
|
+
const balancesByVenue = /* @__PURE__ */ new Map();
|
|
126
|
+
for (const balanceItem of balanceBreakdown) {
|
|
127
|
+
balancesByVenue.set(balanceItem.venue, balanceItem.balance);
|
|
128
|
+
}
|
|
129
|
+
for (const venue of connectedVenues) {
|
|
130
|
+
if (!balancesByVenue.has(venue)) {
|
|
131
|
+
balancesByVenue.set(venue, 0);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return Array.from(balancesByVenue.entries()).map(([venue, balanceValue]) => {
|
|
135
|
+
var _a2;
|
|
136
|
+
return {
|
|
137
|
+
key: venue,
|
|
138
|
+
label: (_a2 = labels.venues[venue]) != null ? _a2 : venue,
|
|
139
|
+
amountLabel: formatUsd(balanceValue),
|
|
140
|
+
venue: toVenueLogoName(venue)
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
}, [balanceBreakdown, connectedVenues, labels.venues]);
|
|
144
|
+
const errorText = error ? `Error: ${error.message}` : null;
|
|
145
|
+
const balanceErrorText = balanceError ? `Error: ${balanceError.message}` : null;
|
|
146
|
+
const resolvedErrorText = errorText != null ? errorText : balanceErrorText;
|
|
147
|
+
const normalizedWalletAddress = (walletAddress != null ? walletAddress : "").toLowerCase();
|
|
148
|
+
const hasWalletAddress = isAddress(walletAddress != null ? walletAddress : "");
|
|
149
|
+
const isConnectDisabled = disabled || isConnectPending || !preferredConnector;
|
|
150
|
+
const dropdownMenuItemClassName = cn(
|
|
151
|
+
"cursor-pointer",
|
|
152
|
+
profileMenuActionItemClassName,
|
|
153
|
+
getMotionClassName(enableAnimations, "transition-colors"),
|
|
154
|
+
disabled ? "pointer-events-none opacity-50" : null,
|
|
155
|
+
classNames == null ? void 0 : classNames.profileMenuActionItem
|
|
156
|
+
);
|
|
157
|
+
useEffect(() => {
|
|
158
|
+
if (!autoSignInOnConnect) {
|
|
159
|
+
autoSignInAttemptRef.current = null;
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
if (!isWalletConnected || isAuthenticated || isLoading || !hasWalletAddress) {
|
|
163
|
+
if (!isWalletConnected || isAuthenticated) {
|
|
164
|
+
autoSignInAttemptRef.current = null;
|
|
165
|
+
}
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
const attemptKey = `${normalizedWalletAddress}:${chainId != null ? chainId : "unknown"}`;
|
|
169
|
+
if (autoSignInAttemptRef.current === attemptKey)
|
|
170
|
+
return;
|
|
171
|
+
autoSignInAttemptRef.current = attemptKey;
|
|
172
|
+
void signIn(signInStatement).catch(() => void 0);
|
|
173
|
+
}, [
|
|
174
|
+
autoSignInOnConnect,
|
|
175
|
+
chainId,
|
|
176
|
+
hasWalletAddress,
|
|
177
|
+
isAuthenticated,
|
|
178
|
+
isLoading,
|
|
179
|
+
isWalletConnected,
|
|
180
|
+
normalizedWalletAddress,
|
|
181
|
+
signIn,
|
|
182
|
+
signInStatement
|
|
183
|
+
]);
|
|
184
|
+
const handleConnectClick = () => {
|
|
185
|
+
if (isConnectDisabled || !preferredConnector)
|
|
186
|
+
return;
|
|
187
|
+
connect({ connector: preferredConnector });
|
|
188
|
+
if (!onConnect)
|
|
189
|
+
return;
|
|
190
|
+
void Promise.resolve(onConnect());
|
|
191
|
+
};
|
|
192
|
+
const handleSignInClick = () => {
|
|
193
|
+
if (disabled || isLoading || !hasWalletAddress)
|
|
194
|
+
return;
|
|
195
|
+
void signIn(signInStatement);
|
|
196
|
+
};
|
|
197
|
+
const handleDepositClick = () => {
|
|
198
|
+
if (disabled)
|
|
199
|
+
return;
|
|
200
|
+
if (!onDepositClick)
|
|
201
|
+
return;
|
|
202
|
+
void Promise.resolve(onDepositClick());
|
|
203
|
+
};
|
|
204
|
+
const handleProfileItemClick = () => {
|
|
205
|
+
if (disabled)
|
|
206
|
+
return;
|
|
207
|
+
if (!onProfileClick)
|
|
208
|
+
return;
|
|
209
|
+
void Promise.resolve(onProfileClick());
|
|
210
|
+
};
|
|
211
|
+
const handleWithdrawClick = () => {
|
|
212
|
+
if (disabled)
|
|
213
|
+
return;
|
|
214
|
+
if (!onWithdrawClick)
|
|
215
|
+
return;
|
|
216
|
+
void Promise.resolve(onWithdrawClick());
|
|
217
|
+
};
|
|
218
|
+
const handleViewAllBalancesClick = () => {
|
|
219
|
+
if (disabled)
|
|
220
|
+
return;
|
|
221
|
+
if (!onViewAllBalancesClick)
|
|
222
|
+
return;
|
|
223
|
+
void Promise.resolve(onViewAllBalancesClick());
|
|
224
|
+
};
|
|
225
|
+
const handleDisconnectClick = () => {
|
|
226
|
+
if (disabled)
|
|
227
|
+
return;
|
|
228
|
+
signOut();
|
|
229
|
+
disconnect();
|
|
230
|
+
if (!onDisconnect)
|
|
231
|
+
return;
|
|
232
|
+
void Promise.resolve(onDisconnect());
|
|
233
|
+
};
|
|
234
|
+
const handleProfileMenuOpenChange = (open) => {
|
|
235
|
+
if (disabled)
|
|
236
|
+
return;
|
|
237
|
+
setIsProfileMenuOpen(open);
|
|
238
|
+
};
|
|
239
|
+
if (resolvedErrorText) {
|
|
240
|
+
console.error({ resolvedErrorText });
|
|
241
|
+
}
|
|
242
|
+
if (!isWalletConnected) {
|
|
243
|
+
return /* @__PURE__ */ jsx("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx(
|
|
244
|
+
Button,
|
|
245
|
+
__spreadProps(__spreadValues({
|
|
246
|
+
variant: "primary",
|
|
247
|
+
size: "l",
|
|
248
|
+
className: classNames == null ? void 0 : classNames.connectButton,
|
|
249
|
+
onClick: handleConnectClick,
|
|
250
|
+
disabled: isConnectDisabled,
|
|
251
|
+
"aria-label": labels.auth.connect(preferredConnector == null ? void 0 : preferredConnector.name)
|
|
252
|
+
}, buttonProps), {
|
|
253
|
+
children: labels.auth.connect(preferredConnector == null ? void 0 : preferredConnector.name)
|
|
254
|
+
})
|
|
255
|
+
) });
|
|
256
|
+
}
|
|
257
|
+
if (!isAuthenticated) {
|
|
258
|
+
return /* @__PURE__ */ jsx("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsx(
|
|
259
|
+
Button,
|
|
260
|
+
__spreadProps(__spreadValues({
|
|
261
|
+
variant: "primary",
|
|
262
|
+
size: "l",
|
|
263
|
+
className: classNames == null ? void 0 : classNames.signInButton,
|
|
264
|
+
onClick: handleSignInClick,
|
|
265
|
+
disabled: disabled || !hasWalletAddress,
|
|
266
|
+
isLoading,
|
|
267
|
+
"aria-label": isLoading ? labels.auth.signingIn : labels.auth.signIn
|
|
268
|
+
}, buttonProps), {
|
|
269
|
+
children: isLoading ? labels.auth.signingIn : labels.auth.signIn
|
|
270
|
+
})
|
|
271
|
+
) });
|
|
272
|
+
}
|
|
273
|
+
return /* @__PURE__ */ jsx("div", { className: cn(connectButtonContainerClassName, classNames == null ? void 0 : classNames.root), children: /* @__PURE__ */ jsxs("div", { className: cn(connectedButtonsRowClassName, classNames == null ? void 0 : classNames.connectedRow), children: [
|
|
274
|
+
/* @__PURE__ */ jsxs("div", { className: cn(connectedBalanceChipClassName, classNames == null ? void 0 : classNames.balanceChip), children: [
|
|
275
|
+
/* @__PURE__ */ jsx(
|
|
276
|
+
Button,
|
|
277
|
+
{
|
|
278
|
+
variant: "primary",
|
|
279
|
+
size: "xxs",
|
|
280
|
+
className: cn("h-6 px-3 text-agg-xs leading-agg-4", classNames == null ? void 0 : classNames.depositButton),
|
|
281
|
+
onClick: handleDepositClick,
|
|
282
|
+
disabled,
|
|
283
|
+
"aria-label": labels.auth.deposit,
|
|
284
|
+
children: labels.auth.deposit
|
|
285
|
+
}
|
|
286
|
+
),
|
|
287
|
+
/* @__PURE__ */ jsx(
|
|
288
|
+
"p",
|
|
289
|
+
{
|
|
290
|
+
className: cn("text-agg-sm leading-none text-agg-foreground", classNames == null ? void 0 : classNames.balanceText),
|
|
291
|
+
children: isBalanceLoading ? /* @__PURE__ */ jsx(LoadingIcon, { size: "s" }) : formatUsd(totalBalance)
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] }),
|
|
295
|
+
/* @__PURE__ */ jsxs(DropdownMenu.Root, { open: isProfileMenuOpen, onOpenChange: handleProfileMenuOpenChange, children: [
|
|
296
|
+
/* @__PURE__ */ jsx(DropdownMenu.Trigger, { asChild: true, children: /* @__PURE__ */ jsxs(
|
|
297
|
+
"button",
|
|
298
|
+
{
|
|
299
|
+
type: "button",
|
|
300
|
+
className: cn(
|
|
301
|
+
connectedProfileChipClassName,
|
|
302
|
+
getMotionClassName(enableAnimations, "transition-colors"),
|
|
303
|
+
classNames == null ? void 0 : classNames.profileTrigger
|
|
304
|
+
),
|
|
305
|
+
disabled,
|
|
306
|
+
"aria-label": labels.auth.walletMenuFor(resolvedProfileLabel),
|
|
307
|
+
children: [
|
|
308
|
+
/* @__PURE__ */ jsx(WalletAvatar, {}),
|
|
309
|
+
/* @__PURE__ */ jsx(
|
|
310
|
+
"span",
|
|
311
|
+
{
|
|
312
|
+
className: cn(
|
|
313
|
+
"text-agg-base font-agg-bold leading-none text-agg-foreground",
|
|
314
|
+
classNames == null ? void 0 : classNames.profileTriggerLabel
|
|
315
|
+
),
|
|
316
|
+
children: resolvedProfileLabel
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ jsx(
|
|
320
|
+
Icon,
|
|
321
|
+
{
|
|
322
|
+
name: isProfileMenuOpen ? "chevron-up" : "chevron-down",
|
|
323
|
+
size: "s",
|
|
324
|
+
className: "h-3.5 w-3.5 text-agg-foreground",
|
|
325
|
+
"aria-hidden": "true"
|
|
326
|
+
}
|
|
327
|
+
)
|
|
328
|
+
]
|
|
329
|
+
}
|
|
330
|
+
) }),
|
|
331
|
+
/* @__PURE__ */ jsx(DropdownMenu.Portal, { children: /* @__PURE__ */ jsxs(
|
|
332
|
+
DropdownMenu.Content,
|
|
333
|
+
{
|
|
334
|
+
className: cn(
|
|
335
|
+
AGG_ROOT_CLASS_NAME,
|
|
336
|
+
rootClassName,
|
|
337
|
+
profileMenuContentClassName,
|
|
338
|
+
classNames == null ? void 0 : classNames.profileMenuContent
|
|
339
|
+
),
|
|
340
|
+
"data-agg-animations": enableAnimations ? "true" : "false",
|
|
341
|
+
sideOffset: 4,
|
|
342
|
+
align: "end",
|
|
343
|
+
children: [
|
|
344
|
+
/* @__PURE__ */ jsx(
|
|
345
|
+
"div",
|
|
346
|
+
{
|
|
347
|
+
className: cn(
|
|
348
|
+
profileMenuSectionClassName,
|
|
349
|
+
"cursor-pointer",
|
|
350
|
+
classNames == null ? void 0 : classNames.profileMenuSection
|
|
351
|
+
),
|
|
352
|
+
onClick: handleProfileItemClick,
|
|
353
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
|
|
354
|
+
/* @__PURE__ */ jsx(WalletAvatar, { className: "size-11" }),
|
|
355
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-0.5", children: [
|
|
356
|
+
/* @__PURE__ */ jsx("p", { className: "text-agg-lg font-agg-bold leading-agg-7 text-agg-foreground", children: resolvedProfileLabel }),
|
|
357
|
+
/* @__PURE__ */ jsx("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground", children: resolvedAddressLabel })
|
|
358
|
+
] })
|
|
359
|
+
] })
|
|
360
|
+
}
|
|
361
|
+
),
|
|
362
|
+
/* @__PURE__ */ jsx(
|
|
363
|
+
"div",
|
|
364
|
+
{
|
|
365
|
+
className: cn(profileMenuSeparatorClassName, classNames == null ? void 0 : classNames.profileMenuSeparator)
|
|
366
|
+
}
|
|
367
|
+
),
|
|
368
|
+
/* @__PURE__ */ jsxs("div", { className: cn(profileMenuSectionClassName, classNames == null ? void 0 : classNames.profileMenuSection), children: [
|
|
369
|
+
isBalanceLoading ? /* @__PURE__ */ jsxs("p", { className: "flex flex-col gap-2 items-center justify-center text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground", children: [
|
|
370
|
+
/* @__PURE__ */ jsx(LoadingIcon, {}),
|
|
371
|
+
labels.auth.loadingBalances
|
|
372
|
+
] }) : /* @__PURE__ */ jsx(Fragment, { children: resolvedBalanceRows.length === 0 ? /* @__PURE__ */ jsxs("p", { className: "flex flex-col gap-2 items-center justify-center text-agg-sm font-agg-normal leading-agg-5 text-agg-muted-foreground", children: [
|
|
373
|
+
/* @__PURE__ */ jsx(Icon, { name: "warning", className: "text-agg-primary" }),
|
|
374
|
+
labels.auth.noBalances
|
|
375
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
376
|
+
/* @__PURE__ */ jsx("p", { className: "text-agg-xs font-agg-bold uppercase leading-agg-4 tracking-agg-normal text-agg-muted-foreground", children: labels.auth.balances }),
|
|
377
|
+
/* @__PURE__ */ jsx(
|
|
378
|
+
Button,
|
|
379
|
+
{
|
|
380
|
+
variant: "tertiary",
|
|
381
|
+
size: "xxs",
|
|
382
|
+
className: "h-6 px-3 text-agg-xs leading-agg-4",
|
|
383
|
+
onClick: handleViewAllBalancesClick,
|
|
384
|
+
children: labels.auth.viewAll
|
|
385
|
+
}
|
|
386
|
+
)
|
|
387
|
+
] }) }),
|
|
388
|
+
!isBalanceLoading ? resolvedBalanceRows.map((row) => /* @__PURE__ */ jsxs("div", { className: "flex w-full items-center justify-between", children: [
|
|
389
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
390
|
+
row.venue ? /* @__PURE__ */ jsx(VenueLogo, { venue: row.venue, size: "s" }) : null,
|
|
391
|
+
/* @__PURE__ */ jsx("p", { className: "text-agg-sm font-agg-normal leading-agg-5 text-agg-foreground", children: row.label })
|
|
392
|
+
] }),
|
|
393
|
+
/* @__PURE__ */ jsx("p", { className: "text-agg-sm font-agg-bold leading-agg-5 text-agg-foreground", children: row.amountLabel })
|
|
394
|
+
] }, row.key)) : null
|
|
395
|
+
] }),
|
|
396
|
+
/* @__PURE__ */ jsx(
|
|
397
|
+
"div",
|
|
398
|
+
{
|
|
399
|
+
className: cn(profileMenuSeparatorClassName, classNames == null ? void 0 : classNames.profileMenuSeparator)
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ jsxs("div", { className: "flex w-full flex-col py-2", children: [
|
|
403
|
+
/* @__PURE__ */ jsxs(
|
|
404
|
+
DropdownMenu.Item,
|
|
405
|
+
{
|
|
406
|
+
className: dropdownMenuItemClassName,
|
|
407
|
+
onSelect: handleProfileItemClick,
|
|
408
|
+
disabled,
|
|
409
|
+
children: [
|
|
410
|
+
/* @__PURE__ */ jsx(Icon, { name: "profile", size: "s", className: "text-agg-foreground" }),
|
|
411
|
+
/* @__PURE__ */ jsx("span", { children: labels.auth.myProfile })
|
|
412
|
+
]
|
|
413
|
+
}
|
|
414
|
+
),
|
|
415
|
+
/* @__PURE__ */ jsxs(
|
|
416
|
+
DropdownMenu.Item,
|
|
417
|
+
{
|
|
418
|
+
className: dropdownMenuItemClassName,
|
|
419
|
+
onSelect: handleDepositClick,
|
|
420
|
+
disabled,
|
|
421
|
+
children: [
|
|
422
|
+
/* @__PURE__ */ jsx(Icon, { name: "download", size: "s", className: "text-agg-foreground" }),
|
|
423
|
+
/* @__PURE__ */ jsx("span", { children: labels.auth.deposit })
|
|
424
|
+
]
|
|
425
|
+
}
|
|
426
|
+
),
|
|
427
|
+
/* @__PURE__ */ jsxs(
|
|
428
|
+
DropdownMenu.Item,
|
|
429
|
+
{
|
|
430
|
+
className: dropdownMenuItemClassName,
|
|
431
|
+
onSelect: handleWithdrawClick,
|
|
432
|
+
disabled,
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ jsx(Icon, { name: "upload", size: "s", className: "text-agg-foreground" }),
|
|
435
|
+
/* @__PURE__ */ jsx("span", { children: labels.auth.withdraw })
|
|
436
|
+
]
|
|
437
|
+
}
|
|
438
|
+
),
|
|
439
|
+
/* @__PURE__ */ jsxs(
|
|
440
|
+
DropdownMenu.Item,
|
|
441
|
+
{
|
|
442
|
+
className: dropdownMenuItemClassName,
|
|
443
|
+
onSelect: handleDisconnectClick,
|
|
444
|
+
disabled,
|
|
445
|
+
children: [
|
|
446
|
+
/* @__PURE__ */ jsx(Icon, { name: "disconnect", size: "s", className: "text-agg-foreground" }),
|
|
447
|
+
/* @__PURE__ */ jsx("span", { children: labels.auth.disconnect })
|
|
448
|
+
]
|
|
449
|
+
}
|
|
450
|
+
)
|
|
451
|
+
] })
|
|
452
|
+
]
|
|
453
|
+
}
|
|
454
|
+
) })
|
|
455
|
+
] })
|
|
456
|
+
] }) });
|
|
457
|
+
};
|
|
458
|
+
ConnectButton.displayName = "ConnectButton";
|
|
459
|
+
|
|
460
|
+
export {
|
|
461
|
+
ConnectButton
|
|
462
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Icon
|
|
3
|
+
} from "./chunk-DA6KZWSK.mjs";
|
|
4
|
+
import {
|
|
5
|
+
cn,
|
|
6
|
+
getMotionClassName
|
|
7
|
+
} from "./chunk-GC3QIIH7.mjs";
|
|
8
|
+
|
|
9
|
+
// src/primitives/select/index.tsx
|
|
10
|
+
import { useLabels, useSdkUiConfig } from "@agg-market/hooks";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
var Select = ({
|
|
13
|
+
items,
|
|
14
|
+
value,
|
|
15
|
+
onChange,
|
|
16
|
+
ariaLabel,
|
|
17
|
+
className,
|
|
18
|
+
disabled = false
|
|
19
|
+
}) => {
|
|
20
|
+
const labels = useLabels();
|
|
21
|
+
const { enableAnimations } = useSdkUiConfig();
|
|
22
|
+
const hasEnabledItems = items.some((item) => !item.disabled);
|
|
23
|
+
return /* @__PURE__ */ jsxs("label", { className: cn("relative inline-flex w-full", className), children: [
|
|
24
|
+
/* @__PURE__ */ jsx(
|
|
25
|
+
"select",
|
|
26
|
+
{
|
|
27
|
+
"aria-label": ariaLabel != null ? ariaLabel : labels.common.selectAria,
|
|
28
|
+
className: cn(
|
|
29
|
+
"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",
|
|
30
|
+
getMotionClassName(
|
|
31
|
+
enableAnimations,
|
|
32
|
+
"transition-[border-color,box-shadow] duration-200 ease-out"
|
|
33
|
+
),
|
|
34
|
+
"focus:border-agg-primary focus:ring-2 focus:ring-agg-primary/15",
|
|
35
|
+
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
36
|
+
),
|
|
37
|
+
disabled: disabled || !hasEnabledItems,
|
|
38
|
+
value,
|
|
39
|
+
onChange: (event) => onChange(event.target.value),
|
|
40
|
+
children: items.map((item) => /* @__PURE__ */ jsx("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value))
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__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: "s", color: "currentColor" }) })
|
|
44
|
+
] });
|
|
45
|
+
};
|
|
46
|
+
Select.displayName = "Select";
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
Select
|
|
50
|
+
};
|