@agg-build/ui 2.7.3 → 2.8.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/dist/{chunk-MZBYIXYA.mjs → chunk-2QCNDFNC.mjs} +193 -103
- package/dist/{chunk-EDQ64EKO.mjs → chunk-AKLGQ6AB.mjs} +254 -53
- package/dist/{chunk-FMYYPNZZ.mjs → chunk-KO6VTRV6.mjs} +101 -27
- package/dist/{chunk-AHQA3B7D.mjs → chunk-KX3TQ7WC.mjs} +1 -1
- package/dist/{chunk-7DM45TMO.mjs → chunk-MKU5Q6PN.mjs} +21 -13
- package/dist/{chunk-O27JUYCF.mjs → chunk-R5S2QOYL.mjs} +495 -289
- package/dist/{chunk-JQKJDSTW.mjs → chunk-VR5ZRDQT.mjs} +3 -2
- package/dist/events.js +168 -91
- package/dist/events.mjs +3 -3
- package/dist/index.js +1315 -746
- package/dist/index.mjs +7 -7
- package/dist/modals.js +941 -418
- package/dist/modals.mjs +3 -3
- package/dist/pages.js +978 -609
- package/dist/pages.mjs +6 -6
- package/dist/primitives.js +94 -26
- package/dist/primitives.mjs +1 -1
- package/dist/styles.css +1 -1
- package/dist/tailwind.css +1 -1
- package/dist/trading.js +1403 -902
- package/dist/trading.mjs +4 -4
- package/dist/types/events/orderbook/orderbook.utils.d.mts +1 -1
- package/dist/types/events/orderbook/orderbook.utils.d.ts +1 -1
- package/dist/types/pages/user-profile/components/open-order-row.d.mts +1 -0
- package/dist/types/pages/user-profile/components/open-order-row.d.ts +1 -0
- package/dist/types/pages/user-profile/position-view-model.d.mts +15 -4
- package/dist/types/pages/user-profile/position-view-model.d.ts +15 -4
- package/dist/types/primitives/select/index.d.mts +1 -1
- package/dist/types/primitives/select/index.d.ts +1 -1
- package/dist/types/primitives/select/select.types.d.mts +8 -0
- package/dist/types/primitives/select/select.types.d.ts +8 -0
- package/dist/types/profile/profile-modal.constants.d.mts +2 -1
- package/dist/types/profile/profile-modal.constants.d.ts +2 -1
- package/dist/types/profile/tabs/balance-management-tab.d.mts +3 -0
- package/dist/types/profile/tabs/balance-management-tab.d.ts +3 -0
- package/dist/types/trading/place-order/index.place-order.constants.d.mts +2 -1
- package/dist/types/trading/place-order/index.place-order.constants.d.ts +2 -1
- package/dist/types/trading/place-order/index.place-order.types.d.mts +6 -0
- package/dist/types/trading/place-order/index.place-order.types.d.ts +6 -0
- package/dist/types/trading/place-order/index.place-order.utils.d.mts +10 -2
- package/dist/types/trading/place-order/index.place-order.utils.d.ts +10 -2
- package/package.json +3 -3
package/dist/pages.mjs
CHANGED
|
@@ -8,17 +8,17 @@ import {
|
|
|
8
8
|
UserProfilePage,
|
|
9
9
|
buildAggTxExplorerHref,
|
|
10
10
|
useHomePageModals
|
|
11
|
-
} from "./chunk-
|
|
12
|
-
import "./chunk-
|
|
11
|
+
} from "./chunk-2QCNDFNC.mjs";
|
|
12
|
+
import "./chunk-MKU5Q6PN.mjs";
|
|
13
13
|
import {
|
|
14
14
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
15
15
|
WITHDRAW_MODAL_OPEN_EVENT,
|
|
16
16
|
requestAggDepositModalOpen,
|
|
17
17
|
requestAggWithdrawModalOpen
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
18
|
+
} from "./chunk-R5S2QOYL.mjs";
|
|
19
|
+
import "./chunk-VR5ZRDQT.mjs";
|
|
20
|
+
import "./chunk-KX3TQ7WC.mjs";
|
|
21
|
+
import "./chunk-KO6VTRV6.mjs";
|
|
22
22
|
export {
|
|
23
23
|
DEPOSIT_MODAL_OPEN_EVENT,
|
|
24
24
|
EventMarketPage,
|
package/dist/primitives.js
CHANGED
|
@@ -8352,7 +8352,11 @@ var Select = ({
|
|
|
8352
8352
|
triggerClassName,
|
|
8353
8353
|
contentClassName,
|
|
8354
8354
|
itemClassName,
|
|
8355
|
-
disabled = SELECT_DEFAULT_IS_DISABLED
|
|
8355
|
+
disabled = SELECT_DEFAULT_IS_DISABLED,
|
|
8356
|
+
variant = "default",
|
|
8357
|
+
openOnHover = false,
|
|
8358
|
+
contentAlign = "start",
|
|
8359
|
+
contentSideOffset = 8
|
|
8356
8360
|
}) => {
|
|
8357
8361
|
var _a;
|
|
8358
8362
|
const labels = (0, import_hooks32.useLabels)();
|
|
@@ -8363,17 +8367,30 @@ var Select = ({
|
|
|
8363
8367
|
const isDisabled = resolveIsSelectDisabled({ disabled, items });
|
|
8364
8368
|
const selectedItem = resolveSelectedItem(items, value);
|
|
8365
8369
|
const [isOpen, setIsOpen] = (0, import_react11.useState)(false);
|
|
8366
|
-
const [menuRect, setMenuRect] = (0, import_react11.useState)(
|
|
8367
|
-
null
|
|
8368
|
-
);
|
|
8370
|
+
const [menuRect, setMenuRect] = (0, import_react11.useState)(null);
|
|
8369
8371
|
const containerRef = (0, import_react11.useRef)(null);
|
|
8370
8372
|
const portalRef = (0, import_react11.useRef)(null);
|
|
8371
|
-
const
|
|
8373
|
+
const closeTimerRef = (0, import_react11.useRef)(null);
|
|
8374
|
+
const openedByHoverRef = (0, import_react11.useRef)(false);
|
|
8375
|
+
const handleClose = (0, import_react11.useCallback)(() => {
|
|
8376
|
+
setIsOpen(false);
|
|
8377
|
+
openedByHoverRef.current = false;
|
|
8378
|
+
}, []);
|
|
8372
8379
|
const updateMenuRect = (0, import_react11.useCallback)(() => {
|
|
8373
8380
|
const el = containerRef.current;
|
|
8374
8381
|
if (!el) return;
|
|
8375
8382
|
const r = el.getBoundingClientRect();
|
|
8376
|
-
setMenuRect({
|
|
8383
|
+
setMenuRect({
|
|
8384
|
+
top: r.bottom + contentSideOffset,
|
|
8385
|
+
left: r.left,
|
|
8386
|
+
right: r.right,
|
|
8387
|
+
width: r.width
|
|
8388
|
+
});
|
|
8389
|
+
}, [contentSideOffset]);
|
|
8390
|
+
(0, import_react11.useEffect)(() => {
|
|
8391
|
+
return () => {
|
|
8392
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
8393
|
+
};
|
|
8377
8394
|
}, []);
|
|
8378
8395
|
(0, import_react11.useLayoutEffect)(() => {
|
|
8379
8396
|
if (!isOpen) {
|
|
@@ -8411,7 +8428,33 @@ var Select = ({
|
|
|
8411
8428
|
document.addEventListener("keydown", handleKeyDown);
|
|
8412
8429
|
return () => document.removeEventListener("keydown", handleKeyDown);
|
|
8413
8430
|
}, [isOpen, handleClose]);
|
|
8414
|
-
const
|
|
8431
|
+
const handlePointerEnter = (event) => {
|
|
8432
|
+
if (!openOnHover || isDisabled || event.pointerType === "touch") return;
|
|
8433
|
+
if (closeTimerRef.current) {
|
|
8434
|
+
clearTimeout(closeTimerRef.current);
|
|
8435
|
+
closeTimerRef.current = null;
|
|
8436
|
+
}
|
|
8437
|
+
if (isOpen) return;
|
|
8438
|
+
openedByHoverRef.current = true;
|
|
8439
|
+
setIsOpen(true);
|
|
8440
|
+
};
|
|
8441
|
+
const handlePointerLeave = (event) => {
|
|
8442
|
+
if (!openOnHover || event.pointerType === "touch") return;
|
|
8443
|
+
if (closeTimerRef.current) clearTimeout(closeTimerRef.current);
|
|
8444
|
+
closeTimerRef.current = setTimeout(() => {
|
|
8445
|
+
handleClose();
|
|
8446
|
+
closeTimerRef.current = null;
|
|
8447
|
+
}, 120);
|
|
8448
|
+
};
|
|
8449
|
+
const handleTriggerClick = () => {
|
|
8450
|
+
if (openedByHoverRef.current && isOpen) {
|
|
8451
|
+
openedByHoverRef.current = false;
|
|
8452
|
+
return;
|
|
8453
|
+
}
|
|
8454
|
+
setIsOpen((previousValue) => !previousValue);
|
|
8455
|
+
};
|
|
8456
|
+
const isInline = variant === "inline";
|
|
8457
|
+
const triggerRadiusClass = triggerClassName != null ? triggerClassName : isInline ? "rounded-agg-sm" : "rounded-agg-md";
|
|
8415
8458
|
const listbox = menuRect ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8416
8459
|
"div",
|
|
8417
8460
|
{
|
|
@@ -8422,16 +8465,20 @@ var Select = ({
|
|
|
8422
8465
|
style: {
|
|
8423
8466
|
position: "fixed",
|
|
8424
8467
|
top: menuRect.top,
|
|
8425
|
-
left: menuRect.left,
|
|
8468
|
+
left: contentAlign === "start" ? menuRect.left : void 0,
|
|
8469
|
+
right: contentAlign === "end" ? window.innerWidth - menuRect.right : void 0,
|
|
8426
8470
|
width: menuRect.width,
|
|
8427
8471
|
zIndex: SELECT_DROPDOWN_Z
|
|
8428
8472
|
},
|
|
8429
8473
|
className: cn(
|
|
8430
8474
|
AGG_ROOT_CLASS_NAME,
|
|
8431
8475
|
rootClassName,
|
|
8432
|
-
"agg-select-content pointer-events-auto max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto
|
|
8476
|
+
"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",
|
|
8477
|
+
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)]",
|
|
8433
8478
|
contentClassName
|
|
8434
8479
|
),
|
|
8480
|
+
onPointerEnter: handlePointerEnter,
|
|
8481
|
+
onPointerLeave: handlePointerLeave,
|
|
8435
8482
|
children: items.map((item) => {
|
|
8436
8483
|
const isSelected = item.value === value;
|
|
8437
8484
|
const isHidden = item.hidden === true;
|
|
@@ -8445,9 +8492,10 @@ var Select = ({
|
|
|
8445
8492
|
disabled: item.disabled,
|
|
8446
8493
|
className: cn(
|
|
8447
8494
|
"agg-select-item",
|
|
8448
|
-
"relative flex w-full items-center
|
|
8495
|
+
"relative flex w-full items-center text-left text-agg-sm leading-agg-5 outline-none",
|
|
8496
|
+
isInline ? "gap-2 px-4 py-2" : "gap-3 rounded-[6px] py-3 pl-3 pr-5",
|
|
8449
8497
|
"hover:bg-agg-secondary-hover focus-visible:bg-agg-secondary-hover",
|
|
8450
|
-
isSelected ? "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
8498
|
+
isSelected ? isInline ? "font-agg-bold text-agg-foreground" : "bg-agg-primary/10 font-agg-normal text-agg-primary" : "font-agg-normal text-agg-foreground",
|
|
8451
8499
|
item.disabled && "cursor-not-allowed opacity-60",
|
|
8452
8500
|
itemClassName
|
|
8453
8501
|
),
|
|
@@ -8459,6 +8507,13 @@ var Select = ({
|
|
|
8459
8507
|
handleClose();
|
|
8460
8508
|
},
|
|
8461
8509
|
children: [
|
|
8510
|
+
isInline && isSelected ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8511
|
+
"span",
|
|
8512
|
+
{
|
|
8513
|
+
className: "agg-select-item-indicator absolute bottom-2 left-0 top-2 w-1 bg-agg-primary",
|
|
8514
|
+
"aria-hidden": true
|
|
8515
|
+
}
|
|
8516
|
+
) : null,
|
|
8462
8517
|
item.icon ? /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8463
8518
|
"span",
|
|
8464
8519
|
{
|
|
@@ -8488,7 +8543,11 @@ var Select = ({
|
|
|
8488
8543
|
"div",
|
|
8489
8544
|
{
|
|
8490
8545
|
ref: containerRef,
|
|
8491
|
-
className: cn(
|
|
8546
|
+
className: cn(
|
|
8547
|
+
"group/agg-select relative inline-flex",
|
|
8548
|
+
isInline ? "w-auto" : "w-full",
|
|
8549
|
+
className
|
|
8550
|
+
),
|
|
8492
8551
|
children: [
|
|
8493
8552
|
/* @__PURE__ */ (0, import_jsx_runtime129.jsxs)(
|
|
8494
8553
|
"button",
|
|
@@ -8500,19 +8559,19 @@ var Select = ({
|
|
|
8500
8559
|
disabled: isDisabled,
|
|
8501
8560
|
className: cn(
|
|
8502
8561
|
"agg-select-trigger",
|
|
8503
|
-
"flex
|
|
8504
|
-
"
|
|
8562
|
+
"flex cursor-pointer items-center gap-2 font-agg-sans text-agg-foreground outline-none disabled:cursor-not-allowed disabled:opacity-60",
|
|
8563
|
+
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",
|
|
8505
8564
|
triggerRadiusClass,
|
|
8506
|
-
getMotionClassName(
|
|
8565
|
+
!isInline && getMotionClassName(
|
|
8507
8566
|
enableAnimations,
|
|
8508
8567
|
"transition-[border-color,box-shadow] duration-200 ease-in-out"
|
|
8509
8568
|
),
|
|
8510
|
-
isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
|
|
8511
|
-
"hover:border-agg-primary"
|
|
8512
|
-
"focus:border-agg-primary focus:ring-0",
|
|
8513
|
-
"disabled:cursor-not-allowed disabled:opacity-60"
|
|
8569
|
+
!isInline && isOpen && "border-2 border-agg-primary px-[11px] py-2 ring-0",
|
|
8570
|
+
!isInline && "hover:border-agg-primary focus:border-agg-primary focus:ring-0"
|
|
8514
8571
|
),
|
|
8515
|
-
onClick:
|
|
8572
|
+
onClick: handleTriggerClick,
|
|
8573
|
+
onPointerEnter: handlePointerEnter,
|
|
8574
|
+
onPointerLeave: handlePointerLeave,
|
|
8516
8575
|
children: [
|
|
8517
8576
|
(selectedItem == null ? void 0 : selectedItem.icon) ? /* @__PURE__ */ (0, import_jsx_runtime129.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_runtime129.jsx)(
|
|
8518
8577
|
RemoteImage,
|
|
@@ -8526,14 +8585,23 @@ var Select = ({
|
|
|
8526
8585
|
]
|
|
8527
8586
|
}
|
|
8528
8587
|
),
|
|
8529
|
-
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8530
|
-
|
|
8588
|
+
/* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8589
|
+
"span",
|
|
8531
8590
|
{
|
|
8532
|
-
|
|
8533
|
-
|
|
8534
|
-
|
|
8591
|
+
className: cn(
|
|
8592
|
+
"agg-select-chevron pointer-events-none absolute inset-y-0 inline-flex items-center justify-center",
|
|
8593
|
+
isInline ? "right-2 text-agg-foreground" : "right-3 text-agg-muted-foreground"
|
|
8594
|
+
),
|
|
8595
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime129.jsx)(
|
|
8596
|
+
Icon,
|
|
8597
|
+
{
|
|
8598
|
+
name: isOpen ? "chevron-up" : "chevron-down-thin",
|
|
8599
|
+
size: "small",
|
|
8600
|
+
color: "currentColor"
|
|
8601
|
+
}
|
|
8602
|
+
)
|
|
8535
8603
|
}
|
|
8536
|
-
)
|
|
8604
|
+
),
|
|
8537
8605
|
isOpen && typeof document !== "undefined" && listbox ? (0, import_react_dom.createPortal)(listbox, resolveSelectPortalContainer(containerRef.current)) : null
|
|
8538
8606
|
]
|
|
8539
8607
|
}
|