@loafmarkets/ui 0.1.240 → 0.1.241

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.d.mts CHANGED
@@ -894,6 +894,7 @@ type PortfolioActivityPanelProps = {
894
894
  tradeHistory?: readonly TradeHistoryItem[];
895
895
  transfers?: readonly TransferHistoryItem[];
896
896
  onCancelOrder?: (orderId: number) => Promise<void>;
897
+ onCancelAllOrders?: () => Promise<void>;
897
898
  onAmendOrder?: (orderId: number, fields: {
898
899
  quantity?: number;
899
900
  price?: number;
@@ -905,7 +906,7 @@ type PortfolioActivityPanelProps = {
905
906
  className?: string;
906
907
  style?: React.CSSProperties;
907
908
  };
908
- declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
909
+ declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
909
910
 
910
911
  type SelectorItem = {
911
912
  readonly tokenName: string;
package/dist/index.d.ts CHANGED
@@ -894,6 +894,7 @@ type PortfolioActivityPanelProps = {
894
894
  tradeHistory?: readonly TradeHistoryItem[];
895
895
  transfers?: readonly TransferHistoryItem[];
896
896
  onCancelOrder?: (orderId: number) => Promise<void>;
897
+ onCancelAllOrders?: () => Promise<void>;
897
898
  onAmendOrder?: (orderId: number, fields: {
898
899
  quantity?: number;
899
900
  price?: number;
@@ -905,7 +906,7 @@ type PortfolioActivityPanelProps = {
905
906
  className?: string;
906
907
  style?: React.CSSProperties;
907
908
  };
908
- declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
909
+ declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, onCancelAllOrders, onAmendOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
909
910
 
910
911
  type SelectorItem = {
911
912
  readonly tokenName: string;
package/dist/index.js CHANGED
@@ -13722,6 +13722,7 @@ function PortfolioActivityPanel({
13722
13722
  tradeHistory = [],
13723
13723
  transfers = [],
13724
13724
  onCancelOrder,
13725
+ onCancelAllOrders,
13725
13726
  onAmendOrder,
13726
13727
  cancellingOrderId = null,
13727
13728
  defaultTab,
@@ -13734,6 +13735,8 @@ function PortfolioActivityPanel({
13734
13735
  const [activeTab, setActiveTab] = React5.useState(resolvedDefaultTab);
13735
13736
  const [activityPage, setActivityPage] = React5.useState(0);
13736
13737
  const [pendingCancelOrderId, setPendingCancelOrderId] = React5.useState(null);
13738
+ const [cancelAllConfirmOpen, setCancelAllConfirmOpen] = React5.useState(false);
13739
+ const [cancellingAll, setCancellingAll] = React5.useState(false);
13737
13740
  const [closeAllOpen, setCloseAllOpen] = React5.useState(false);
13738
13741
  const [closeAllType, setCloseAllType] = React5.useState("market");
13739
13742
  const [posSortKey, setPosSortKey] = React5.useState("asset");
@@ -13973,6 +13976,7 @@ function PortfolioActivityPanel({
13973
13976
  activeTab === "open-orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13974
13977
  openOrders.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
13975
13978
  openOrders.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13979
+ onCancelAllOrders && openOrdersCount > 1 && /* @__PURE__ */ jsxRuntime.jsx(CancelAllRow, { children: /* @__PURE__ */ jsxRuntime.jsx(CancelAllBtn, { type: "button", disabled: cancellingAll, onClick: () => setCancelAllConfirmOpen(true), children: "Cancel All" }) }),
13976
13980
  /* @__PURE__ */ jsxRuntime.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: [
13977
13981
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
13978
13982
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
@@ -14122,6 +14126,36 @@ function PortfolioActivityPanel({
14122
14126
  }
14123
14127
  )
14124
14128
  ] }),
14129
+ cancelAllConfirmOpen && /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmOverlay, { onClick: () => setCancelAllConfirmOpen(false), children: /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14130
+ /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmTitle, { children: "Cancel All Orders" }),
14131
+ /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmBody, { children: [
14132
+ "Are you sure you want to cancel all ",
14133
+ openOrdersCount,
14134
+ " open orders? This action cannot be undone."
14135
+ ] }),
14136
+ /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmActions, { children: [
14137
+ /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmDismiss, { type: "button", onClick: () => setCancelAllConfirmOpen(false), children: "Keep Orders" }),
14138
+ /* @__PURE__ */ jsxRuntime.jsx(
14139
+ CancelConfirmProceed,
14140
+ {
14141
+ type: "button",
14142
+ disabled: cancellingAll,
14143
+ onClick: async () => {
14144
+ if (onCancelAllOrders) {
14145
+ setCancellingAll(true);
14146
+ try {
14147
+ await onCancelAllOrders();
14148
+ } finally {
14149
+ setCancellingAll(false);
14150
+ }
14151
+ }
14152
+ setCancelAllConfirmOpen(false);
14153
+ },
14154
+ children: cancellingAll ? "Cancelling\u2026" : "Yes, Cancel All"
14155
+ }
14156
+ )
14157
+ ] })
14158
+ ] }) }),
14125
14159
  pendingCancelOrderId !== null && /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmOverlay, { onClick: () => setPendingCancelOrderId(null), children: /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14126
14160
  /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmTitle, { children: "Cancel Order" }),
14127
14161
  /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmBody, { children: "Are you sure you want to cancel this order? This action cannot be undone." }),
@@ -14397,6 +14431,33 @@ var CancelButton = styled9__default.default.button`
14397
14431
  cursor: not-allowed;
14398
14432
  }
14399
14433
  `;
14434
+ var CancelAllRow = styled9__default.default.div`
14435
+ display: flex;
14436
+ justify-content: flex-end;
14437
+ margin-bottom: 0.4rem;
14438
+ `;
14439
+ var CancelAllBtn = styled9__default.default.button`
14440
+ background: rgba(246, 70, 93, 0.08);
14441
+ border: 1px solid rgba(246, 70, 93, 0.3);
14442
+ border-radius: 4px;
14443
+ padding: 0.2rem 0.7rem;
14444
+ font-size: 0.62rem;
14445
+ font-weight: 600;
14446
+ color: #f6465d;
14447
+ cursor: pointer;
14448
+ white-space: nowrap;
14449
+ transition: all 0.15s ease;
14450
+
14451
+ &:hover {
14452
+ background: rgba(246, 70, 93, 0.18);
14453
+ border-color: rgba(246, 70, 93, 0.5);
14454
+ }
14455
+
14456
+ &:disabled {
14457
+ opacity: 0.4;
14458
+ cursor: not-allowed;
14459
+ }
14460
+ `;
14400
14461
  var GridHeader = styled9__default.default.div`
14401
14462
  display: grid;
14402
14463
  grid-template-columns: ${(p) => p.$columns};