@loafmarkets/ui 0.1.264 → 0.1.265

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
@@ -12,7 +12,7 @@ import * as LightweightCharts from 'lightweight-charts';
12
12
  import { MdKingBed, MdBathtub, MdDirectionsCar, MdPool, MdYard, MdFitnessCenter } from 'react-icons/md';
13
13
  import { BiChevronUp, BiChevronDown, BiX, BiCoin, BiWallet, BiCreditCard, BiCalendar, BiInfoCircle, BiPencil, BiImages, BiVideo, BiMap } from 'react-icons/bi';
14
14
  import { FaChartLine, FaBitcoin } from 'react-icons/fa';
15
- import { FiChevronDown, FiEdit2 } from 'react-icons/fi';
15
+ import { FiEdit2 } from 'react-icons/fi';
16
16
 
17
17
  // src/components/button.tsx
18
18
  function cn(...inputs) {
@@ -13640,6 +13640,7 @@ function PortfolioActivityPanel({
13640
13640
  };
13641
13641
  const [expandedPositions, setExpandedPositions] = useState(/* @__PURE__ */ new Set());
13642
13642
  const [allExpanded, setAllExpanded] = useState(false);
13643
+ const [sortDropdownOpen, setSortDropdownOpen] = useState(false);
13643
13644
  const togglePosition = (tokenName) => {
13644
13645
  setExpandedPositions((prev) => {
13645
13646
  const next = new Set(prev);
@@ -13667,12 +13668,6 @@ function PortfolioActivityPanel({
13667
13668
  }
13668
13669
  };
13669
13670
  const sortKeys = ["asset", "units", "value", "avgPrice", "currentPrice", "pnl"];
13670
- const cycleSortKey = () => {
13671
- const idx = sortKeys.indexOf(posSortKey);
13672
- const nextKey = sortKeys[(idx + 1) % sortKeys.length];
13673
- setPosSortKey(nextKey);
13674
- setPosSortAsc(true);
13675
- };
13676
13671
  const sortedPositions = useMemo(() => {
13677
13672
  const arr = [...positions];
13678
13673
  const dir = posSortAsc ? 1 : -1;
@@ -13789,16 +13784,22 @@ function PortfolioActivityPanel({
13789
13784
  activeTab === "positions" && showPositionsTab && /* @__PURE__ */ jsxs(Fragment, { children: [
13790
13785
  positions.length === 0 && /* @__PURE__ */ jsx(EmptyState, { children: "No positions yet. Subscribe to an offering or buy on the secondary market." }),
13791
13786
  positions.length > 0 && compactPositions && /* @__PURE__ */ jsxs(Fragment, { children: [
13792
- /* @__PURE__ */ jsxs(CompactToolbar, { children: [
13793
- /* @__PURE__ */ jsxs(CompactSortBtn, { onClick: cycleSortKey, children: [
13794
- "Sort by: ",
13795
- sortKeyLabel(posSortKey),
13796
- " ",
13797
- posSortAsc ? "\u2191" : "\u2193"
13787
+ /* @__PURE__ */ jsxs(CToolbar, { children: [
13788
+ /* @__PURE__ */ jsxs(CSortWrap, { children: [
13789
+ /* @__PURE__ */ jsxs(CSortBtn, { onClick: () => setSortDropdownOpen((v) => !v), children: [
13790
+ "Sort by: ",
13791
+ sortKeyLabel(posSortKey),
13792
+ " \u25BE"
13793
+ ] }),
13794
+ sortDropdownOpen && /* @__PURE__ */ jsx(CSortDropdown, { children: sortKeys.map((k) => /* @__PURE__ */ jsx(CSortOption, { $active: posSortKey === k, onClick: () => {
13795
+ setPosSortKey(k);
13796
+ setPosSortAsc(true);
13797
+ setSortDropdownOpen(false);
13798
+ }, children: sortKeyLabel(k) }, k)) })
13798
13799
  ] }),
13799
- /* @__PURE__ */ jsxs(CompactToolbarRight, { children: [
13800
- /* @__PURE__ */ jsx(CompactActionBtn, { onClick: toggleExpandAll, children: allExpanded ? "Collapse All" : "Expand All" }),
13801
- onClosePosition && /* @__PURE__ */ jsx(CompactSellAllBtn, { onClick: () => setCloseAllOpen(true), children: "Sell All" })
13800
+ /* @__PURE__ */ jsxs(CToolbarActions, { children: [
13801
+ /* @__PURE__ */ jsx(CToolbarLink, { onClick: toggleExpandAll, children: allExpanded ? "Collapse All" : "Expand All" }),
13802
+ onClosePosition && /* @__PURE__ */ jsx(CToolbarLink, { onClick: () => setCloseAllOpen(true), children: "Sell All" })
13802
13803
  ] })
13803
13804
  ] }),
13804
13805
  pageSlice(sortedPositions).map((pos) => {
@@ -13807,45 +13808,59 @@ function PortfolioActivityPanel({
13807
13808
  const pnl = pos.propertyPnl ?? currentValue - costBasis;
13808
13809
  const pnlPercent = pos.propertyPnlPercent ?? pos.percentChange ?? 0;
13809
13810
  const isPositive = pnl >= 0;
13810
- const isExpanded = expandedPositions.has(pos.tokenName);
13811
- return /* @__PURE__ */ jsxs(CompactCard, { children: [
13812
- /* @__PURE__ */ jsxs(CompactCardHeader, { onClick: () => togglePosition(pos.tokenName), children: [
13813
- /* @__PURE__ */ jsx(CompactAsset, { onClick: (e) => {
13811
+ const posExpanded = expandedPositions.has(pos.tokenName) || allExpanded;
13812
+ const ticker = pos.tokenName.toUpperCase().slice(0, 7);
13813
+ return /* @__PURE__ */ jsxs("div", { children: [
13814
+ /* @__PURE__ */ jsxs(CRow, { $expanded: posExpanded, onClick: () => togglePosition(pos.tokenName), children: [
13815
+ /* @__PURE__ */ jsxs(CAssetCell, { onClick: (e) => {
13814
13816
  e.stopPropagation();
13815
13817
  onPositionClick?.(pos.tokenName, pos.isIpoAllocation);
13816
- }, children: pos.tokenName }),
13817
- /* @__PURE__ */ jsxs(CompactUnits, { children: [
13818
- formatNumber2(pos.quantity),
13819
- " units"
13818
+ }, children: [
13819
+ /* @__PURE__ */ jsx(CCellLabel, { children: "Asset" }),
13820
+ /* @__PURE__ */ jsxs(CAssetName, { children: [
13821
+ pos.imageUrl && /* @__PURE__ */ jsx(CAssetLogo, { src: pos.imageUrl, alt: "" }),
13822
+ pos.tokenName
13823
+ ] })
13820
13824
  ] }),
13821
- /* @__PURE__ */ jsxs(CompactPnl, { $positive: isPositive, children: [
13822
- isPositive ? "+" : "-",
13823
- formatCurrency4(Math.abs(pnl)),
13824
- " (",
13825
- isPositive ? "+" : "",
13826
- pnlPercent.toFixed(1),
13827
- "%)"
13825
+ /* @__PURE__ */ jsxs(CUnitsCell, { children: [
13826
+ /* @__PURE__ */ jsx(CCellLabel, { children: "Units" }),
13827
+ formatNumber2(pos.quantity, pos.quantity >= 100 ? 0 : 2),
13828
+ " ",
13829
+ ticker
13828
13830
  ] }),
13829
- /* @__PURE__ */ jsx(CompactChevron, { $expanded: isExpanded, children: /* @__PURE__ */ jsx(FiChevronDown, { size: 14 }) })
13831
+ /* @__PURE__ */ jsxs(CPnlCell, { children: [
13832
+ /* @__PURE__ */ jsx(CCellLabel, { children: "PNL (%)" }),
13833
+ /* @__PURE__ */ jsxs(CPnlValue, { $positive: isPositive, children: [
13834
+ isPositive ? "+" : "-",
13835
+ formatCurrency4(Math.abs(pnl))
13836
+ ] }),
13837
+ /* @__PURE__ */ jsxs(CPnlPct, { $positive: isPositive, children: [
13838
+ "(",
13839
+ isPositive ? "+" : "",
13840
+ pnlPercent.toFixed(1),
13841
+ "%)"
13842
+ ] })
13843
+ ] }),
13844
+ /* @__PURE__ */ jsx(CChevronWrap, { $open: posExpanded, children: /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "rgba(255,255,255,0.5)", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("polyline", { points: "6 9 12 15 18 9" }) }) })
13830
13845
  ] }),
13831
- isExpanded && /* @__PURE__ */ jsxs(CompactCardBody, { children: [
13832
- /* @__PURE__ */ jsxs(CompactDetailRow, { children: [
13833
- /* @__PURE__ */ jsxs(CompactDetail, { children: [
13834
- /* @__PURE__ */ jsx(CompactDetailLabel, { children: "Position Value" }),
13835
- /* @__PURE__ */ jsx(CompactDetailValue, { children: formatCurrency4(currentValue, { minimumFractionDigits: 0, maximumFractionDigits: 0 }) })
13846
+ posExpanded && /* @__PURE__ */ jsxs(CExpandedWrap, { children: [
13847
+ /* @__PURE__ */ jsxs(CDetailGrid, { children: [
13848
+ /* @__PURE__ */ jsxs(CDetailItem, { children: [
13849
+ /* @__PURE__ */ jsx(CDLabel, { children: "Position Value" }),
13850
+ /* @__PURE__ */ jsx(CDValue, { children: formatCurrency4(currentValue, { minimumFractionDigits: 0, maximumFractionDigits: 0 }) })
13836
13851
  ] }),
13837
- /* @__PURE__ */ jsxs(CompactDetail, { children: [
13838
- /* @__PURE__ */ jsx(CompactDetailLabel, { children: "Avg Price" }),
13839
- /* @__PURE__ */ jsx(CompactDetailValue, { children: formatCurrency4(pos.averageEntryPrice) })
13852
+ /* @__PURE__ */ jsxs(CDetailItem, { children: [
13853
+ /* @__PURE__ */ jsx(CDLabel, { children: "Avg Price" }),
13854
+ /* @__PURE__ */ jsx(CDValue, { children: formatCurrency4(pos.averageEntryPrice) })
13840
13855
  ] }),
13841
- /* @__PURE__ */ jsxs(CompactDetail, { children: [
13842
- /* @__PURE__ */ jsx(CompactDetailLabel, { children: "Current Price" }),
13843
- /* @__PURE__ */ jsx(CompactDetailValue, { children: formatCurrency4(pos.marketPrice) })
13856
+ /* @__PURE__ */ jsxs(CDetailItem, { children: [
13857
+ /* @__PURE__ */ jsx(CDLabel, { children: "Current Price" }),
13858
+ /* @__PURE__ */ jsx(CDValue, { children: formatCurrency4(pos.marketPrice) })
13844
13859
  ] })
13845
13860
  ] }),
13846
- onClosePosition && /* @__PURE__ */ jsxs(CompactCloseActions, { children: [
13847
- /* @__PURE__ */ jsx(CloseBtn2, { onClick: () => onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice), children: "Market Sell" }),
13848
- /* @__PURE__ */ jsx(CloseBtn2, { onClick: () => onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice), children: "Limit Sell" })
13861
+ onClosePosition && /* @__PURE__ */ jsxs(CActionRow, { children: [
13862
+ /* @__PURE__ */ jsx(CCloseBtn, { onClick: () => onClosePosition(pos.tokenName, "market", pos.quantity, pos.marketPrice), children: "Market Sell" }),
13863
+ /* @__PURE__ */ jsx(CCloseBtn, { onClick: () => onClosePosition(pos.tokenName, "limit", pos.quantity, pos.marketPrice), children: "Limit Sell" })
13849
13864
  ] })
13850
13865
  ] })
13851
13866
  ] }, pos.tokenName);
@@ -14746,147 +14761,181 @@ var CloseAllConfirmBtn = styled9.button`
14746
14761
  background: rgba(246, 70, 93, 0.25);
14747
14762
  }
14748
14763
  `;
14749
- var CompactToolbar = styled9.div`
14764
+ var CToolbar = styled9.div`
14750
14765
  display: flex;
14751
14766
  align-items: center;
14752
14767
  justify-content: space-between;
14753
- padding: 0.35rem 0.5rem;
14754
- margin-bottom: 0.25rem;
14755
- border-bottom: 1px solid rgba(255, 255, 255, 0.06);
14768
+ padding: 0.3rem 0.6rem;
14769
+ border-bottom: 1px solid rgba(255, 255, 255, 0.04);
14756
14770
  `;
14757
- var CompactSortBtn = styled9.button`
14758
- background: transparent;
14759
- border: 1px solid rgba(255, 255, 255, 0.1);
14760
- border-radius: 4px;
14761
- padding: 0.2rem 0.6rem;
14762
- font-size: 0.68rem;
14763
- font-weight: 500;
14764
- color: rgba(255, 255, 255, 0.6);
14765
- cursor: pointer;
14766
- transition: all 0.15s ease;
14767
-
14768
- &:hover {
14769
- color: rgba(255, 255, 255, 0.85);
14770
- border-color: rgba(255, 255, 255, 0.2);
14771
- }
14771
+ var CSortWrap = styled9.div`
14772
+ position: relative;
14772
14773
  `;
14773
- var CompactToolbarRight = styled9.div`
14774
+ var CSortBtn = styled9.button`
14775
+ font-size: 0.6rem;
14776
+ color: rgba(255, 255, 255, 0.45);
14777
+ background: none;
14778
+ border: none;
14779
+ cursor: pointer;
14774
14780
  display: flex;
14775
14781
  align-items: center;
14776
- gap: 0.4rem;
14782
+ gap: 0.2rem;
14783
+ &:hover { color: rgba(255, 255, 255, 0.7); }
14777
14784
  `;
14778
- var CompactActionBtn = styled9.button`
14779
- background: transparent;
14785
+ var CSortDropdown = styled9.div`
14786
+ position: absolute;
14787
+ top: 100%;
14788
+ left: 0;
14789
+ z-index: 10;
14790
+ margin-top: 2px;
14791
+ background: #1a1c24;
14780
14792
  border: 1px solid rgba(255, 255, 255, 0.1);
14781
- border-radius: 4px;
14782
- padding: 0.2rem 0.6rem;
14783
- font-size: 0.68rem;
14784
- font-weight: 500;
14785
- color: rgba(255, 255, 255, 0.6);
14786
- cursor: pointer;
14787
- transition: all 0.15s ease;
14788
-
14789
- &:hover {
14790
- color: rgba(255, 255, 255, 0.85);
14791
- border-color: rgba(255, 255, 255, 0.2);
14792
- }
14793
+ border-radius: 6px;
14794
+ overflow: hidden;
14795
+ min-width: 120px;
14796
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
14793
14797
  `;
14794
- var CompactSellAllBtn = styled9.button`
14795
- background: rgba(246, 70, 93, 0.08);
14796
- border: 1px solid rgba(246, 70, 93, 0.25);
14797
- border-radius: 4px;
14798
- padding: 0.2rem 0.6rem;
14799
- font-size: 0.68rem;
14800
- font-weight: 600;
14801
- color: #f6465d;
14798
+ var CSortOption = styled9.button`
14799
+ display: block;
14800
+ width: 100%;
14801
+ padding: 0.4rem 0.6rem;
14802
+ font-size: 0.6rem;
14803
+ font-weight: ${(p) => p.$active ? 600 : 400};
14804
+ color: ${(p) => p.$active ? "#E6C87E" : "rgba(255, 255, 255, 0.6)"};
14805
+ background: ${(p) => p.$active ? "rgba(230, 200, 126, 0.06)" : "none"};
14806
+ border: none;
14807
+ text-align: left;
14802
14808
  cursor: pointer;
14803
- transition: all 0.15s ease;
14804
-
14805
- &:hover {
14806
- background: rgba(246, 70, 93, 0.15);
14807
- border-color: rgba(246, 70, 93, 0.4);
14808
- }
14809
+ &:hover { background: rgba(255, 255, 255, 0.05); }
14809
14810
  `;
14810
- var CompactCard = styled9.div`
14811
- border-bottom: 1px solid rgba(255, 255, 255, 0.04);
14812
-
14813
- &:last-child {
14814
- border-bottom: none;
14815
- }
14811
+ var CToolbarActions = styled9.div`
14812
+ display: flex;
14813
+ gap: 0.5rem;
14816
14814
  `;
14817
- var CompactCardHeader = styled9.div`
14815
+ var CToolbarLink = styled9.button`
14816
+ font-size: 0.58rem;
14817
+ font-weight: 500;
14818
+ color: rgba(255, 255, 255, 0.45);
14819
+ background: none;
14820
+ border: none;
14821
+ cursor: pointer;
14822
+ text-decoration: underline;
14823
+ text-decoration-color: rgba(255, 255, 255, 0.15);
14824
+ &:hover { color: rgba(255, 255, 255, 0.7); }
14825
+ `;
14826
+ var CRow = styled9.button`
14818
14827
  display: grid;
14819
- grid-template-columns: 1fr 1fr 1.4fr auto;
14828
+ grid-template-columns: 1fr 1fr 1fr 24px;
14820
14829
  align-items: center;
14821
- gap: 0.5rem;
14822
- padding: 0.6rem 0.5rem;
14830
+ width: calc(100% - 1rem);
14831
+ margin: 0.25rem 0.5rem;
14832
+ margin-bottom: ${(p) => p.$expanded ? "0" : "0.25rem"};
14833
+ padding: 0.55rem 0.65rem;
14834
+ background: rgba(255, 255, 255, 0.035);
14835
+ border: 1px solid rgba(255, 255, 255, 0.06);
14836
+ border-bottom: ${(p) => p.$expanded ? "none" : "1px solid rgba(255, 255, 255, 0.06)"};
14837
+ border-radius: ${(p) => p.$expanded ? "8px 8px 0 0" : "8px"};
14823
14838
  cursor: pointer;
14824
- transition: background 0.15s ease;
14825
- border-radius: 4px;
14826
-
14827
- &:hover {
14828
- background: rgba(255, 255, 255, 0.03);
14829
- }
14839
+ text-align: left;
14840
+ transition: background 0.15s;
14841
+ outline: none;
14842
+ &:active { background: rgba(255, 255, 255, 0.06); }
14843
+ &:focus { outline: none; }
14844
+ &:focus-visible { outline: none; }
14830
14845
  `;
14831
- var CompactAsset = styled9.span`
14832
- font-size: 0.8rem;
14846
+ var CCellLabel = styled9.div`
14847
+ font-size: 0.6rem;
14848
+ font-weight: 500;
14849
+ color: rgba(255, 255, 255, 0.3);
14850
+ margin-bottom: 1px;
14851
+ `;
14852
+ var CAssetCell = styled9.div``;
14853
+ var CAssetName = styled9.div`
14854
+ font-size: 0.85rem;
14833
14855
  font-weight: 600;
14834
14856
  color: #fff;
14835
- cursor: pointer;
14836
-
14837
- &:hover {
14838
- text-decoration: underline;
14839
- color: var(--color-accent, #E6C87E);
14840
- }
14857
+ display: flex;
14858
+ align-items: center;
14859
+ gap: 0.3rem;
14841
14860
  `;
14842
- var CompactUnits = styled9.span`
14843
- font-size: 0.75rem;
14844
- color: rgba(255, 255, 255, 0.6);
14861
+ var CAssetLogo = styled9.img`
14862
+ width: 22px;
14863
+ height: 22px;
14864
+ border-radius: 4px;
14865
+ object-fit: cover;
14866
+ flex-shrink: 0;
14845
14867
  `;
14846
- var CompactPnl = styled9.span`
14847
- font-size: 0.75rem;
14868
+ var CUnitsCell = styled9.div`
14869
+ font-size: 0.78rem;
14870
+ color: rgba(255, 255, 255, 0.8);
14871
+ font-variant-numeric: tabular-nums;
14872
+ `;
14873
+ var CPnlCell = styled9.div``;
14874
+ var CPnlValue = styled9.div`
14875
+ font-size: 0.78rem;
14848
14876
  font-weight: 600;
14849
14877
  color: ${(p) => p.$positive ? "#0ecb81" : "#f6465d"};
14850
- text-align: right;
14878
+ font-variant-numeric: tabular-nums;
14851
14879
  `;
14852
- var CompactChevron = styled9.span`
14880
+ var CPnlPct = styled9.div`
14881
+ font-size: 0.62rem;
14882
+ color: ${(p) => p.$positive ? "rgba(14, 203, 129, 0.65)" : "rgba(246, 70, 93, 0.65)"};
14883
+ margin-top: 1px;
14884
+ `;
14885
+ var CChevronWrap = styled9.span`
14853
14886
  display: flex;
14854
14887
  align-items: center;
14855
14888
  justify-content: center;
14856
- color: rgba(255, 255, 255, 0.35);
14857
- transition: transform 0.2s ease;
14858
- transform: rotate(${(p) => p.$expanded ? "180deg" : "0deg"});
14889
+ transition: transform 0.2s;
14890
+ transform: rotate(${(p) => p.$open ? "180deg" : "0deg"});
14859
14891
  `;
14860
- var CompactCardBody = styled9.div`
14861
- padding: 0 0.5rem 0.6rem;
14862
- `;
14863
- var CompactDetailRow = styled9.div`
14864
- display: flex;
14865
- gap: 1.5rem;
14866
- padding: 0.5rem 0.75rem;
14867
- background: rgba(255, 255, 255, 0.02);
14868
- border-radius: 6px;
14869
- margin-bottom: 0.5rem;
14892
+ var CExpandedWrap = styled9.div`
14893
+ margin: 0 0.5rem 0.25rem;
14894
+ padding: 0.4rem 0.65rem 0.5rem;
14895
+ background: rgba(255, 255, 255, 0.035);
14896
+ border: 1px solid rgba(255, 255, 255, 0.06);
14897
+ border-top: none;
14898
+ border-radius: 0 0 8px 8px;
14870
14899
  `;
14871
- var CompactDetail = styled9.div`
14872
- display: flex;
14873
- flex-direction: column;
14874
- gap: 0.15rem;
14900
+ var CDetailGrid = styled9.div`
14901
+ display: grid;
14902
+ grid-template-columns: 1fr 1fr 1fr 24px;
14903
+ gap: 0.45rem 0;
14875
14904
  `;
14876
- var CompactDetailLabel = styled9.span`
14877
- font-size: 0.62rem;
14878
- color: rgba(255, 255, 255, 0.35);
14879
- font-weight: 500;
14905
+ var CDetailItem = styled9.div``;
14906
+ var CDLabel = styled9.div`
14907
+ font-size: 0.6rem;
14908
+ color: rgba(255, 255, 255, 0.3);
14909
+ margin-bottom: 1px;
14880
14910
  `;
14881
- var CompactDetailValue = styled9.span`
14911
+ var CDValue = styled9.div`
14882
14912
  font-size: 0.78rem;
14883
- color: #fff;
14884
14913
  font-weight: 500;
14914
+ color: rgba(255, 255, 255, 0.85);
14915
+ font-variant-numeric: tabular-nums;
14885
14916
  `;
14886
- var CompactCloseActions = styled9.div`
14887
- display: flex;
14917
+ var CActionRow = styled9.div`
14918
+ display: grid;
14919
+ grid-template-columns: 1fr 1fr;
14888
14920
  gap: 0.5rem;
14889
- padding: 0 0.75rem;
14921
+ margin-top: 0.5rem;
14922
+ `;
14923
+ var CCloseBtn = styled9.button`
14924
+ background: transparent;
14925
+ border: 1px solid rgba(230, 200, 126, 0.25);
14926
+ border-radius: 6px;
14927
+ padding: 0.45rem 0.6rem;
14928
+ font-size: 0.72rem;
14929
+ font-weight: 600;
14930
+ color: #E6C87E;
14931
+ cursor: pointer;
14932
+ white-space: nowrap;
14933
+ text-align: center;
14934
+ transition: all 0.15s ease;
14935
+ &:hover {
14936
+ background: rgba(230, 200, 126, 0.1);
14937
+ border-color: rgba(230, 200, 126, 0.5);
14938
+ }
14890
14939
  `;
14891
14940
  function PropertyBuy({
14892
14941
  propertyName = "Loaf Property",