@loafmarkets/ui 0.1.240 → 0.1.242

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
@@ -2188,23 +2188,20 @@ function DesktopOrderbookLayout({
2188
2188
  ))
2189
2189
  }
2190
2190
  ),
2191
- /* @__PURE__ */ jsxs(
2191
+ /* @__PURE__ */ jsx(
2192
2192
  "div",
2193
2193
  {
2194
2194
  ref: midRef,
2195
- className: "grid grid-cols-2 items-center gap-3 bg-[#0b1a24] px-3 py-2 flex-shrink-0",
2196
- children: [
2197
- /* @__PURE__ */ jsx("div", { className: cn("text-lg font-semibold tabular-nums", midClass), children: isLoading ? /* @__PURE__ */ jsx(Skeleton, { width: 110, height: 20 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2198
- "$",
2199
- formatNumber(midPrice, precision),
2200
- midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: cn("ml-2 text-sm font-semibold tabular-nums", midClass), children: [
2201
- midChangePercent >= 0 ? "+" : "",
2202
- midChangePercent.toFixed(2),
2203
- "%"
2204
- ] })
2205
- ] }) }),
2206
- /* @__PURE__ */ jsx("div", {})
2207
- ]
2195
+ className: "flex items-center gap-2 bg-[#0b1a24] px-3 py-2 flex-shrink-0",
2196
+ children: /* @__PURE__ */ jsx("div", { className: cn("text-lg font-semibold tabular-nums whitespace-nowrap", midClass), children: isLoading ? /* @__PURE__ */ jsx(Skeleton, { width: 110, height: 20 }) : /* @__PURE__ */ jsxs(Fragment, { children: [
2197
+ "$",
2198
+ formatNumber(midPrice, precision),
2199
+ midChangePercent == null ? null : /* @__PURE__ */ jsxs("span", { className: cn("ml-2 text-sm font-semibold tabular-nums", midClass), children: [
2200
+ midChangePercent >= 0 ? "+" : "",
2201
+ midChangePercent.toFixed(2),
2202
+ "%"
2203
+ ] })
2204
+ ] }) })
2208
2205
  }
2209
2206
  ),
2210
2207
  /* @__PURE__ */ jsx(
@@ -13696,6 +13693,7 @@ function PortfolioActivityPanel({
13696
13693
  tradeHistory = [],
13697
13694
  transfers = [],
13698
13695
  onCancelOrder,
13696
+ onCancelAllOrders,
13699
13697
  onAmendOrder,
13700
13698
  cancellingOrderId = null,
13701
13699
  defaultTab,
@@ -13708,6 +13706,8 @@ function PortfolioActivityPanel({
13708
13706
  const [activeTab, setActiveTab] = useState(resolvedDefaultTab);
13709
13707
  const [activityPage, setActivityPage] = useState(0);
13710
13708
  const [pendingCancelOrderId, setPendingCancelOrderId] = useState(null);
13709
+ const [cancelAllConfirmOpen, setCancelAllConfirmOpen] = useState(false);
13710
+ const [cancellingAll, setCancellingAll] = useState(false);
13711
13711
  const [closeAllOpen, setCloseAllOpen] = useState(false);
13712
13712
  const [closeAllType, setCloseAllType] = useState("market");
13713
13713
  const [posSortKey, setPosSortKey] = useState("asset");
@@ -13947,6 +13947,7 @@ function PortfolioActivityPanel({
13947
13947
  activeTab === "open-orders" && /* @__PURE__ */ jsxs(Fragment, { children: [
13948
13948
  openOrders.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
13949
13949
  openOrders.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
13950
+ onCancelAllOrders && openOrdersCount > 1 && /* @__PURE__ */ jsx(CancelAllRow, { children: /* @__PURE__ */ jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
13950
13951
  /* @__PURE__ */ jsxs(GridHeader, { $columns: onCancelOrder ? "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr 70px" : "1.2fr 0.6fr 0.7fr 0.8fr 1fr 0.8fr 0.8fr", children: [
13951
13952
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Asset" }),
13952
13953
  /* @__PURE__ */ jsx(GridHeaderCell, { children: "Side" }),
@@ -14096,6 +14097,36 @@ function PortfolioActivityPanel({
14096
14097
  }
14097
14098
  )
14098
14099
  ] }),
14100
+ cancelAllConfirmOpen && /* @__PURE__ */ jsx(CancelConfirmOverlay, { onClick: () => setCancelAllConfirmOpen(false), children: /* @__PURE__ */ jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14101
+ /* @__PURE__ */ jsx(CancelConfirmTitle, { children: "Cancel All Orders" }),
14102
+ /* @__PURE__ */ jsxs(CancelConfirmBody, { children: [
14103
+ "Are you sure you want to cancel all ",
14104
+ openOrdersCount,
14105
+ " open orders? This action cannot be undone."
14106
+ ] }),
14107
+ /* @__PURE__ */ jsxs(CancelConfirmActions, { children: [
14108
+ /* @__PURE__ */ jsx(CancelConfirmDismiss, { type: "button", onClick: () => setCancelAllConfirmOpen(false), children: "Keep Orders" }),
14109
+ /* @__PURE__ */ jsx(
14110
+ CancelConfirmProceed,
14111
+ {
14112
+ type: "button",
14113
+ disabled: cancellingAll,
14114
+ onClick: async () => {
14115
+ if (onCancelAllOrders) {
14116
+ setCancellingAll(true);
14117
+ try {
14118
+ await onCancelAllOrders();
14119
+ } finally {
14120
+ setCancellingAll(false);
14121
+ }
14122
+ }
14123
+ setCancelAllConfirmOpen(false);
14124
+ },
14125
+ children: cancellingAll ? "Cancelling\u2026" : "Yes, Cancel All"
14126
+ }
14127
+ )
14128
+ ] })
14129
+ ] }) }),
14099
14130
  pendingCancelOrderId !== null && /* @__PURE__ */ jsx(CancelConfirmOverlay, { onClick: () => setPendingCancelOrderId(null), children: /* @__PURE__ */ jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14100
14131
  /* @__PURE__ */ jsx(CancelConfirmTitle, { children: "Cancel Order" }),
14101
14132
  /* @__PURE__ */ jsx(CancelConfirmBody, { children: "Are you sure you want to cancel this order? This action cannot be undone." }),
@@ -14371,6 +14402,33 @@ var CancelButton = styled9.button`
14371
14402
  cursor: not-allowed;
14372
14403
  }
14373
14404
  `;
14405
+ var CancelAllRow = styled9.div`
14406
+ display: flex;
14407
+ justify-content: flex-end;
14408
+ margin-bottom: 0.4rem;
14409
+ `;
14410
+ var CancelAllBtn = styled9.button`
14411
+ background: rgba(246, 70, 93, 0.08);
14412
+ border: 1px solid rgba(246, 70, 93, 0.3);
14413
+ border-radius: 4px;
14414
+ padding: 0.2rem 0.7rem;
14415
+ font-size: 0.62rem;
14416
+ font-weight: 600;
14417
+ color: #f6465d;
14418
+ cursor: pointer;
14419
+ white-space: nowrap;
14420
+ transition: all 0.15s ease;
14421
+
14422
+ &:hover {
14423
+ background: rgba(246, 70, 93, 0.18);
14424
+ border-color: rgba(246, 70, 93, 0.5);
14425
+ }
14426
+
14427
+ &:disabled {
14428
+ opacity: 0.4;
14429
+ cursor: not-allowed;
14430
+ }
14431
+ `;
14374
14432
  var GridHeader = styled9.div`
14375
14433
  display: grid;
14376
14434
  grid-template-columns: ${(p) => p.$columns};