@loafmarkets/ui 0.1.4 → 0.1.5

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.js CHANGED
@@ -3358,7 +3358,7 @@ function DesktopOrderbookLayout({
3358
3358
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: [
3359
3359
  "$",
3360
3360
  formatNumber(midPrice, precision),
3361
- midChangePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "ml-2 text-sm font-semibold", children: [
3361
+ midChangePercent == null ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("ml-2 text-sm font-semibold tabular-nums", midClass), children: [
3362
3362
  midChangePercent >= 0 ? "+" : "",
3363
3363
  midChangePercent.toFixed(2),
3364
3364
  "%"
@@ -3413,18 +3413,18 @@ function MobileOrderbookLayout({
3413
3413
  const visibleBids = o__namespace.useMemo(() => bids.slice(0, COMPACT_ROWS_VISIBLE), [bids]);
3414
3414
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
3415
3415
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 pt-2", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
3416
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
3416
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
3417
3417
  /* @__PURE__ */ jsxRuntime.jsx(
3418
3418
  "span",
3419
3419
  {
3420
3420
  onClick: () => handleTab("orderbook"),
3421
3421
  style: {
3422
3422
  cursor: "pointer",
3423
- fontSize: "0.8rem",
3423
+ fontSize: "0.72rem",
3424
3424
  fontWeight: tab === "orderbook" ? 600 : 400,
3425
3425
  color: tab === "orderbook" ? "#fff" : "rgba(255,255,255,0.6)",
3426
3426
  borderBottom: tab === "orderbook" ? "2px solid #C9A227" : "none",
3427
- paddingBottom: "0.25rem"
3427
+ paddingBottom: "0.2rem"
3428
3428
  },
3429
3429
  children: "Orderbook"
3430
3430
  }
@@ -3435,11 +3435,11 @@ function MobileOrderbookLayout({
3435
3435
  onClick: () => handleTab("trades"),
3436
3436
  style: {
3437
3437
  cursor: "pointer",
3438
- fontSize: "0.8rem",
3438
+ fontSize: "0.72rem",
3439
3439
  fontWeight: tab === "trades" ? 600 : 400,
3440
3440
  color: tab === "trades" ? "#fff" : "rgba(255,255,255,0.6)",
3441
3441
  borderBottom: tab === "trades" ? "2px solid #C9A227" : "none",
3442
- paddingBottom: "0.25rem"
3442
+ paddingBottom: "0.2rem"
3443
3443
  },
3444
3444
  children: "Trades"
3445
3445
  }
@@ -3499,20 +3499,26 @@ function MobileOrderbookLayout({
3499
3499
  gridTemplateColumns: "1.2fr 0.8fr",
3500
3500
  padding: "0.3rem 0",
3501
3501
  fontSize: "0.8rem",
3502
- backgroundColor: "rgba(0, 123, 255, 0.05)",
3503
3502
  borderTop: "1px solid rgba(255,255,255,0.1)",
3504
3503
  borderBottom: "1px solid rgba(255,255,255,0.1)"
3505
3504
  },
3506
3505
  children: [
3507
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" }, className: midClass, children: [
3508
- "$",
3509
- formatNumber(midPrice, precision),
3510
- midChangePercent != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { fontSize: "0.8rem" }, className: midClass, children: [
3511
- midChangePercent >= 0 ? "+" : "",
3512
- midChangePercent.toFixed(2),
3513
- "%"
3514
- ] })
3515
- ] }),
3506
+ /* @__PURE__ */ jsxRuntime.jsxs(
3507
+ "div",
3508
+ {
3509
+ style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" },
3510
+ className: midClass,
3511
+ children: [
3512
+ "$",
3513
+ formatNumber(midPrice, precision),
3514
+ midChangePercent != null && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: cn("text-[0.75rem] font-semibold tabular-nums", midClass), children: [
3515
+ midChangePercent >= 0 ? "+" : "",
3516
+ midChangePercent.toFixed(2),
3517
+ "%"
3518
+ ] })
3519
+ ]
3520
+ }
3521
+ ),
3516
3522
  /* @__PURE__ */ jsxRuntime.jsx("div", {})
3517
3523
  ]
3518
3524
  }
@@ -4405,6 +4411,10 @@ var YourOrders = o__namespace.forwardRef(
4405
4411
  const resolvedTabs = tabs ?? DEFAULT_TABS.map((t) => ({ ...t, orders: orders ?? [], emptyState: `No ${t.label.toLowerCase()} data available.` }));
4406
4412
  const activeTab = resolvedTabs.find((t) => t.id === effectiveActiveTabId) ?? resolvedTabs[0];
4407
4413
  const activeOrders = activeTab?.orders ?? orders ?? [];
4414
+ const tabSupportsActions = activeTab?.enableCancel ?? true;
4415
+ const showActionsColumn = Boolean(renderOrderActions && tabSupportsActions);
4416
+ const baseGridTemplate = "1.8fr 0.9fr 0.7fr 0.8fr 0.8fr 1fr";
4417
+ const gridTemplateColumns = showActionsColumn ? "1.8fr 0.8fr 0.7fr 0.8fr 0.8fr 0.9fr 0.8fr" : baseGridTemplate;
4408
4418
  const displayTitle = title ?? activeTab?.title ?? activeTab?.label ?? "Portfolio Holdings";
4409
4419
  console.log("[YourOrders] tabs:", tabs?.map((t) => ({ id: t.id, ordersCount: t.orders?.length })));
4410
4420
  console.log("[YourOrders] activeTabId prop:", activeTabId);
@@ -4417,13 +4427,14 @@ var YourOrders = o__namespace.forwardRef(
4417
4427
  return /* @__PURE__ */ jsxRuntime.jsx("div", { style: emptyStateStyle, children: emptyMessage });
4418
4428
  }
4419
4429
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4420
- /* @__PURE__ */ jsxRuntime.jsxs("div", { style: tableHeaderStyle, children: [
4430
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...tableHeaderStyle, gridTemplateColumns }, children: [
4421
4431
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Property" }),
4422
4432
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Value" }),
4423
4433
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Holding" }),
4424
4434
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "% of Property" }),
4425
4435
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "Avg Price" }),
4426
- /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "P&L" })
4436
+ /* @__PURE__ */ jsxRuntime.jsx("div", { style: tableHeaderCell, children: "P&L" }),
4437
+ showActionsColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...tableHeaderCell, textAlign: "right" }, children: "Actions" }) : null
4427
4438
  ] }),
4428
4439
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children: activeOrders.map((order) => {
4429
4440
  const propertyName = order.asset;
@@ -4441,7 +4452,7 @@ var YourOrders = o__namespace.forwardRef(
4441
4452
  const currentPrice = order.currentPrice ?? order.price;
4442
4453
  const priceChangePercent = order.priceChangePercent ?? order.pnlPercent;
4443
4454
  const priceChangePositive = order.priceChangePositive ?? (priceChangePercent != null ? priceChangePercent >= 0 : void 0);
4444
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...rowStyle, gridTemplateColumns: renderOrderActions ? "1.8fr 0.8fr 0.7fr 0.8fr 0.8fr 0.9fr 0.8fr" : "1.8fr 0.9fr 0.7fr 0.8fr 0.8fr 1fr" }, children: [
4455
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { ...rowStyle, gridTemplateColumns }, children: [
4445
4456
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", gap: "1rem", alignItems: "center" }, children: [
4446
4457
  /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.15rem" }, children: [
4447
4458
  /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500 }, children: propertyName }),
@@ -4513,7 +4524,7 @@ var YourOrders = o__namespace.forwardRef(
4513
4524
  ]
4514
4525
  }
4515
4526
  ),
4516
- renderOrderActions ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions(order) }) : null
4527
+ showActionsColumn ? /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions?.(order) }) : null
4517
4528
  ] }, order.id);
4518
4529
  }) })
4519
4530
  ] });