@loafmarkets/ui 0.1.429 → 0.1.431

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/index.mjs CHANGED
@@ -3563,7 +3563,8 @@ function NewsArticleModal({
3563
3563
  },
3564
3564
  children: item.type === "property" ? catStyle.label : "Market News"
3565
3565
  }
3566
- )
3566
+ ),
3567
+ /* @__PURE__ */ jsx(NewsMetaNotes, { item, fontSize: "0.65rem" })
3567
3568
  ] }),
3568
3569
  /* @__PURE__ */ jsx("div", { style: { height: "1px", background: "rgba(255,255,255,0.08)", marginBottom: "1.25rem" } }),
3569
3570
  item.summary ? /* @__PURE__ */ jsx("p", { style: { fontSize: "0.875rem", color: "rgba(255,255,255,0.8)", lineHeight: 1.75, margin: 0 }, children: item.summary }) : /* @__PURE__ */ jsx("p", { style: { fontSize: "0.8rem", color: "rgba(255,255,255,0.35)", fontStyle: "italic", margin: 0 }, children: "Summary not available for this article." }),
@@ -16691,12 +16692,22 @@ var TickerTag = styled10.span`
16691
16692
  margin-left: 0.3rem;
16692
16693
  `;
16693
16694
  var sideLabel = (side) => side?.toUpperCase() === "SELL" ? "Sell" : "Buy";
16695
+ var isLiveOrder = (o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED" || o.status === "PENDING" || o.status === "ARMED";
16696
+ var isMarketType = (type) => type === "MARKET" || type.endsWith("_MARKET");
16697
+ var filledLabel = (order) => order.filledQuantity == null ? "\u2014" : `${order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0}%`;
16698
+ var TriggerText = styled10.span`
16699
+ display: block;
16700
+ font-size: 0.68rem;
16701
+ color: rgba(255, 255, 255, 0.5);
16702
+ font-variant-numeric: tabular-nums;
16703
+ margin-top: 0.1rem;
16704
+ `;
16694
16705
  var getOrderStatusMeta = (statusRaw) => {
16695
16706
  const status = statusRaw.toUpperCase();
16696
- if (status === "FILLED" || status === "CONFIRMED" || status === "ALLOCATED") {
16707
+ if (status === "FILLED" || status === "CONFIRMED" || status === "ALLOCATED" || status === "PLACED") {
16697
16708
  return { color: "#0ecb81", bg: "rgba(14,203,129,0.1)" };
16698
16709
  }
16699
- if (status === "CANCELLED" || status === "CANCELED" || status === "REJECTED") {
16710
+ if (status === "CANCELLED" || status === "CANCELED" || status === "REJECTED" || status === "FAILED") {
16700
16711
  return { color: "#f6465d", bg: "rgba(246,70,93,0.12)" };
16701
16712
  }
16702
16713
  return { color: "#E6C87E", bg: "rgba(240,185,11,0.15)" };
@@ -16911,14 +16922,12 @@ function PortfolioActivityPanel({
16911
16922
  [transfers]
16912
16923
  );
16913
16924
  const positionsCount = positions.length;
16914
- const openOrdersCount = useMemo(
16915
- () => openOrders.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
16925
+ const openOrdersCount = useMemo(() => openOrders.filter(isLiveOrder).length, [openOrders]);
16926
+ const cancellableOrdersCount = useMemo(
16927
+ () => openOrders.filter((o) => !o.isOfferingOrder && isLiveOrder(o)).length,
16916
16928
  [openOrders]
16917
16929
  );
16918
- const pendingHistoryCount = useMemo(
16919
- () => mergedOrderHistory.filter((o) => o.status === "OPEN" || o.status === "PARTIALLY_FILLED").length,
16920
- [mergedOrderHistory]
16921
- );
16930
+ const pendingHistoryCount = useMemo(() => mergedOrderHistory.filter(isLiveOrder).length, [mergedOrderHistory]);
16922
16931
  const pendingOfferingsCount = useMemo(
16923
16932
  () => offeringOrders.filter((o) => {
16924
16933
  const s = o.status.toUpperCase();
@@ -17243,7 +17252,7 @@ function PortfolioActivityPanel({
17243
17252
  /* @__PURE__ */ jsx(CDValue, { children: formatTimestamp(order.createdAt) })
17244
17253
  ] })
17245
17254
  ] }),
17246
- order.status === "REJECTED" && order.rejectionReason && /* @__PURE__ */ jsx(CDValue, { style: { marginTop: "0.4rem", color: "#f6465d", fontSize: "0.7rem" }, children: order.rejectionReason })
17255
+ order.rejectionReason && /* @__PURE__ */ jsx(CDValue, { style: { marginTop: "0.4rem", color: "#f6465d", fontSize: "0.7rem" }, children: order.rejectionReason })
17247
17256
  ] })
17248
17257
  ] }, rowKey);
17249
17258
  }),
@@ -17269,7 +17278,7 @@ function PortfolioActivityPanel({
17269
17278
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { children: formatCurrency4(order.price * order.quantity) }) }),
17270
17279
  /* @__PURE__ */ jsxs(GridCell, { children: [
17271
17280
  /* @__PURE__ */ jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, title: order.status === "REJECTED" && order.rejectionReason ? order.rejectionReason : void 0, children: prettyLabel(order.status) }),
17272
- order.status === "REJECTED" && order.rejectionReason && /* @__PURE__ */ jsx(CellText, { $muted: true, style: { fontSize: "0.62rem", marginTop: "0.2rem", maxWidth: "120px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, title: order.rejectionReason, children: order.rejectionReason })
17281
+ order.rejectionReason && /* @__PURE__ */ jsx(CellText, { $muted: true, style: { fontSize: "0.62rem", marginTop: "0.2rem", maxWidth: "120px", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, title: order.rejectionReason, children: order.rejectionReason })
17273
17282
  ] }),
17274
17283
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $muted: true, children: formatTimestamp(order.createdAt) }) }),
17275
17284
  /* @__PURE__ */ jsx(GridCell, { children: order.txHash && /* @__PURE__ */ jsx(TxLink, { href: `${_blockExplorerBaseUrl}/${order.txHash}`, target: "_blank", rel: "noopener noreferrer", title: "View on Arbiscan", children: /* @__PURE__ */ jsxs("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
@@ -17284,10 +17293,10 @@ function PortfolioActivityPanel({
17284
17293
  activeTab === "open-orders" && /* @__PURE__ */ jsxs(Fragment, { children: [
17285
17294
  openOrders.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
17286
17295
  openOrders.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
17287
- compactPositions && onCancelAllOrders && openOrdersCount > 0 && /* @__PURE__ */ jsx(CancelAllRow, { children: /* @__PURE__ */ jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
17296
+ compactPositions && onCancelAllOrders && cancellableOrdersCount > 0 && /* @__PURE__ */ jsx(CancelAllRow, { children: /* @__PURE__ */ jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
17288
17297
  compactPositions ? sortedOpenOrders.map((order) => {
17289
17298
  const meta = getOrderStatusMeta(order.status);
17290
- const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
17299
+ const filledPercent = filledLabel(order);
17291
17300
  const isCancelling = cancellingOrderId === order.id;
17292
17301
  const ordExpanded = expandedOpenOrders.has(order.id);
17293
17302
  const sideColor = sideLabel(order.side) === "Buy" ? "#0ecb81" : "#f6465d";
@@ -17302,8 +17311,7 @@ function PortfolioActivityPanel({
17302
17311
  ] }),
17303
17312
  /* @__PURE__ */ jsxs(CUnitsCell, { children: [
17304
17313
  /* @__PURE__ */ jsx(CCellLabel, { children: "Filled" }),
17305
- filledPercent,
17306
- "%"
17314
+ filledPercent
17307
17315
  ] }),
17308
17316
  /* @__PURE__ */ jsxs(CUnitsCell, { children: [
17309
17317
  /* @__PURE__ */ jsx(CCellLabel, { children: "Qty" }),
@@ -17326,7 +17334,13 @@ function PortfolioActivityPanel({
17326
17334
  ] }),
17327
17335
  /* @__PURE__ */ jsxs(CDetailItem, { children: [
17328
17336
  /* @__PURE__ */ jsx(CDLabel, { children: "Price" }),
17329
- /* @__PURE__ */ jsx(CDValue, { children: order.type === "MARKET" || !order.price ? "Market" : formatCurrency4(order.price) })
17337
+ /* @__PURE__ */ jsxs(CDValue, { children: [
17338
+ isMarketType(order.type) || !order.price ? "Market" : formatCurrency4(order.price),
17339
+ order.triggerPrice != null && /* @__PURE__ */ jsxs(TriggerText, { children: [
17340
+ "Trigger ",
17341
+ formatCurrency4(order.triggerPrice)
17342
+ ] })
17343
+ ] })
17330
17344
  ] }),
17331
17345
  /* @__PURE__ */ jsxs(CDetailItem, { children: [
17332
17346
  /* @__PURE__ */ jsx(CDLabel, { children: "Status" }),
@@ -17357,12 +17371,12 @@ function PortfolioActivityPanel({
17357
17371
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Price" }),
17358
17372
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Filled" }),
17359
17373
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Status" }),
17360
- onCancelOrder && /* @__PURE__ */ jsx(GridHeaderCell, { children: onCancelAllOrders && openOrdersCount > 0 && /* @__PURE__ */ jsx(CancelButton, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) })
17374
+ onCancelOrder && /* @__PURE__ */ jsx(GridHeaderCell, { children: onCancelAllOrders && cancellableOrdersCount > 0 && /* @__PURE__ */ jsx(CancelButton, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) })
17361
17375
  ] }),
17362
17376
  pagedOpenOrders.map((order) => {
17363
17377
  const meta = getOrderStatusMeta(order.status);
17364
- const isMarket = order.type === "MARKET";
17365
- const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
17378
+ const isMarket = isMarketType(order.type);
17379
+ const filledPercent = filledLabel(order);
17366
17380
  const isCancelling = cancellingOrderId === order.id;
17367
17381
  const sideColor = sideLabel(order.side) === "Buy" ? "#0ecb81" : "#f6465d";
17368
17382
  return /* @__PURE__ */ jsxs(GridRow, { $columns: onCancelOrder ? "0.5fr 1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 82px" : "0.5fr 1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr", children: [
@@ -17374,12 +17388,18 @@ function PortfolioActivityPanel({
17374
17388
  formatNumber2(order.quantity),
17375
17389
  order.ticker && /* @__PURE__ */ jsx(TickerTag, { children: order.ticker.toUpperCase() })
17376
17390
  ] }) }),
17377
- /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
17378
- /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsxs(CellText, { $muted: true, children: [
17379
- filledPercent,
17380
- "%"
17381
- ] }) }),
17382
- /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
17391
+ /* @__PURE__ */ jsxs(GridCell, { children: [
17392
+ /* @__PURE__ */ jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }),
17393
+ order.triggerPrice != null && /* @__PURE__ */ jsxs(TriggerText, { children: [
17394
+ "Trigger ",
17395
+ formatCurrency4(order.triggerPrice)
17396
+ ] })
17397
+ ] }),
17398
+ /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $muted: true, children: filledPercent }) }),
17399
+ /* @__PURE__ */ jsxs(GridCell, { children: [
17400
+ /* @__PURE__ */ jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }),
17401
+ order.triggerPrice != null && order.rejectionReason && /* @__PURE__ */ jsx(TriggerText, { title: order.rejectionReason, children: order.rejectionReason })
17402
+ ] }),
17383
17403
  onCancelOrder && /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(
17384
17404
  CancelButton,
17385
17405
  {
@@ -17401,7 +17421,7 @@ function PortfolioActivityPanel({
17401
17421
  mergedOrderHistory.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "No orders yet. Place a trade to see it appear here." }),
17402
17422
  mergedOrderHistory.length > 0 && compactPositions && pagedOrderHistory.map((order) => {
17403
17423
  const meta = getOrderStatusMeta(order.status);
17404
- const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
17424
+ const filledPercent = filledLabel(order);
17405
17425
  const typeLabel = order.isOfferingOrder ? "Initial Offering" : prettyLabel(order.type);
17406
17426
  const sideColor = sideLabel(order.side) === "Buy" ? "#0ecb81" : "#f6465d";
17407
17427
  const rowKey = `oh-${order.id}`;
@@ -17440,21 +17460,24 @@ function PortfolioActivityPanel({
17440
17460
  ] }),
17441
17461
  /* @__PURE__ */ jsxs(CDetailItem, { children: [
17442
17462
  /* @__PURE__ */ jsx(CDLabel, { children: "Price" }),
17443
- /* @__PURE__ */ jsx(CDValue, { children: order.type === "MARKET" || !order.price ? "Market" : formatCurrency4(order.price) })
17463
+ /* @__PURE__ */ jsxs(CDValue, { children: [
17464
+ isMarketType(order.type) || !order.price ? "Market" : formatCurrency4(order.price),
17465
+ order.triggerPrice != null && /* @__PURE__ */ jsxs(TriggerText, { children: [
17466
+ "Trigger ",
17467
+ formatCurrency4(order.triggerPrice)
17468
+ ] })
17469
+ ] })
17444
17470
  ] }),
17445
17471
  /* @__PURE__ */ jsxs(CDetailItem, { children: [
17446
17472
  /* @__PURE__ */ jsx(CDLabel, { children: "Filled" }),
17447
- /* @__PURE__ */ jsxs(CDValue, { children: [
17448
- filledPercent,
17449
- "%"
17450
- ] })
17473
+ /* @__PURE__ */ jsx(CDValue, { children: filledPercent })
17451
17474
  ] }),
17452
17475
  /* @__PURE__ */ jsxs(CDetailItem, { children: [
17453
17476
  /* @__PURE__ */ jsx(CDLabel, { children: "Date" }),
17454
17477
  /* @__PURE__ */ jsx(CDValue, { children: formatTimestamp(order.createdAt) })
17455
17478
  ] })
17456
17479
  ] }),
17457
- order.status === "REJECTED" && order.rejectionReason && /* @__PURE__ */ jsx(CDValue, { style: { marginTop: "0.4rem", color: "#f6465d", fontSize: "0.7rem" }, children: order.rejectionReason })
17480
+ order.rejectionReason && /* @__PURE__ */ jsx(CDValue, { style: { marginTop: "0.4rem", color: "#f6465d", fontSize: "0.7rem" }, children: order.rejectionReason })
17458
17481
  ] })
17459
17482
  ] }, rowKey);
17460
17483
  }),
@@ -17472,8 +17495,8 @@ function PortfolioActivityPanel({
17472
17495
  ] }),
17473
17496
  pagedOrderHistory.map((order) => {
17474
17497
  const meta = getOrderStatusMeta(order.status);
17475
- const isMarket = order.type === "MARKET";
17476
- const filledPercent = order.quantity > 0 ? Math.round(order.filledQuantity / order.quantity * 100) : 0;
17498
+ const isMarket = isMarketType(order.type);
17499
+ const filledPercent = filledLabel(order);
17477
17500
  const typeLabel = order.isOfferingOrder ? "Initial Offering" : prettyLabel(order.type);
17478
17501
  const sideColor = sideLabel(order.side) === "Buy" ? "#0ecb81" : "#f6465d";
17479
17502
  return /* @__PURE__ */ jsxs(GridRow, { $columns: "0.5fr 1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 1fr", children: [
@@ -17485,12 +17508,18 @@ function PortfolioActivityPanel({
17485
17508
  formatNumber2(order.quantity),
17486
17509
  order.ticker && /* @__PURE__ */ jsx(TickerTag, { children: order.ticker.toUpperCase() })
17487
17510
  ] }) }),
17488
- /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }) }),
17489
- /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsxs(CellText, { $muted: true, children: [
17490
- filledPercent,
17491
- "%"
17492
- ] }) }),
17493
- /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }) }),
17511
+ /* @__PURE__ */ jsxs(GridCell, { children: [
17512
+ /* @__PURE__ */ jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency4(order.price) }),
17513
+ order.triggerPrice != null && /* @__PURE__ */ jsxs(TriggerText, { children: [
17514
+ "Trigger ",
17515
+ formatCurrency4(order.triggerPrice)
17516
+ ] })
17517
+ ] }),
17518
+ /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $muted: true, children: filledPercent }) }),
17519
+ /* @__PURE__ */ jsxs(GridCell, { children: [
17520
+ /* @__PURE__ */ jsx(ActivityTag, { $color: meta.color, $bg: meta.bg, children: prettyLabel(order.status) }),
17521
+ order.triggerPrice != null && order.rejectionReason && /* @__PURE__ */ jsx(TriggerText, { title: order.rejectionReason, children: order.rejectionReason })
17522
+ ] }),
17494
17523
  /* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $muted: true, children: formatTimestamp(order.createdAt) }) })
17495
17524
  ] }, order.id);
17496
17525
  })
@@ -17694,7 +17723,7 @@ function PortfolioActivityPanel({
17694
17723
  /* @__PURE__ */ jsx(CancelConfirmTitle, { children: "Cancel All Orders" }),
17695
17724
  /* @__PURE__ */ jsxs(CancelConfirmBody, { children: [
17696
17725
  "Are you sure you want to cancel all ",
17697
- openOrdersCount,
17726
+ cancellableOrdersCount,
17698
17727
  " open orders? This action cannot be undone."
17699
17728
  ] }),
17700
17729
  /* @__PURE__ */ jsxs(CancelConfirmActions, { children: [