@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.mjs CHANGED
@@ -3336,7 +3336,7 @@ function DesktopOrderbookLayout({
3336
3336
  /* @__PURE__ */ jsxs("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: [
3337
3337
  "$",
3338
3338
  formatNumber(midPrice, precision),
3339
- midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: "ml-2 text-sm font-semibold", children: [
3339
+ midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: cn("ml-2 text-sm font-semibold tabular-nums", midClass), children: [
3340
3340
  midChangePercent >= 0 ? "+" : "",
3341
3341
  midChangePercent.toFixed(2),
3342
3342
  "%"
@@ -3391,18 +3391,18 @@ function MobileOrderbookLayout({
3391
3391
  const visibleBids = o.useMemo(() => bids.slice(0, COMPACT_ROWS_VISIBLE), [bids]);
3392
3392
  return /* @__PURE__ */ jsxs(Fragment, { children: [
3393
3393
  /* @__PURE__ */ jsx("div", { className: "px-3 pt-2", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
3394
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3", children: [
3394
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
3395
3395
  /* @__PURE__ */ jsx(
3396
3396
  "span",
3397
3397
  {
3398
3398
  onClick: () => handleTab("orderbook"),
3399
3399
  style: {
3400
3400
  cursor: "pointer",
3401
- fontSize: "0.8rem",
3401
+ fontSize: "0.72rem",
3402
3402
  fontWeight: tab === "orderbook" ? 600 : 400,
3403
3403
  color: tab === "orderbook" ? "#fff" : "rgba(255,255,255,0.6)",
3404
3404
  borderBottom: tab === "orderbook" ? "2px solid #C9A227" : "none",
3405
- paddingBottom: "0.25rem"
3405
+ paddingBottom: "0.2rem"
3406
3406
  },
3407
3407
  children: "Orderbook"
3408
3408
  }
@@ -3413,11 +3413,11 @@ function MobileOrderbookLayout({
3413
3413
  onClick: () => handleTab("trades"),
3414
3414
  style: {
3415
3415
  cursor: "pointer",
3416
- fontSize: "0.8rem",
3416
+ fontSize: "0.72rem",
3417
3417
  fontWeight: tab === "trades" ? 600 : 400,
3418
3418
  color: tab === "trades" ? "#fff" : "rgba(255,255,255,0.6)",
3419
3419
  borderBottom: tab === "trades" ? "2px solid #C9A227" : "none",
3420
- paddingBottom: "0.25rem"
3420
+ paddingBottom: "0.2rem"
3421
3421
  },
3422
3422
  children: "Trades"
3423
3423
  }
@@ -3477,20 +3477,26 @@ function MobileOrderbookLayout({
3477
3477
  gridTemplateColumns: "1.2fr 0.8fr",
3478
3478
  padding: "0.3rem 0",
3479
3479
  fontSize: "0.8rem",
3480
- backgroundColor: "rgba(0, 123, 255, 0.05)",
3481
3480
  borderTop: "1px solid rgba(255,255,255,0.1)",
3482
3481
  borderBottom: "1px solid rgba(255,255,255,0.1)"
3483
3482
  },
3484
3483
  children: [
3485
- /* @__PURE__ */ jsxs("div", { style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" }, className: midClass, children: [
3486
- "$",
3487
- formatNumber(midPrice, precision),
3488
- midChangePercent != null && /* @__PURE__ */ jsxs("span", { style: { fontSize: "0.8rem" }, className: midClass, children: [
3489
- midChangePercent >= 0 ? "+" : "",
3490
- midChangePercent.toFixed(2),
3491
- "%"
3492
- ] })
3493
- ] }),
3484
+ /* @__PURE__ */ jsxs(
3485
+ "div",
3486
+ {
3487
+ style: { fontWeight: "bold", display: "flex", alignItems: "center", gap: "8px" },
3488
+ className: midClass,
3489
+ children: [
3490
+ "$",
3491
+ formatNumber(midPrice, precision),
3492
+ midChangePercent != null && /* @__PURE__ */ jsxs("span", { className: cn("text-[0.75rem] font-semibold tabular-nums", midClass), children: [
3493
+ midChangePercent >= 0 ? "+" : "",
3494
+ midChangePercent.toFixed(2),
3495
+ "%"
3496
+ ] })
3497
+ ]
3498
+ }
3499
+ ),
3494
3500
  /* @__PURE__ */ jsx("div", {})
3495
3501
  ]
3496
3502
  }
@@ -4383,6 +4389,10 @@ var YourOrders = o.forwardRef(
4383
4389
  const resolvedTabs = tabs ?? DEFAULT_TABS.map((t) => ({ ...t, orders: orders ?? [], emptyState: `No ${t.label.toLowerCase()} data available.` }));
4384
4390
  const activeTab = resolvedTabs.find((t) => t.id === effectiveActiveTabId) ?? resolvedTabs[0];
4385
4391
  const activeOrders = activeTab?.orders ?? orders ?? [];
4392
+ const tabSupportsActions = activeTab?.enableCancel ?? true;
4393
+ const showActionsColumn = Boolean(renderOrderActions && tabSupportsActions);
4394
+ const baseGridTemplate = "1.8fr 0.9fr 0.7fr 0.8fr 0.8fr 1fr";
4395
+ const gridTemplateColumns = showActionsColumn ? "1.8fr 0.8fr 0.7fr 0.8fr 0.8fr 0.9fr 0.8fr" : baseGridTemplate;
4386
4396
  const displayTitle = title ?? activeTab?.title ?? activeTab?.label ?? "Portfolio Holdings";
4387
4397
  console.log("[YourOrders] tabs:", tabs?.map((t) => ({ id: t.id, ordersCount: t.orders?.length })));
4388
4398
  console.log("[YourOrders] activeTabId prop:", activeTabId);
@@ -4395,13 +4405,14 @@ var YourOrders = o.forwardRef(
4395
4405
  return /* @__PURE__ */ jsx("div", { style: emptyStateStyle, children: emptyMessage });
4396
4406
  }
4397
4407
  return /* @__PURE__ */ jsxs(Fragment, { children: [
4398
- /* @__PURE__ */ jsxs("div", { style: tableHeaderStyle, children: [
4408
+ /* @__PURE__ */ jsxs("div", { style: { ...tableHeaderStyle, gridTemplateColumns }, children: [
4399
4409
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Property" }),
4400
4410
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Value" }),
4401
4411
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Holding" }),
4402
4412
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "% of Property" }),
4403
4413
  /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "Avg Price" }),
4404
- /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "P&L" })
4414
+ /* @__PURE__ */ jsx("div", { style: tableHeaderCell, children: "P&L" }),
4415
+ showActionsColumn ? /* @__PURE__ */ jsx("div", { style: { ...tableHeaderCell, textAlign: "right" }, children: "Actions" }) : null
4405
4416
  ] }),
4406
4417
  /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.65rem" }, children: activeOrders.map((order) => {
4407
4418
  const propertyName = order.asset;
@@ -4419,7 +4430,7 @@ var YourOrders = o.forwardRef(
4419
4430
  const currentPrice = order.currentPrice ?? order.price;
4420
4431
  const priceChangePercent = order.priceChangePercent ?? order.pnlPercent;
4421
4432
  const priceChangePositive = order.priceChangePositive ?? (priceChangePercent != null ? priceChangePercent >= 0 : void 0);
4422
- return /* @__PURE__ */ 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: [
4433
+ return /* @__PURE__ */ jsxs("div", { style: { ...rowStyle, gridTemplateColumns }, children: [
4423
4434
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", gap: "1rem", alignItems: "center" }, children: [
4424
4435
  /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: "0.15rem" }, children: [
4425
4436
  /* @__PURE__ */ jsx("div", { style: { fontSize: "0.9rem", fontWeight: 500 }, children: propertyName }),
@@ -4491,7 +4502,7 @@ var YourOrders = o.forwardRef(
4491
4502
  ]
4492
4503
  }
4493
4504
  ),
4494
- renderOrderActions ? /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions(order) }) : null
4505
+ showActionsColumn ? /* @__PURE__ */ jsx("div", { style: { display: "flex", justifyContent: "flex-end" }, children: renderOrderActions?.(order) }) : null
4495
4506
  ] }, order.id);
4496
4507
  }) })
4497
4508
  ] });