@loafmarkets/ui 0.1.112 → 0.1.113
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 +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +82 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -11,6 +11,7 @@ import { Newspaper } from 'lucide-react';
|
|
|
11
11
|
import * as LightweightCharts from 'lightweight-charts';
|
|
12
12
|
import { BiChevronUp, BiChevronDown, BiX, BiCoin, BiWallet, BiCreditCard, BiCalendar, BiInfoCircle, BiPencil, BiImages, BiVideo, BiMap } from 'react-icons/bi';
|
|
13
13
|
import { FaChartLine, FaBitcoin } from 'react-icons/fa';
|
|
14
|
+
import { FiEdit2 } from 'react-icons/fi';
|
|
14
15
|
|
|
15
16
|
// src/components/button.tsx
|
|
16
17
|
function cn(...inputs) {
|
|
@@ -11852,6 +11853,45 @@ var getOrderStatusMeta = (statusRaw) => {
|
|
|
11852
11853
|
}
|
|
11853
11854
|
return { color: "#f0b90b", bg: "rgba(240,185,11,0.15)" };
|
|
11854
11855
|
};
|
|
11856
|
+
function EditableField({ value, onCommit, format }) {
|
|
11857
|
+
const [editing, setEditing] = useState(false);
|
|
11858
|
+
const [draft, setDraft] = useState("");
|
|
11859
|
+
const inputRef = useRef(null);
|
|
11860
|
+
useEffect(() => {
|
|
11861
|
+
if (editing) inputRef.current?.focus();
|
|
11862
|
+
}, [editing]);
|
|
11863
|
+
const commit = () => {
|
|
11864
|
+
const parsed = parseFloat(draft);
|
|
11865
|
+
if (!isNaN(parsed) && parsed > 0 && parsed !== value) {
|
|
11866
|
+
onCommit(parsed);
|
|
11867
|
+
}
|
|
11868
|
+
setEditing(false);
|
|
11869
|
+
};
|
|
11870
|
+
if (editing) {
|
|
11871
|
+
return /* @__PURE__ */ jsx(
|
|
11872
|
+
EditInput,
|
|
11873
|
+
{
|
|
11874
|
+
ref: inputRef,
|
|
11875
|
+
type: "number",
|
|
11876
|
+
step: "any",
|
|
11877
|
+
value: draft,
|
|
11878
|
+
onChange: (e) => setDraft(e.target.value),
|
|
11879
|
+
onBlur: commit,
|
|
11880
|
+
onKeyDown: (e) => {
|
|
11881
|
+
if (e.key === "Enter") commit();
|
|
11882
|
+
if (e.key === "Escape") setEditing(false);
|
|
11883
|
+
}
|
|
11884
|
+
}
|
|
11885
|
+
);
|
|
11886
|
+
}
|
|
11887
|
+
return /* @__PURE__ */ jsxs(EditableCellWrap, { onClick: () => {
|
|
11888
|
+
setDraft(String(value));
|
|
11889
|
+
setEditing(true);
|
|
11890
|
+
}, children: [
|
|
11891
|
+
/* @__PURE__ */ jsx("span", { children: format(value) }),
|
|
11892
|
+
/* @__PURE__ */ jsx(FiEdit2, { size: 10 })
|
|
11893
|
+
] });
|
|
11894
|
+
}
|
|
11855
11895
|
function PortfolioActivityPanel({
|
|
11856
11896
|
positions = [],
|
|
11857
11897
|
showPositionsTab = false,
|
|
@@ -11863,6 +11903,7 @@ function PortfolioActivityPanel({
|
|
|
11863
11903
|
tradeHistory = [],
|
|
11864
11904
|
transfers = [],
|
|
11865
11905
|
onCancelOrder,
|
|
11906
|
+
onAmendOrder,
|
|
11866
11907
|
cancellingOrderId = null,
|
|
11867
11908
|
defaultTab,
|
|
11868
11909
|
pageSize = ACTIVITY_PAGE_SIZE_DEFAULT,
|
|
@@ -12047,8 +12088,8 @@ function PortfolioActivityPanel({
|
|
|
12047
12088
|
/* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $primary: true, children: order.tokenName }) }),
|
|
12048
12089
|
/* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(SideBadge, { $side: sideLabel(order.side), children: sideLabel(order.side) }) }),
|
|
12049
12090
|
/* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { $muted: true, children: prettyLabel(order.type) }) }),
|
|
12050
|
-
/* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { children: formatNumber2(order.quantity) }) }),
|
|
12051
|
-
/* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency5(order.price) }) }),
|
|
12091
|
+
/* @__PURE__ */ jsx(GridCell, { children: onAmendOrder ? /* @__PURE__ */ jsx(EditableField, { value: order.quantity, format: formatNumber2, onCommit: (v) => onAmendOrder(order.id, { quantity: v }) }) : /* @__PURE__ */ jsx(CellText, { children: formatNumber2(order.quantity) }) }),
|
|
12092
|
+
/* @__PURE__ */ jsx(GridCell, { children: !isMarket && order.price && onAmendOrder ? /* @__PURE__ */ jsx(EditableField, { value: order.price, format: (v) => formatCurrency5(v), onCommit: (v) => onAmendOrder(order.id, { price: v }) }) : /* @__PURE__ */ jsx(CellText, { children: isMarket || !order.price ? "Market" : formatCurrency5(order.price) }) }),
|
|
12052
12093
|
/* @__PURE__ */ jsx(GridCell, { children: /* @__PURE__ */ jsxs(CellText, { $muted: true, children: [
|
|
12053
12094
|
filledPercent,
|
|
12054
12095
|
"%"
|
|
@@ -12480,6 +12521,45 @@ var SideBadge = styled25.span`
|
|
|
12480
12521
|
font-weight: 600;
|
|
12481
12522
|
color: ${({ $side }) => $side === "Buy" ? "#0ecb81" : "#f6465d"};
|
|
12482
12523
|
`;
|
|
12524
|
+
var EditableCellWrap = styled25.span`
|
|
12525
|
+
display: inline-flex;
|
|
12526
|
+
align-items: center;
|
|
12527
|
+
gap: 0.35rem;
|
|
12528
|
+
cursor: pointer;
|
|
12529
|
+
color: #fff;
|
|
12530
|
+
font-size: 0.8rem;
|
|
12531
|
+
|
|
12532
|
+
svg {
|
|
12533
|
+
color: rgba(255, 255, 255, 0.25);
|
|
12534
|
+
transition: color 0.15s;
|
|
12535
|
+
}
|
|
12536
|
+
|
|
12537
|
+
&:hover svg {
|
|
12538
|
+
color: var(--color-accent, #E6C87E);
|
|
12539
|
+
}
|
|
12540
|
+
`;
|
|
12541
|
+
var EditInput = styled25.input`
|
|
12542
|
+
width: 5rem;
|
|
12543
|
+
background: rgba(255, 255, 255, 0.06);
|
|
12544
|
+
border: 1px solid rgba(255, 255, 255, 0.15);
|
|
12545
|
+
border-radius: 4px;
|
|
12546
|
+
padding: 0.2rem 0.4rem;
|
|
12547
|
+
font-size: 0.78rem;
|
|
12548
|
+
color: #fff;
|
|
12549
|
+
outline: none;
|
|
12550
|
+
font-family: inherit;
|
|
12551
|
+
|
|
12552
|
+
&:focus {
|
|
12553
|
+
border-color: var(--color-accent, #E6C87E);
|
|
12554
|
+
}
|
|
12555
|
+
|
|
12556
|
+
&::-webkit-inner-spin-button,
|
|
12557
|
+
&::-webkit-outer-spin-button {
|
|
12558
|
+
-webkit-appearance: none;
|
|
12559
|
+
margin: 0;
|
|
12560
|
+
}
|
|
12561
|
+
-moz-appearance: textfield;
|
|
12562
|
+
`;
|
|
12483
12563
|
var CancelConfirmOverlay = styled25.div`
|
|
12484
12564
|
position: fixed;
|
|
12485
12565
|
inset: 0;
|