@agg-build/ui 2.7.3 → 3.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 (46) hide show
  1. package/dist/{chunk-EDQ64EKO.mjs → chunk-JTSLZARU.mjs} +6 -5
  2. package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
  3. package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
  4. package/dist/{chunk-7DM45TMO.mjs → chunk-MKU5Q6PN.mjs} +21 -13
  5. package/dist/{chunk-MZBYIXYA.mjs → chunk-R362GNI2.mjs} +1310 -500
  6. package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
  7. package/dist/{chunk-O27JUYCF.mjs → chunk-XIDQ2A6W.mjs} +645 -346
  8. package/dist/events.js +168 -91
  9. package/dist/events.mjs +3 -3
  10. package/dist/index.js +2784 -1606
  11. package/dist/index.mjs +9 -7
  12. package/dist/modals.js +98 -29
  13. package/dist/modals.mjs +3 -3
  14. package/dist/pages.js +2510 -1333
  15. package/dist/pages.mjs +8 -6
  16. package/dist/primitives.js +94 -26
  17. package/dist/primitives.mjs +1 -1
  18. package/dist/styles.css +1 -1
  19. package/dist/tailwind.css +1 -1
  20. package/dist/trading.js +1739 -1143
  21. package/dist/trading.mjs +4 -4
  22. package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
  23. package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
  24. package/dist/types/pages/user-profile/components/available-balance-card.d.mts +5 -1
  25. package/dist/types/pages/user-profile/components/available-balance-card.d.ts +5 -1
  26. package/dist/types/pages/user-profile/components/manage-balances-modal.d.mts +8 -0
  27. package/dist/types/pages/user-profile/components/manage-balances-modal.d.ts +8 -0
  28. package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
  29. package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
  30. package/dist/types/pages/user-profile/index.d.mts +1 -0
  31. package/dist/types/pages/user-profile/index.d.ts +1 -0
  32. package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
  33. package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
  34. package/dist/types/primitives/select/index.d.mts +1 -1
  35. package/dist/types/primitives/select/index.d.ts +1 -1
  36. package/dist/types/primitives/select/select.types.d.mts +8 -0
  37. package/dist/types/primitives/select/select.types.d.ts +8 -0
  38. package/dist/types/profile/profile-modal.constants.d.mts +1 -1
  39. package/dist/types/profile/profile-modal.constants.d.ts +1 -1
  40. package/dist/types/trading/place-order/index.place-order.constants.d.mts +3 -1
  41. package/dist/types/trading/place-order/index.place-order.constants.d.ts +3 -1
  42. package/dist/types/trading/place-order/index.place-order.types.d.mts +10 -0
  43. package/dist/types/trading/place-order/index.place-order.types.d.ts +10 -0
  44. package/dist/types/trading/place-order/index.place-order.utils.d.mts +17 -5
  45. package/dist/types/trading/place-order/index.place-order.utils.d.ts +17 -5
  46. package/package.json +3 -3
package/dist/index.mjs CHANGED
@@ -5,13 +5,14 @@ import {
5
5
  DefaultAvatar,
6
6
  EventMarketPage,
7
7
  HomePage,
8
+ ManageBalancesModal,
8
9
  USER_PROFILE_TAB_ACTIVITY,
9
10
  USER_PROFILE_TAB_OPEN_ORDERS,
10
11
  USER_PROFILE_TAB_POSITIONS,
11
12
  UserProfilePage,
12
13
  buildAggTxExplorerHref,
13
14
  useHomePageModals
14
- } from "./chunk-MZBYIXYA.mjs";
15
+ } from "./chunk-R362GNI2.mjs";
15
16
  import {
16
17
  EventList,
17
18
  EventListItem,
@@ -28,7 +29,7 @@ import {
28
29
  orderbookRowLimitDefault,
29
30
  resolveEventDetailsSyncKey,
30
31
  useCenterOrderbookSpread
31
- } from "./chunk-7DM45TMO.mjs";
32
+ } from "./chunk-MKU5Q6PN.mjs";
32
33
  import {
33
34
  CARD_NETWORK_OPTIONS,
34
35
  DepositModal,
@@ -38,7 +39,7 @@ import {
38
39
  buildTerminalSummary,
39
40
  clearPendingCardSession,
40
41
  getPendingCardSession
41
- } from "./chunk-EDQ64EKO.mjs";
42
+ } from "./chunk-JTSLZARU.mjs";
42
43
  import {
43
44
  AggNotificationEventsProvider,
44
45
  DEPOSIT_MODAL_OPEN_EVENT,
@@ -54,7 +55,7 @@ import {
54
55
  requestAggWithdrawModalOpen,
55
56
  useClaimWinnings,
56
57
  useResolvedMarketClaim
57
- } from "./chunk-O27JUYCF.mjs";
58
+ } from "./chunk-XIDQ2A6W.mjs";
58
59
  import {
59
60
  SETTLEMENT_SECTION_ID,
60
61
  Settlement,
@@ -75,7 +76,7 @@ import {
75
76
  resolveOrderBookRows,
76
77
  resolveUnifiedOrderBookEntries,
77
78
  useEventTradingContext
78
- } from "./chunk-JQKJDSTW.mjs";
79
+ } from "./chunk-VR5ZRDQT.mjs";
79
80
  import {
80
81
  ConnectAccountsStep,
81
82
  ConnectKalshiModal,
@@ -84,7 +85,7 @@ import {
84
85
  HowItWorksStep,
85
86
  OnboardingModal,
86
87
  ProfileSetupStep
87
- } from "./chunk-AHQA3B7D.mjs";
88
+ } from "./chunk-KX3TQ7WC.mjs";
88
89
  import {
89
90
  AGG_DEFAULT_URL,
90
91
  AGG_DOCS_URL,
@@ -206,7 +207,7 @@ import {
206
207
  useOptionalToast,
207
208
  useToast,
208
209
  venueLogoNames
209
- } from "./chunk-FMYYPNZZ.mjs";
210
+ } from "./chunk-KO6VTRV6.mjs";
210
211
 
211
212
  // src/notifications/agg-toast-provider.tsx
212
213
  import { jsx } from "react/jsx-runtime";
@@ -1049,6 +1050,7 @@ export {
1049
1050
  LinkAccountsIcon,
1050
1051
  LoadingIcon,
1051
1052
  LockIcon,
1053
+ ManageBalancesModal,
1052
1054
  MarketDetails,
1053
1055
  MarketDetailsList,
1054
1056
  Modal,
package/dist/modals.js CHANGED
@@ -4362,7 +4362,11 @@ var Select = ({
4362
4362
  triggerClassName,
4363
4363
  contentClassName,
4364
4364
  itemClassName,
4365
- disabled = SELECT_DEFAULT_IS_DISABLED
4365
+ disabled = SELECT_DEFAULT_IS_DISABLED,
4366
+ variant = "default",
4367
+ openOnHover = false,
4368
+ contentAlign = "start",
4369
+ contentSideOffset = 8
4366
4370
  }) => {
4367
4371
  var _a;
4368
4372
  const labels = (0, import_hooks13.useLabels)();
@@ -4373,17 +4377,30 @@ var Select = ({
4373
4377
  const isDisabled = resolveIsSelectDisabled({ disabled, items });
4374
4378
  const selectedItem = resolveSelectedItem(items, value);
4375
4379
  const [isOpen, setIsOpen] = (0, import_react2.useState)(false);
4376
- const [menuRect, setMenuRect] = (0, import_react2.useState)(
4377
- null
4378
- );
4380
+ const [menuRect, setMenuRect] = (0, import_react2.useState)(null);
4379
4381
  const containerRef = (0, import_react2.useRef)(null);
4380
4382
  const portalRef = (0, import_react2.useRef)(null);
4381
- const handleClose = (0, import_react2.useCallback)(() => setIsOpen(false), []);
4383
+ const closeTimerRef = (0, import_react2.useRef)(null);
4384
+ const openedByHoverRef = (0, import_react2.useRef)(false);
4385
+ const handleClose = (0, import_react2.useCallback)(() => {
4386
+ setIsOpen(false);
4387
+ openedByHoverRef.current = false;
4388
+ }, []);
4382
4389
  const updateMenuRect = (0, import_react2.useCallback)(() => {
4383
4390
  const el = containerRef.current;
4384
4391
  if (!el) return;
4385
4392
  const r = el.getBoundingClientRect();
4386
- setMenuRect({ top: r.bottom + 8, left: r.left, width: r.width });
4393
+ setMenuRect({
4394
+ top: r.bottom + contentSideOffset,
4395
+ left: r.left,
4396
+ right: r.right,
4397
+ width: r.width
4398
+ });
4399
+ }, [contentSideOffset]);
4400
+ (0, import_react2.useEffect)(() => {
4401
+ return () => {
4402
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
4403
+ };
4387
4404
  }, []);
4388
4405
  (0, import_react2.useLayoutEffect)(() => {
4389
4406
  if (!isOpen) {
@@ -4421,7 +4438,33 @@ var Select = ({
4421
4438
  document.addEventListener("keydown", handleKeyDown);
4422
4439
  return () => document.removeEventListener("keydown", handleKeyDown);
4423
4440
  }, [isOpen, handleClose]);
4424
- const triggerRadiusClass = triggerClassName != null ? triggerClassName : "rounded-agg-md";
4441
+ const handlePointerEnter = (event) => {
4442
+ if (!openOnHover || isDisabled || event.pointerType === "touch") return;
4443
+ if (closeTimerRef.current) {
4444
+ clearTimeout(closeTimerRef.current);
4445
+ closeTimerRef.current = null;
4446
+ }
4447
+ if (isOpen) return;
4448
+ openedByHoverRef.current = true;
4449
+ setIsOpen(true);
4450
+ };
4451
+ const handlePointerLeave = (event) => {
4452
+ if (!openOnHover || event.pointerType === "touch") return;
4453
+ if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
4454
+ closeTimerRef.current = setTimeout(() => {
4455
+ handleClose();
4456
+ closeTimerRef.current = null;
4457
+ }, 120);
4458
+ };
4459
+ const handleTriggerClick = () => {
4460
+ if (openedByHoverRef.current && isOpen) {
4461
+ openedByHoverRef.current = false;
4462
+ return;
4463
+ }
4464
+ setIsOpen((previousValue) => !previousValue);
4465
+ };
4466
+ const isInline = variant === "inline";
4467
+ const triggerRadiusClass = triggerClassName != null ? triggerClassName : isInline ? "rounded-agg-sm" : "rounded-agg-md";
4425
4468
  const listbox = menuRect ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
4426
4469
  "div",
4427
4470
  {
@@ -4432,16 +4475,20 @@ var Select = ({
4432
4475
  style: {
4433
4476
  position: "fixed",
4434
4477
  top: menuRect.top,
4435
- left: menuRect.left,
4478
+ left: contentAlign === "start" ? menuRect.left : void 0,
4479
+ right: contentAlign === "end" ? window.innerWidth - menuRect.right : void 0,
4436
4480
  width: menuRect.width,
4437
4481
  zIndex: SELECT_DROPDOWN_Z
4438
4482
  },
4439
4483
  className: cn(
4440
4484
  AGG_ROOT_CLASS_NAME,
4441
4485
  rootClassName,
4442
- "agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto rounded-[12px] border border-agg-separator bg-agg-secondary p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)] flex flex-col gap-1",
4486
+ "agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto border border-agg-separator bg-agg-secondary flex flex-col",
4487
+ isInline ? "min-w-[120px] gap-0 rounded-agg-lg py-1 shadow-[0_8px_16px_rgba(0,0,0,0.12)]" : "gap-1 rounded-[12px] p-2 shadow-[0_8px_16px_rgba(0,0,0,0.1)]",
4443
4488
  contentClassName
4444
4489
  ),
4490
+ onPointerEnter: handlePointerEnter,
4491
+ onPointerLeave: handlePointerLeave,
4445
4492
  children: items.map((item) => {
4446
4493
  const isSelected = item.value === value;
4447
4494
  const isHidden = item.hidden === true;
@@ -4455,9 +4502,10 @@ var Select = ({
4455
4502
  disabled: item.disabled,
4456
4503
  className: cn(
4457
4504
  "agg-select-item",
4458
- "relative flex w-full items-center gap-3 rounded-[6px] pl-3 pr-5 py-3 text-left text-agg-sm leading-agg-5 outline-none",
4505
+ "relative flex w-full items-center text-left text-agg-sm leading-agg-5 outline-none",
4506
+ isInline ? "gap-2 px-4 py-2" : "gap-3 rounded-[6px] py-3 pl-3 pr-5",
4459
4507
  "hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
4460
- isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
4508
+ isSelected ? isInline ? "font-agg-bold text-agg-foreground" : "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
4461
4509
  item.disabled && "cursor-not-allowed opacity-60",
4462
4510
  itemClassName
4463
4511
  ),
@@ -4469,6 +4517,13 @@ var Select = ({
4469
4517
  handleClose();
4470
4518
  },
4471
4519
  children: [
4520
+ isInline && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
4521
+ "span",
4522
+ {
4523
+ className: "agg-select-item-indicator absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
4524
+ "aria-hidden": true
4525
+ }
4526
+ ) : null,
4472
4527
  item.icon ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
4473
4528
  "span",
4474
4529
  {
@@ -4498,7 +4553,11 @@ var Select = ({
4498
4553
  "div",
4499
4554
  {
4500
4555
  ref: containerRef,
4501
- className: cn("group/agg-select", "relative inline-flex w-full", className),
4556
+ className: cn(
4557
+ "group/agg-select relative inline-flex",
4558
+ isInline ? "w-auto" : "w-full",
4559
+ className
4560
+ ),
4502
4561
  children: [
4503
4562
  /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)(
4504
4563
  "button",
@@ -4510,19 +4569,19 @@ var Select = ({
4510
4569
  disabled: isDisabled,
4511
4570
  className: cn(
4512
4571
  "agg-select-trigger",
4513
- "flex h-10 w-full items-center gap-2 rounded-[8px] border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 font-agg-sans text-agg-sm leading-agg-5 text-agg-foreground outline-none",
4514
- "flex items-center gap-2 text-left",
4572
+ "flex cursor-pointer items-center gap-2 font-agg-sans text-agg-foreground outline-none disabled:cursor-not-allowed disabled:opacity-60",
4573
+ isInline ? "h-auto w-auto bg-transparent px-2 py-1 pr-8 text-left text-agg-base leading-agg-6" : "h-10 w-full border border-agg-separator bg-agg-secondary px-3 py-[9px] pr-10 text-left text-agg-sm leading-agg-5",
4515
4574
  triggerRadiusClass,
4516
- getMotionClassName(
4575
+ !isInline && getMotionClassName(
4517
4576
  enableAnimations,
4518
4577
  "transition-[border-color,box-shadow] duration-200 ease-in-out"
4519
4578
  ),
4520
- isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
4521
- "hover:border-agg-primary",
4522
- "focus:border-agg-primary focus:ring-0",
4523
- "disabled:cursor-not-allowed disabled:opacity-60"
4579
+ !isInline && isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
4580
+ !isInline && "hover:border-agg-primary focus:border-agg-primary focus:ring-0"
4524
4581
  ),
4525
- onClick: () => setIsOpen((previousValue) => !previousValue),
4582
+ onClick: handleTriggerClick,
4583
+ onPointerEnter: handlePointerEnter,
4584
+ onPointerLeave: handlePointerLeave,
4526
4585
  children: [
4527
4586
  (selectedItem == null ? void 0 : selectedItem.icon) ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "h-4 w-4 shrink-0 [&_svg]:h-full [&_svg]:w-full", children: selectedItem.icon }) : (selectedItem == null ? void 0 : selectedItem.iconUrl) ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
4528
4587
  RemoteImage,
@@ -4536,14 +4595,23 @@ var Select = ({
4536
4595
  ]
4537
4596
  }
4538
4597
  ),
4539
- /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("span", { className: "agg-select-chevron pointer-events-none absolute inset-y-0 right-3 inline-flex items-center justify-center text-agg-muted-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
4540
- Icon,
4598
+ /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
4599
+ "span",
4541
4600
  {
4542
- name: isOpen ? "chevron-up" : "chevron-down-thin",
4543
- size: "small",
4544
- color: "currentColor"
4601
+ className: cn(
4602
+ "agg-select-chevron pointer-events-none absolute inset-y-0 inline-flex items-center justify-center",
4603
+ isInline ? "right-2 text-agg-foreground" : "right-3 text-agg-muted-foreground"
4604
+ ),
4605
+ children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
4606
+ Icon,
4607
+ {
4608
+ name: isOpen ? "chevron-up" : "chevron-down-thin",
4609
+ size: "small",
4610
+ color: "currentColor"
4611
+ }
4612
+ )
4545
4613
  }
4546
- ) }),
4614
+ ),
4547
4615
  isOpen && typeof document !== "undefined" && listbox ? (0, import_react_dom.createPortal)(listbox, resolveSelectPortalContainer(containerRef.current)) : null
4548
4616
  ]
4549
4617
  }
@@ -8642,7 +8710,7 @@ var PROFILE_TAB_KEYS = {
8642
8710
  PROFILE_ACCOUNTS: "profile-accounts",
8643
8711
  TRADING_ACCESS: "trading-access"
8644
8712
  };
8645
- var PROFILE_TAB_ITEMS = [
8713
+ var getProfileTabItems = () => [
8646
8714
  {
8647
8715
  value: PROFILE_TAB_KEYS.PROFILE_ACCOUNTS,
8648
8716
  label: "Profile & accounts",
@@ -9083,6 +9151,7 @@ var ProfileModal = ({
9083
9151
  const { user } = (0, import_hooks40.useAggAuthState)();
9084
9152
  const toastCtx = useOptionalToast();
9085
9153
  const [activeTab, setActiveTab] = (0, import_react19.useState)(PROFILE_TAB_KEYS.PROFILE_ACCOUNTS);
9154
+ const profileTabItems = (0, import_react19.useMemo)(() => getProfileTabItems(), []);
9086
9155
  const resolvedInitialUsername = (_a = username != null ? username : user == null ? void 0 : user.username) != null ? _a : "";
9087
9156
  const [draftUsername, setDraftUsername] = (0, import_react19.useState)(resolvedInitialUsername);
9088
9157
  const [draftAvatarFile, setDraftAvatarFile] = (0, import_react19.useState)();
@@ -9469,7 +9538,7 @@ var ProfileModal = ({
9469
9538
  className: "w-full [&>div]:w-full",
9470
9539
  variant: "underline",
9471
9540
  classNames: { tabList: "w-full" },
9472
- items: PROFILE_TAB_ITEMS.map((tab) => ({
9541
+ items: profileTabItems.map((tab) => ({
9473
9542
  value: tab.value,
9474
9543
  label: tab.label,
9475
9544
  icon: /* @__PURE__ */ (0, import_jsx_runtime133.jsx)(Icon, { name: tab.icon, size: "small" })
@@ -9493,7 +9562,7 @@ var ProfileModal = ({
9493
9562
  ),
9494
9563
  role: "tablist",
9495
9564
  "aria-label": "Profile sections",
9496
- children: PROFILE_TAB_ITEMS.map((tab) => {
9565
+ children: profileTabItems.map((tab) => {
9497
9566
  const isActive = activeTab === tab.value;
9498
9567
  return /* @__PURE__ */ (0, import_jsx_runtime133.jsxs)(
9499
9568
  "button",
package/dist/modals.mjs CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  buildTerminalSummary,
9
9
  clearPendingCardSession,
10
10
  getPendingCardSession
11
- } from "./chunk-EDQ64EKO.mjs";
11
+ } from "./chunk-JTSLZARU.mjs";
12
12
  import {
13
13
  ConnectAccountsStep,
14
14
  ConnectKalshiModal,
@@ -17,8 +17,8 @@ import {
17
17
  HowItWorksStep,
18
18
  OnboardingModal,
19
19
  ProfileSetupStep
20
- } from "./chunk-AHQA3B7D.mjs";
21
- import "./chunk-FMYYPNZZ.mjs";
20
+ } from "./chunk-KX3TQ7WC.mjs";
21
+ import "./chunk-KO6VTRV6.mjs";
22
22
  export {
23
23
  CARD_NETWORK_OPTIONS,
24
24
  ConnectAccountsStep,