@loafmarkets/ui 0.1.101 → 0.1.103

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
@@ -876,6 +876,7 @@ type PortfolioActivityPanelProps = {
876
876
  positions?: readonly PortfolioPosition[];
877
877
  showPositionsTab?: boolean;
878
878
  onPositionClick?: (tokenName: string, isIpo: boolean) => void;
879
+ onClosePosition?: (tokenName: string, type: 'market' | 'limit', quantity: number, marketPrice: number) => void;
879
880
  offeringOrders?: readonly OfferingOrder[];
880
881
  openOrders?: readonly OrderHistoryItem[];
881
882
  orderHistory?: readonly OrderHistoryItem[];
@@ -889,7 +890,7 @@ type PortfolioActivityPanelProps = {
889
890
  className?: string;
890
891
  style?: React.CSSProperties;
891
892
  };
892
- declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
893
+ declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
893
894
 
894
895
  type SelectorItem = {
895
896
  readonly tokenName: string;
@@ -897,6 +898,7 @@ type SelectorItem = {
897
898
  readonly streetAddress: string;
898
899
  readonly suburb: string;
899
900
  readonly status: string;
901
+ readonly imageUrl?: string;
900
902
  };
901
903
  type AssetSelectorMetric = {
902
904
  label: string;
package/dist/index.d.ts CHANGED
@@ -876,6 +876,7 @@ type PortfolioActivityPanelProps = {
876
876
  positions?: readonly PortfolioPosition[];
877
877
  showPositionsTab?: boolean;
878
878
  onPositionClick?: (tokenName: string, isIpo: boolean) => void;
879
+ onClosePosition?: (tokenName: string, type: 'market' | 'limit', quantity: number, marketPrice: number) => void;
879
880
  offeringOrders?: readonly OfferingOrder[];
880
881
  openOrders?: readonly OrderHistoryItem[];
881
882
  orderHistory?: readonly OrderHistoryItem[];
@@ -889,7 +890,7 @@ type PortfolioActivityPanelProps = {
889
890
  className?: string;
890
891
  style?: React.CSSProperties;
891
892
  };
892
- declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
893
+ declare function PortfolioActivityPanel({ positions, showPositionsTab, onPositionClick, onClosePosition, offeringOrders, openOrders, orderHistory, tradeHistory, transfers, onCancelOrder, cancellingOrderId, defaultTab, pageSize, blockExplorerBaseUrl, className, style, }: PortfolioActivityPanelProps): react_jsx_runtime.JSX.Element;
893
894
 
894
895
  type SelectorItem = {
895
896
  readonly tokenName: string;
@@ -897,6 +898,7 @@ type SelectorItem = {
897
898
  readonly streetAddress: string;
898
899
  readonly suburb: string;
899
900
  readonly status: string;
901
+ readonly imageUrl?: string;
900
902
  };
901
903
  type AssetSelectorMetric = {
902
904
  label: string;
package/dist/index.js CHANGED
@@ -9721,7 +9721,7 @@ function AssetSelectorBar({
9721
9721
  const isCurrent = item.tokenName === currentTokenName;
9722
9722
  const status = item.status?.toUpperCase();
9723
9723
  const statusLabel = status === "PENDING" ? "Coming Soon" : status === "CLOSED" ? "Closed" : status === "CANCELLED" ? "Cancelled" : null;
9724
- return /* @__PURE__ */ jsxRuntime.jsxs(
9724
+ return /* @__PURE__ */ jsxRuntime.jsx(
9725
9725
  IPOOption,
9726
9726
  {
9727
9727
  onClick: () => {
@@ -9732,16 +9732,19 @@ function AssetSelectorBar({
9732
9732
  },
9733
9733
  $selected: isCurrent,
9734
9734
  style: { cursor: isCurrent ? "default" : "pointer" },
9735
- children: [
9736
- /* @__PURE__ */ jsxRuntime.jsxs(IPOOptionName, { children: [
9737
- item.streetAddress,
9738
- item.ticker ? ` (${item.ticker})` : ""
9739
- ] }),
9740
- /* @__PURE__ */ jsxRuntime.jsxs(IPOOptionLocation, { children: [
9741
- item.suburb,
9742
- statusLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { children: statusLabel })
9735
+ children: /* @__PURE__ */ jsxRuntime.jsxs(IPOOptionInner, { children: [
9736
+ item.imageUrl && /* @__PURE__ */ jsxRuntime.jsx(IPOOptionThumb, { src: item.imageUrl, alt: item.streetAddress }),
9737
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
9738
+ /* @__PURE__ */ jsxRuntime.jsxs(IPOOptionName, { children: [
9739
+ item.streetAddress,
9740
+ item.ticker ? ` (${item.ticker})` : ""
9741
+ ] }),
9742
+ /* @__PURE__ */ jsxRuntime.jsxs(IPOOptionLocation, { children: [
9743
+ item.suburb,
9744
+ statusLabel && /* @__PURE__ */ jsxRuntime.jsx("span", { children: statusLabel })
9745
+ ] })
9743
9746
  ] })
9744
- ]
9747
+ ] })
9745
9748
  },
9746
9749
  item.tokenName
9747
9750
  );
@@ -9928,6 +9931,19 @@ var IPOOption = styled25__default.default.div`
9928
9931
  &:hover { background: linear-gradient(90deg, rgba(255,255,255,0.06) 0%, transparent 100%); }
9929
9932
  ${(p) => p.$selected && `background: linear-gradient(90deg, rgba(56,97,251,0.15) 0%, transparent 100%);`}
9930
9933
  `;
9934
+ var IPOOptionInner = styled25__default.default.div`
9935
+ display: flex;
9936
+ align-items: center;
9937
+ gap: 1rem;
9938
+ `;
9939
+ var IPOOptionThumb = styled25__default.default.img`
9940
+ width: 36px;
9941
+ height: 36px;
9942
+ border-radius: 6px;
9943
+ object-fit: cover;
9944
+ flex-shrink: 0;
9945
+ border: 1px solid rgba(255, 255, 255, 0.08);
9946
+ `;
9931
9947
  var IPOOptionName = styled25__default.default.div`
9932
9948
  font-weight: 600;
9933
9949
  font-size: 1rem;
@@ -11871,6 +11887,7 @@ function PortfolioActivityPanel({
11871
11887
  positions = [],
11872
11888
  showPositionsTab = false,
11873
11889
  onPositionClick,
11890
+ onClosePosition,
11874
11891
  offeringOrders = [],
11875
11892
  openOrders = [],
11876
11893
  orderHistory = [],
@@ -11969,13 +11986,14 @@ function PortfolioActivityPanel({
11969
11986
  activeTab === "positions" && showPositionsTab && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11970
11987
  positions.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(EmptyState, { children: "No positions yet. Subscribe to an offering or buy on the secondary market." }),
11971
11988
  positions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
11972
- /* @__PURE__ */ jsxRuntime.jsxs(PositionsHeader, { children: [
11989
+ /* @__PURE__ */ jsxRuntime.jsxs(PositionsHeader, { $hasClose: !!onClosePosition, children: [
11973
11990
  /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { children: "Asset" }),
11974
11991
  /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { $align: "right", children: "Size" }),
11975
11992
  /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { $align: "right", children: "Value" }),
11976
11993
  /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { $align: "right", children: "Entry Price" }),
11977
11994
  /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { $align: "right", children: "Mark Price" }),
11978
- /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { $align: "right", children: "PNL (%)" })
11995
+ /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { $align: "right", children: "PNL (%)" }),
11996
+ onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsHeaderCell, { $align: "right", children: "Close" })
11979
11997
  ] }),
11980
11998
  pageSlice(positions).map((pos) => {
11981
11999
  const currentValue = pos.quantity * pos.marketPrice;
@@ -11983,7 +12001,7 @@ function PortfolioActivityPanel({
11983
12001
  const pnl = pos.propertyPnl ?? currentValue - costBasis;
11984
12002
  const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
11985
12003
  const isPositive = pnl >= 0;
11986
- return /* @__PURE__ */ jsxRuntime.jsxs(PositionsRow, { onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: [
12004
+ return /* @__PURE__ */ jsxRuntime.jsxs(PositionsRow, { $hasClose: !!onClosePosition, onClick: () => onPositionClick?.(pos.tokenName, pos.isIpoAllocation), children: [
11987
12005
  /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { children: /* @__PURE__ */ jsxRuntime.jsx(HoldingsProperty, { children: pos.tokenName }) }),
11988
12006
  /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { $align: "right", children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: formatNumber2(pos.quantity) }) }),
11989
12007
  /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { $align: "right", children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#fff", fontSize: "0.8rem" }, children: formatCurrency5(currentValue) }) }),
@@ -11999,7 +12017,17 @@ function PortfolioActivityPanel({
11999
12017
  pnlPercent.toFixed(1),
12000
12018
  "%"
12001
12019
  ] })
12002
- ] })
12020
+ ] }),
12021
+ onClosePosition && /* @__PURE__ */ jsxRuntime.jsx(PositionsCell, { $align: "right", children: /* @__PURE__ */ jsxRuntime.jsxs(CloseActions, { children: [
12022
+ /* @__PURE__ */ jsxRuntime.jsx(CloseBtn2, { onClick: (e) => {
12023
+ e.stopPropagation();
12024
+ onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice);
12025
+ }, children: "Limit" }),
12026
+ /* @__PURE__ */ jsxRuntime.jsx(CloseBtn2, { onClick: (e) => {
12027
+ e.stopPropagation();
12028
+ onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice);
12029
+ }, children: "Market" })
12030
+ ] }) })
12003
12031
  ] }, pos.tokenName);
12004
12032
  })
12005
12033
  ] })
@@ -12386,7 +12414,7 @@ var PaginationLabel = styled25__default.default.span`
12386
12414
  `;
12387
12415
  var PositionsHeader = styled25__default.default.div`
12388
12416
  display: grid;
12389
- grid-template-columns: 1.2fr 0.8fr 1fr 1fr 1fr 1.2fr;
12417
+ grid-template-columns: ${(p) => p.$hasClose ? "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr auto" : "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr"};
12390
12418
  gap: 0 0.5rem;
12391
12419
  padding: 0.4rem 0.5rem;
12392
12420
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
@@ -12400,7 +12428,7 @@ var PositionsHeaderCell = styled25__default.default.div`
12400
12428
  `;
12401
12429
  var PositionsRow = styled25__default.default.div`
12402
12430
  display: grid;
12403
- grid-template-columns: 1.2fr 0.8fr 1fr 1fr 1fr 1.2fr;
12431
+ grid-template-columns: ${(p) => p.$hasClose ? "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr auto" : "1.2fr 0.8fr 1fr 1fr 1fr 1.2fr"};
12404
12432
  align-items: center;
12405
12433
  gap: 0 0.5rem;
12406
12434
  padding: 0.5rem 0.5rem;
@@ -12523,6 +12551,28 @@ var CancelConfirmProceed = styled25__default.default.button`
12523
12551
  cursor: not-allowed;
12524
12552
  }
12525
12553
  `;
12554
+ var CloseActions = styled25__default.default.div`
12555
+ display: flex;
12556
+ gap: 0.35rem;
12557
+ align-items: center;
12558
+ `;
12559
+ var CloseBtn2 = styled25__default.default.button`
12560
+ background: transparent;
12561
+ border: 1px solid rgba(246, 70, 93, 0.25);
12562
+ border-radius: 4px;
12563
+ padding: 0.15rem 0.5rem;
12564
+ font-size: 0.62rem;
12565
+ font-weight: 600;
12566
+ color: #f6465d;
12567
+ cursor: pointer;
12568
+ white-space: nowrap;
12569
+ transition: all 0.15s ease;
12570
+
12571
+ &:hover {
12572
+ background: rgba(246, 70, 93, 0.1);
12573
+ border-color: rgba(246, 70, 93, 0.5);
12574
+ }
12575
+ `;
12526
12576
  function NewsOrdersSection({ newsItems, newsConnectionStatus, activityData }) {
12527
12577
  return /* @__PURE__ */ jsxRuntime.jsxs(Row2, { children: [
12528
12578
  /* @__PURE__ */ jsxRuntime.jsx(