@loafmarkets/ui 0.1.239 → 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;
@@ -1116,7 +1117,7 @@ type PropertyPhotoGalleryProps = {
1116
1117
  };
1117
1118
  declare function PropertyPhotoGallery({ isOpen, onClose, startIndex, title, subtitle, images, }: PropertyPhotoGalleryProps): react_jsx_runtime.JSX.Element | null;
1118
1119
 
1119
- type ToastVariant = 'success' | 'error' | 'info' | 'pending';
1120
+ type ToastVariant = 'success' | 'error' | 'info' | 'pending' | 'sell';
1120
1121
  type ToastData = {
1121
1122
  id: string;
1122
1123
  variant: ToastVariant;
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;
@@ -1116,7 +1117,7 @@ type PropertyPhotoGalleryProps = {
1116
1117
  };
1117
1118
  declare function PropertyPhotoGallery({ isOpen, onClose, startIndex, title, subtitle, images, }: PropertyPhotoGalleryProps): react_jsx_runtime.JSX.Element | null;
1118
1119
 
1119
- type ToastVariant = 'success' | 'error' | 'info' | 'pending';
1120
+ type ToastVariant = 'success' | 'error' | 'info' | 'pending' | 'sell';
1120
1121
  type ToastData = {
1121
1122
  id: string;
1122
1123
  variant: ToastVariant;
package/dist/index.js CHANGED
@@ -12606,6 +12606,7 @@ var progressShrink = styled9.keyframes`
12606
12606
  var VARIANT_COLORS = {
12607
12607
  success: { accent: "#0ecb81", icon: "\u2713" },
12608
12608
  error: { accent: "#f6465d", icon: "\u2715" },
12609
+ sell: { accent: "#f6465d", icon: "\u2713" },
12609
12610
  info: { accent: "#E6C656", icon: "\u2139" },
12610
12611
  pending: { accent: "#7EB3E6", icon: "\u25CC" }
12611
12612
  };
@@ -13721,6 +13722,7 @@ function PortfolioActivityPanel({
13721
13722
  tradeHistory = [],
13722
13723
  transfers = [],
13723
13724
  onCancelOrder,
13725
+ onCancelAllOrders,
13724
13726
  onAmendOrder,
13725
13727
  cancellingOrderId = null,
13726
13728
  defaultTab,
@@ -13733,6 +13735,8 @@ function PortfolioActivityPanel({
13733
13735
  const [activeTab, setActiveTab] = React5.useState(resolvedDefaultTab);
13734
13736
  const [activityPage, setActivityPage] = React5.useState(0);
13735
13737
  const [pendingCancelOrderId, setPendingCancelOrderId] = React5.useState(null);
13738
+ const [cancelAllConfirmOpen, setCancelAllConfirmOpen] = React5.useState(false);
13739
+ const [cancellingAll, setCancellingAll] = React5.useState(false);
13736
13740
  const [closeAllOpen, setCloseAllOpen] = React5.useState(false);
13737
13741
  const [closeAllType, setCloseAllType] = React5.useState("market");
13738
13742
  const [posSortKey, setPosSortKey] = React5.useState("asset");
@@ -13972,6 +13976,7 @@ function PortfolioActivityPanel({
13972
13976
  activeTab === "open-orders" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13973
13977
  openOrders.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "Open orders will appear here while they are working in the market." }),
13974
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" }) }),
13975
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: [
13976
13981
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Asset" }),
13977
13982
  /* @__PURE__ */ jsxRuntime.jsx(GridHeaderCell, { children: "Side" }),
@@ -14121,6 +14126,36 @@ function PortfolioActivityPanel({
14121
14126
  }
14122
14127
  )
14123
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
+ ] }) }),
14124
14159
  pendingCancelOrderId !== null && /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmOverlay, { onClick: () => setPendingCancelOrderId(null), children: /* @__PURE__ */ jsxRuntime.jsxs(CancelConfirmModal, { onClick: (e) => e.stopPropagation(), children: [
14125
14160
  /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmTitle, { children: "Cancel Order" }),
14126
14161
  /* @__PURE__ */ jsxRuntime.jsx(CancelConfirmBody, { children: "Are you sure you want to cancel this order? This action cannot be undone." }),
@@ -14396,6 +14431,33 @@ var CancelButton = styled9__default.default.button`
14396
14431
  cursor: not-allowed;
14397
14432
  }
14398
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
+ `;
14399
14461
  var GridHeader = styled9__default.default.div`
14400
14462
  display: grid;
14401
14463
  grid-template-columns: ${(p) => p.$columns};